You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds a signed-token entry point for emergency firewall bypass, reusing the existing browser-secret mechanism and removing the legacy access-key bypass.
Changes:
Add JWT validation, replay tracking, and bypass activation.
Register authenticated and unauthenticated handlers and let bypass requests reach them.
Add tests for token validation, single-use behavior, and request recognition.
When the browser already sends a bypass cookie, Cookie::getVariable() prefers the original filter_input(INPUT_COOKIE, ...) value over the new secret written to $_COOKIE. This check compares the old secret with the newly stored hash, so a valid renewal redirects home and skips activation auditing even though a new cookie was issued. Verify the persisted hash against $user_secret directly instead of rereading the incoming cookie.
Preserve mapped IPv4 addresses during request-IP validation
When REMOTE_ADDR is ::ffff:203.0.113.10, IP::get() removes the mapped prefix through the shared normalizeIPv6() helper, so this comparison rejects a valid token claiming either the plain or mapped IPv4 address. Preserve the mapped prefix through request-IP selection before canonicalizing it. Add a mapped-request/plain-token regression case; the existing test covers only the opposite direction.
When the request includes an old spbc_fw_bypass cookie, Cookie::getVariable() still reads that incoming value through filter_input() after setUserToken() updates $_COOKIE. A successful JWT redemption therefore redirects home and skips the activation audit log despite issuing a new bypass cookie. Verify the persisted hash against $user_secret directly instead of rereading the incoming cookie.
Preserve IPv4-mapped addresses during request IP normalization
For a request address of ::ffff:203.0.113.10, IP::get() calls the shared normalizeIPv6(), which removes the mapped-address marker and returns 0:0:0:0:0:0:cb00:710a. The new comparison therefore rejects valid tokens containing either 203.0.113.10 or ::ffff:203.0.113.10. Preserve the mapped address through IP detection before canonicalizing it, and add a regression case with a mapped request address, not just a mapped token.
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
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.
task https://app.doboard.com/1/task/58708