Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow "none" in any case #131

Merged
merged 4 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/node:10-browsers
- image: circleci/node:12-browsers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was having issue with the node 10 circle ci image and node 12 is the current active lts version

environment:
LANG: en_US.UTF-8
steps:
Expand Down
6 changes: 5 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ const paramsSchema = Joi.object({
idpLogout: Joi.boolean()
.optional()
.default((parent) => parent.auth0Logout || false),
idTokenSigningAlg: Joi.string().not('none').optional().default('RS256'),
idTokenSigningAlg: Joi.string()
.insensitive()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding .insensitive() to make the validation case insensitive

.not('none')
.optional()
.default('RS256'),
issuerBaseURL: Joi.string().uri().required(),
legacySameSiteCookie: Joi.boolean().optional().default(true),
authRequired: Joi.boolean().optional().default(true),
Expand Down
18 changes: 9 additions & 9 deletions test/config.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,15 +371,15 @@ describe('get config', () => {
});

it('should not allow "none" for idTokenSigningAlg', () => {
const config = {
...defaultConfig,
idTokenSigningAlg: 'none',
};
assert.throws(
() => getConfig(config),
TypeError,
'"idTokenSigningAlg" contains an invalid value'
);
let config = (idTokenSigningAlg) =>
getConfig({
...defaultConfig,
idTokenSigningAlg,
});
let expected = '"idTokenSigningAlg" contains an invalid value';
assert.throws(() => config('none'), TypeError, expected);
assert.throws(() => config('NONE'), TypeError, expected);
assert.throws(() => config('noNE'), TypeError, expected);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding 2 new cases for NONE and noNE

});

it('should require clientSecret for ID tokens with HMAC based algorithms', () => {
Expand Down