Skip to content

Conversation

jub0bs
Copy link
Contributor

@jub0bs jub0bs commented Feb 10, 2025

Closes #15406

Also, drop Origin from the Access-Control-Allow-Headers response header; see https://fetch.spec.whatwg.org/#forbidden-request-header.

@machine424
Copy link
Member

Thanks for this.
Some reading is required, I'll take a look when I have some time.

@machine424 machine424 self-assigned this Feb 12, 2025
@jub0bs
Copy link
Contributor Author

jub0bs commented Feb 12, 2025

@machine424 Great! Let me know if you need some clarification.

Related: rs/cors#10

A different issue is that CORS-preflight response headers like Access-Control-Allow-Headers are included in the response regardless of whether the request is actually a preflight request. The easiest fix for all this would arguably be to rely on a dependable CORS middleware library (e.g. this one 😉).

@github-actions github-actions bot added the stale label Apr 15, 2025
@bboreham
Copy link
Member

Hello from the bug-scrub! @machine424 do you think you will get a chance to look at this?

@jub0bs
Copy link
Contributor Author

jub0bs commented Apr 22, 2025

@machine424 I'm here if you need me.

Copy link
Member

@machine424 machine424 left a comment

Choose a reason for hiding this comment

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

lgtm, thanks.
Have some suggestions.

I see you're very interested in CORS and you did an excellent job with jub0bs/cors!

As you see our CORS setup is really simple (admittedly not flawless though ;)) and I’m personally hesitant to introduce a new dependency just for that.

If we ever need to make more substantial changes into that code in the future, I’d certainly keep jub0bs/cors in mind.

Of course, additional issues are uncovered in the meantime, we may decide to delegate that sooner.

Meanwhile my two cents, for better transparency/traceability in jub0bs/cors; it'd be great to use PRs rather than directly merging into main (even though you're the only contributor). Also linking those PRs in the changelog would help users better track the changes.

@machine424
Copy link
Member

the failing test was fixed on main, rebasing should help.

Closes #15406

Signed-off-by: jub0bs <jcretel-infosec+github@protonmail.com>
@jub0bs
Copy link
Contributor Author

jub0bs commented May 19, 2025

I see you're very interested in CORS and you did an excellent job with jub0bs/cors!

As you see our CORS setup is really simple (admittedly not flawless though ;)) and I’m personally hesitant to introduce a new dependency just for that.

If we ever need to make more substantial changes into that code in the future, I’d certainly keep jub0bs/cors in mind.

Of course, additional issues are uncovered in the meantime, we may decide to delegate that sooner.

Thanks. That's fair. One obstacle to your adoption of jub0bs/cors is that you seem to support arbitrary origin patterns; my library limits which patterns can be specified (for good reasons).

Meanwhile my two cents, for better transparency/traceability in jub0bs/cors; it'd be great to use PRs rather than directly merging into main (even though you're the only contributor). Also linking those PRs in the changelog would help users better track the changes.

Thanks, I'll take your suggestion into consideration. I'm getting closer to releasing a v1; I can start using PRs then. Whatever happens, I make sure to document, in the changelog, any changes that may affect users.

Copy link
Member

@machine424 machine424 left a comment

Choose a reason for hiding this comment

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

thanks again!

@machine424 machine424 merged commit dd9e18c into prometheus:main May 19, 2025
27 checks passed
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.

Inadequate CORS implementation opens the door to cache-poisoning issues
3 participants