Repository navigation
Conversation
…library basic-auth/ contains the PHP guard (basic-auth.php), generic Apache and nginx samples and a README, so it can be copied into other apps. The todo app now uses it, and thereby also rejects plain HTTP requests in PHP ($require_https = false switches that off for local development and tests). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ERh53iPbYAoCQPkBXezdGQ
Main stopped believing X-Forwarded-Proto by default and throttles the log of rejected requests; the library now does the same (trust_forwarded_proto defaults to false, rejections are logged at most once per minute) and the application passes $trust_forwarded_proto to it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ERh53iPbYAoCQPkBXezdGQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
basic-auth/directory, self-contained and copyable into other apps:basic-auth.php:basicAuthRequire()stops requests (403) that did not arrive over HTTPS or that the web server did not authenticate (REMOTE_USER). Returns the user name. Options for disabling either check, trustingX-Forwarded-Proto(off by default), HSTS, log prefix and client messages. Rejections are logged at most once per minute. AlsobasicAuthIsHttps()/basicAuthUser().htaccess.sample,nginx.conf.sample: generic web server parts (Basic auth + HTTPS only), consistent with the app's own samples.README.md: install steps and options.todo-core.php(passing$trust_forwarded_proto);session.phpusesbasicAuthIsHttps()for the cookiesecureflag.$require_https = falseinconfig.phpswitches this off for local development/tests; CI config and docs are updated. NewHTTPS_REQUIREDstrings (en/de)..htaccess/ nginx sample / Apache access test deny the new library files.main(incl. Security hardening: tag injection, auth ordering, session and header fixes #15: forwarded header no longer trusted by default, throttled logging) and aligned the library with it.Testing
node --test tests/basic-auth.test.js tests/auth.test.js: 17/17 pass locally.🤖 Generated with Claude Code
https://claude.ai/code/session_01ERh53iPbYAoCQPkBXezdGQ