Skip to content

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
Open-Coding-Society:masterfrom
dhyantsoni:split/spring/s4-harden-sync-transport
Open

spring: Refuse to sync a plaintext password to Flask over a non-loopback, non-TLS URI (4/4 split of #168)#172
RudraBJoshi wants to merge 2 commits into
Open-Coding-Society:masterfrom
dhyantsoni:split/spring/s4-harden-sync-transport

Conversation

@RudraBJoshi

Copy link
Copy Markdown

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 FlaskPasswordSync commit 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 pins FLASK_URI to that. Adds a transport check before the call: allow loopback (any scheme) or any https URI, otherwise skip the sync and log why — parsed with java.net.URI rather than string-prefix matching, so a lookalike like http://localhost.attacker.com can't slip past.

Original PR: #168

RudraBJoshi and others added 2 commits August 24, 2026 11:12
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>
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