Merge pull request #17831 from overleaf/msm-filter-saml-error-log

[web] Filter saml error logs by path

GitOrigin-RevId: 4ca9e156657afc893f38fed7ec6b00cbb7a608ef
This commit is contained in:
ilkin-overleaf
2024-05-27 16:09:23 +03:00
committed by Copybot
parent fe7de51827
commit abd57e03cf
2 changed files with 61 additions and 1 deletions
@@ -34,6 +34,7 @@ describe('SamlLogHandler', function () {
{
session: { saml: { universityId: providerId } },
sessionID: sessionId,
path: '/saml/ukamf',
},
data
)
@@ -62,6 +63,7 @@ describe('SamlLogHandler', function () {
{
session: { saml: { universityId: providerId } },
sessionID: sessionId,
path: '/saml/ukamf',
},
circularRef
)
@@ -91,6 +93,7 @@ describe('SamlLogHandler', function () {
{
session: { saml: { universityId: providerId } },
sessionID: sessionId,
path: '/saml/ukamf',
},
data
)
@@ -106,4 +109,54 @@ describe('SamlLogHandler', function () {
)
})
})
describe('with /saml/group-sso path', function () {
let err
beforeEach(async function () {
err = new Error()
samlLog.save = sinon.stub().rejects(err)
await SamlLogHandler.promises.log(
{
session: { saml: { universityId: providerId } },
sessionID: sessionId,
path: '/saml/group-sso',
},
data
)
})
it('should log error', function () {
this.logger.error.should.have.been.calledOnce.and.calledWithMatch(
{
err,
sessionId: sessionId.substr(0, 8),
},
'SamlLog Error'
)
})
})
describe('with a path not in the allow list', function () {
let err
beforeEach(async function () {
err = new Error()
samlLog.save = sinon.stub().rejects(err)
await SamlLogHandler.promises.log(
{
session: { saml: { universityId: providerId } },
sessionID: sessionId,
path: '/unsupported',
},
data
)
})
it('should not log any error', function () {
this.logger.error.should.not.have.been.called
})
})
})