-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from GluuFederation/137_sanitize_inputs
fix(routes.js): remove received input from error output msg
- Loading branch information
Showing
6 changed files
with
75 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const chai = require('chai') | ||
const assert = chai.assert | ||
const got = require('got') | ||
const sinon = require('sinon') | ||
const webUtils = require('../server/utils/web-utils') | ||
const InitMock = require('./testdata/init-mock') | ||
const initMock = new InitMock() | ||
|
||
afterEach(() => { | ||
// Restore the default sandbox here | ||
sinon.restore() | ||
}) | ||
|
||
describe('Error message should not have inputs', () => { | ||
before(() => { | ||
initMock.errorHandlerEndpoint() | ||
}) | ||
// initMock.errorHandlerEndpoint() | ||
it('metadata request error should not have metaFileName', async () => { | ||
const unexistantIdp = 'idonotexist' | ||
const response = await got( | ||
`http://127.0.0.1:8090/passport/auth/meta/idp/${unexistantIdp}`, | ||
{ throwHttpErrors: false } | ||
) | ||
assert.notInclude(response.body, unexistantIdp) | ||
}) | ||
it('providers get routes should not throw error with provider name', async () => { | ||
const webUtilsSpy = sinon.spy(webUtils, 'handleError') | ||
const provider = 'idontexist' | ||
const token = 'whateveRt0k3n' | ||
await got( | ||
`http://127.0.0.1:8090/passport/auth/${provider}/${token}`, | ||
{ throwHttpErrors: false } | ||
) | ||
sinon.assert.calledOnce(webUtilsSpy) | ||
assert.notInclude(webUtilsSpy.getCall(0).lastArg, provider) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters