GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fixed handling of origin when allow_credentials enabled by TiARETiK · Pull Request #985 · CrowCpp/Crow

Conversation

@TiARETiK

@TiARETiK TiARETiK commented Jan 16, 2025 •
edited by gittiver
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There are two things to start with:

  • OPTIONS requests are not expected to have Origin header.
  • OPTIONS responses are not expected to have an Access-Control-Allow-Credentials headers.
  • No response may have both Access-Control-Allow-Credentials=true and Access-Control-Allow-Origin=*. (source)

Currently, the master branch's response to OPTIONS request contains an Access-Control-Allow-Origin= , which is interpreted incorrectly by most browsers. We can't fix it by simply checking for the presence of an Origin header in the request, due to the possibility of sending out both Access-Control-Allow-Credentials=true and Access-Control-Allow-Origin=*. The simple yet correct way to fix that behavior is to specifically check that the request being answered is not an OPTIONS one. Such a check is implemented in this pull request. There is also a test added that checks for incorrect Origins-Credentials behavior.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@TiARETiK
TiARETiK marked this pull request as draft January 16, 2025 10:33
@TiARETiK
TiARETiK force-pushed the origin-handling-fix branch 4 times, most recently from 7d12d5e to f333d40 Compare January 16, 2025 14:01
@TiARETiK Dmitriy Zaytsev
"Allow-Origin" behavior in OPTIONS requests fixed
aa79927
@TiARETiK
TiARETiK force-pushed the origin-handling-fix branch from f333d40 to aa79927 Compare January 16, 2025 14:47
@TiARETiK
TiARETiK marked this pull request as ready for review January 16, 2025 14:50
@TiARETiK Dmitriy Zaytsev
HTTPMethod::Options changed to HTTPMethod::Options
aca74a6
gittiver
gittiver reviewed Jan 24, 2025
View reviewed changes
Comment thread include/crow/middlewares/cors.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Dmitriy Zaytsev
Made Origin header choosing logic more clear
9d00070
@TiARETiK

TiARETiK commented Feb 6, 2025

Copy link
Copy Markdown
Contributor Author

@gittiver is the current state of the pull request acceptable, or shall I do something more for it to be accepted?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gittiver
gittiver approved these changes Feb 7, 2025
View reviewed changes
@gittiver

gittiver commented Feb 7, 2025

Copy link
Copy Markdown
Member

I simply overlooked the review, sorry.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gittiver
gittiver merged commit 62d883b into CrowCpp:master Feb 7, 2025
@BrewTestBot BrewTestBot mentioned this pull request Feb 21, 2025
crow 1.2.1.2 Homebrew/homebrew-core#208536
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gittiver gittiver gittiver approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@TiARETiK @gittiver
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.