Skip to content

Commit

Permalink
Build Monitor supports Jenkins CSRF protection
Browse files Browse the repository at this point in the history
Closes #46
  • Loading branch information
jan-molak committed Mar 1, 2014
1 parent f75a2fe commit e716968
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/webapp/scripts/jenkins.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ angular.module('jenkins', []).
data: stringified(parameters),
headers: {
'Content-Type': STAPLER_CONTENT_TYPE,
'Crumb': binding.crumb
'Crumb': binding.crumb, // Crumb header is needed to get past Stapler
'.crumb': binding.crumb // .crumb header is needed to support CSRF protection (#46)
}
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/javascript/unit/jenkins/proxyFromSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ describe('buildMonitor', function () {
headers: {
'Accept': 'application/json, text/plain, */*',
'Content-Type': 'application/x-stapler-method-invocation;charset=UTF-8',
'Crumb': crumb
'Crumb': crumb,
'.crumb': crumb
}
};

Expand Down

0 comments on commit e716968

Please sign in to comment.