Skip to content

Avoid authorizing incorrectly on HTTP 302 redirect#58

Open
jvgogh wants to merge 1 commit intogoogle:masterfrom
jvgogh:master
Open

Avoid authorizing incorrectly on HTTP 302 redirect#58
jvgogh wants to merge 1 commit intogoogle:masterfrom
jvgogh:master

Conversation

@jvgogh
Copy link

@jvgogh jvgogh commented Oct 2, 2025

The sample & common way of verifying a specific user is authenticated is to use curl to check if a certain http query completes correctly.

The -f or --fail flag passed to curl ensures zero vs non zero exit code based on http code.

Unfortunately there is a corner case where a http redirect (302 status code) is by default not followed by curl AND it returns a zero exit code, accidentally considering any badge swipe valid.

This is especially problematic as many cloud services, including AppEngine have set up an automatic redirect from http to https, making it so that a typo of http instead of https might accidentally make any badge swipe authenticate.

This change adds the -L flag to the sample .ini which will instruct curl to follow redirects instead of returning on http status code 302.

The sample & common way of verifying a specific user is authenticated
is to use curl to check if a certain http query completes correctly.

The -f or --fail flag passed to curl ensures zero vs non zero exit code
based on http code.

Unfortunately there is a corner case where a http redirect (302 status code)
is by default not followed by curl AND it returns a zero exit code,
accidentally considering any badge swipe valid.

This is especially problematic as many cloud services, including AppEngine
have set up an automatic redirect from http to https, making it so that
a typo of http instead of https might accidentally make any badge swipe
authenticate.

This change adds the -L flag to the sample .ini which will instruct curl
to follow redirects instead of returning on http status code 302.
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.

1 participant