Skip to content

Commit

Permalink
Logging args during audit failures
Browse files Browse the repository at this point in the history
  • Loading branch information
kobelb committed Jun 1, 2018
1 parent 762833f commit f043655
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/security/server/lib/audit_logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class SecurityAuditLogger {
this._auditLogger = auditLogger;
}

savedObjectsAuthorizationFailure(username, action, types, missing) {
savedObjectsAuthorizationFailure(username, action, types, missing, args) {
if (!this._enabled) {
return;
}
Expand All @@ -22,7 +22,8 @@ export class SecurityAuditLogger {
username,
action,
types,
missing
missing,
args
}
);
}
Expand Down
10 changes: 7 additions & 3 deletions x-pack/plugins/security/server/lib/audit_logger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ describe(`#savedObjectsAuthorizationFailure`, () => {
const action = 'foo-action';
const types = [ 'foo-type-1', 'foo-type-2' ];
const missing = [`action:saved-objects/${types[0]}/foo-action`, `action:saved-objects/${types[1]}/foo-action`];
const args = {
'foo': 'bar',
'baz': 'quz',
};

securityAuditLogger.savedObjectsAuthorizationFailure(username, action, types, missing);
securityAuditLogger.savedObjectsAuthorizationFailure(username, action, types, missing, args);

expect(auditLogger.log).toHaveBeenCalledWith(
'saved_objects_authorization_failure',
Expand All @@ -60,6 +64,7 @@ describe(`#savedObjectsAuthorizationFailure`, () => {
action,
types,
missing,
args,
}
);
});
Expand Down Expand Up @@ -89,8 +94,7 @@ describe(`#savedObjectsAuthorizationSuccess`, () => {
const types = [ 'foo-type-1', 'foo-type-2' ];
const args = {
'foo': 'bar',
'dude': 'yup',
'women': 'yay!',
'baz': 'quz',
};

securityAuditLogger.savedObjectsAuthorizationSuccess(username, action, types, args);
Expand Down

0 comments on commit f043655

Please sign in to comment.