Skip to content

Escape OAuthError messages in examples/oauth.py - #1970

Closed
jar-stripe wants to merge 3 commits into
masterfrom
jar/fix-oauth-example-xss
Closed

jar-stripe wants to merge 3 commits into
masterfrom
jar/fix-oauth-example-xss

Conversation

@jar-stripe

@jar-stripe jar-stripe commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Why?

Both the /oauth/callback and /deauthorize routes in examples/oauth.py return the raw OAuthError message as an unescaped Flask response. Not a live issue — examples/ isn't part of the published package (flit only ships the stripe module) — just inconsistent escaping in sample code.

What?

  • escapes the OAuthError message with markupsafe.escape() in both except blocks

Configuration

  • skip-changefile: This PR is not a user-facing change, so there's no changefile.

jar-stripe and others added 2 commits November 6, 2026 20:50
Flask returns a plain string from a view function as text/html with no
escaping, so the OAuthError message echoed back in both the
/oauth/callback and /deauthorize routes was reflected into the response
unescaped. Escape it with markupsafe.escape() before including it in
the response body.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Committed-By-Agent: claude
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Committed-By-Agent: claude
@jar-stripe
jar-stripe marked this pull request as ready for review November 7, 2026 04:53
@jar-stripe
jar-stripe requested a review from a team as a code owner November 7, 2026 04:53
@jar-stripe
jar-stripe requested review from mark-kogan-stripe and removed request for a team November 7, 2026 04:53
@jar-stripe
jar-stripe enabled auto-merge (squash) November 7, 2026 05:46
examples/ is excluded from the published package (flit only ships the
stripe module), so this has no user-facing distribution impact.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Committed-By-Agent: claude
@jar-stripe

jar-stripe commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Closing — examples/ isn't part of the published package, and this has been addressed in a previous PR.

@jar-stripe jar-stripe closed this Nov 7, 2026
auto-merge was automatically disabled November 7, 2026 05:57

Pull request was closed

@jar-stripe
jar-stripe deleted the jar/fix-oauth-example-xss branch November 7, 2026 05:59
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