Skip to content

Commit b1034c2

Browse files
refactor(endpoint-auth): coerce incoming parameters to strings
1 parent 7d66a10 commit b1034c2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/endpoint-auth/lib/controllers/authorization.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const authorizationController = {
3838
}
3939

4040
// `response_type` must be `code` (or deprecated `id`)
41-
if (!/^(code|id)$/.test(request.query.response_type)) {
41+
if (!/^(code|id)$/.test(String(request.query.response_type))) {
4242
throw IndiekitError.badRequest(
4343
response.locals.__("BadRequestError.invalidValue", "response_type")
4444
);
@@ -54,7 +54,7 @@ export const authorizationController = {
5454

5555
// Canonicalise URLs for later comparison
5656
if (request.query[uri]) {
57-
request.query[uri] = getCanonicalUrl(request.query[uri]);
57+
request.query[uri] = getCanonicalUrl(String(request.query[uri]));
5858
}
5959
}
6060

@@ -70,7 +70,7 @@ export const authorizationController = {
7070
}
7171

7272
// Add client information to locals
73-
request.app.locals.client = await getClientInformation(client_id);
73+
request.app.locals.client = await getClientInformation(String(client_id));
7474

7575
// Use PKCE if code challenge parameters provided
7676
request.app.locals.usePkce = code_challenge && code_challenge_method;

packages/endpoint-auth/lib/pushed-authorization-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const createRequestUri = (request) => {
2828
*/
2929
export const getRequestUriData = (request) => {
3030
const { request_uri } = request.query;
31-
const reference = request_uri.split(":")[5];
31+
const reference = String(request_uri).split(":")[5];
3232

3333
return request.app.locals[reference];
3434
};

0 commit comments

Comments
 (0)