Skip to content

feat: add header-first local token controls - #3

Merged
SahirVhora merged 1 commit into
mainfrom
feat/header-token-controls
Jul 26, 2026
Merged

feat: add header-first local token controls#3
SahirVhora merged 1 commit into
mainfrom
feat/header-token-controls

Conversation

@SahirVhora

Copy link
Copy Markdown
Owner

Summary

  • add reusable header-first local token validation with a documented legacy-query migration window
  • keep optional Flask helpers lazily importable without breaking non-Flask consumers
  • add regression coverage and cross-repository migration decisions

Validation

  • 233 tests passed
  • targeted mypy passed
  • pre-commit passed
  • wildcard import with Flask blocked passed
  • three-pass independent review: PASS

@SahirVhora
SahirVhora merged commit 91a4a1c into main Jul 26, 2026
2 checks passed
@SahirVhora
SahirVhora deleted the feat/header-token-controls branch July 26, 2026 11:51

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11952452d2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

),
403,
)
return view(*args, **kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Route async views through Flask's ensure_sync

When a protected Flask route is declared with async def, Flask sees this synchronous wrapper and therefore does not apply its async adapter to the wrapped view. The direct call returns a coroutine as the response value, causing the otherwise supported async route to fail at runtime instead of executing; invoke the view through current_app.ensure_sync(view) so the decorator preserves Flask's async-view behavior.

Useful? React with 👍 / 👎.

Comment on lines 184 to 186
response.headers["Access-Control-Allow-Headers"] = (
"Content-Type, Authorization, X-CSRF-Token"
"Content-Type, Authorization, X-CSRF-Token, X-Report-Token, X-Auth-Token"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Expose custom token headers in CORS preflights

When require_local_token is configured with a header other than the two built-ins, an allowed-origin browser client cannot call the route because this preflight response never includes that custom header in Access-Control-Allow-Headers; the browser blocks the request before the decorator can validate it. Since header_name is a public configurable argument, the app's CORS configuration also needs a way to permit configured token-header names.

Useful? React with 👍 / 👎.

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