spring: Refuse to sync a plaintext password to Flask over a non-loopback, non-TLS URI (4/4 split of #168) - #172
Open
RudraBJoshi wants to merge 2 commits into
Conversation
FlaskPasswordSync calls Flask's internal sync endpoint (POST /api/internal/sync-password) with a shared secret (INTERNAL_SYNC_KEY), so a password reset completed on Spring also lands on the Flask account for the same uid. Not wired up to any caller yet -- that's the OAuth-verified reset flow, next PR in the stack. Best-effort: a sync failure is logged, not fatal to whatever already-successful operation triggered it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-TLS URI FlaskPasswordSync's request body carries the new password in plaintext, protected only by the shared-secret header, not encryption. The deployment topology (both nginx configs front the same public IP and proxy to localhost, and both READMEs describe deploying through the same cockpit) says this is same-host loopback traffic today, but no tracked config in either repo actually pins FLASK_URI to that. Adds a transport check before the call: allow loopback (localhost or 127.0.0.1, any scheme) or any https URI, otherwise skip the sync and log why. The host is parsed with java.net.URI rather than string-prefix matching, so a lookalike like http://localhost.attacker.com can't slip past. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Splitting #168 into smaller, independently-reviewable PRs across spring/flask/pages. This one covers security for transfers of data between the two dbs.
Depends on #169 (merge that first) — this branch includes #169's
FlaskPasswordSynccommit since GitHub can't base a PR on a branch that only exists in this fork. Once #169 merges, this diff will shrink to just this PR's own 22-line change.FlaskPasswordSync's request body carries the new password in plaintext, protected only by the shared-secret header, not encryption. The deployment topology says this is same-host loopback traffic today, but no tracked config actually pinsFLASK_URIto that. Adds a transport check before the call: allow loopback (any scheme) or any https URI, otherwise skip the sync and log why — parsed withjava.net.URIrather than string-prefix matching, so a lookalike likehttp://localhost.attacker.comcan't slip past.Original PR: #168