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

fix: fix authHeader without cookie-parser middleware #1003

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

aloisklink
Copy link
Contributor

@aloisklink aloisklink commented Oct 28, 2024

express-openapi-validator v5.8.3 and 00d070b (fix: add cookie support for HTTP bearer authentication (#949), 2024-10-27) breaks HTTP bearer authentication when the cookie-parser middleware is not present (and therefore req.cookies is not present).

Fixes: 00d070b

Error message

Without this fix, you'll get errors like:

Cannot read properties of undefined (reading 'undefined')
      at HttpError.create (/app/node_modules/.pnpm/express-openapi-validator@5.3.8_express@5.0.1/node_modules/express-openapi-validator/dist/framework/types.js:42:24)
      at /app/node_modules/.pnpm/express-openapi-validator@5.3.8_express@5.0.1/node_modules/express-openapi-validator/dist/middlewares/openapi.security.js:57:37
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

[express-openapi-validator v5.8.3][1] and
00d070b (fix: add cookie support for HTTP bearer authentication (cdimascio#949), 2024-10-27)
breaks HTTP bearer authentication when the `cookie-parser` middleware
is not present (and therefore `req.cookies` is not present).

[1]: https://github.com/cdimascio/express-openapi-validator/releases/tag/v5.3.8
Fixes: 00d070b
Copy link
Owner

@cdimascio cdimascio left a comment

Choose a reason for hiding this comment

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

Thanks!

@cdimascio cdimascio merged commit 17e91d5 into cdimascio:master Oct 30, 2024
5 checks passed
@cdimascio
Copy link
Owner

cdimascio commented Oct 30, 2024

fixed published in 5.3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants