Skip to content

Commit

Permalink
Revert log change to avoid a conflict (#4931)
Browse files Browse the repository at this point in the history
* Update passport.js

* update tests
  • Loading branch information
simon-id authored and bengl committed Nov 25, 2024
1 parent 1687b5c commit 778e0f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/dd-trace/src/appsec/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function passportTrackEvent (credentials, passportUser, rootSpan, mode) {
const user = parseUser(getLogin(credentials), passportUser, mode)

if (user['usr.id'] === undefined) {
log.warn('[ASM] No user ID found in authentication instrumentation')
log.warn('No user ID found in authentication instrumentation')
return
}

Expand Down
6 changes: 3 additions & 3 deletions packages/dd-trace/test/appsec/passport.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ describe('Passport', () => {
it('should call log when credentials is undefined', () => {
passportModule.passportTrackEvent(undefined, undefined, undefined, 'safe')

expect(log.warn).to.have.been.calledOnceWithExactly('[ASM] No user ID found in authentication instrumentation')
expect(log.warn).to.have.been.calledOnceWithExactly('No user ID found in authentication instrumentation')
})

it('should call log when type is not known', () => {
const credentials = { type: 'unknown', username: 'test' }

passportModule.passportTrackEvent(credentials, undefined, undefined, 'safe')

expect(log.warn).to.have.been.calledOnceWithExactly('[ASM] No user ID found in authentication instrumentation')
expect(log.warn).to.have.been.calledOnceWithExactly('No user ID found in authentication instrumentation')
})

it('should call log when type is known but username not present', () => {
const credentials = { type: 'http' }

passportModule.passportTrackEvent(credentials, undefined, undefined, 'safe')

expect(log.warn).to.have.been.calledOnceWithExactly('[ASM] No user ID found in authentication instrumentation')
expect(log.warn).to.have.been.calledOnceWithExactly('No user ID found in authentication instrumentation')
})

it('should report login failure when passportUser is not present', () => {
Expand Down

0 comments on commit 778e0f3

Please sign in to comment.