Skip to content

fix(form): harden AirForm CSRF validation - #1163

Merged
audreyfeldroy merged 3 commits into
mainfrom
security/bind-airform-csrf
Aug 4, 2026
Merged

fix(form): harden AirForm CSRF validation#1163
audreyfeldroy merged 3 commits into
mainfrom
security/bind-airform-csrf

Conversation

@audreyfeldroy

Copy link
Copy Markdown
Member

Summary

  • require AirForm browser submissions to have an exact same-origin Origin header, with same-origin Referer fallback
  • reject missing, malformed, null, duplicate, and non-matching source origins before accepting a signed token
  • require configured AirForm signing secrets to contain at least 32 bytes and fail fast on empty or weak environment configuration
  • document reverse-proxy, process-global secret, and rotation behavior

Root cause and impact

AirForm tokens authenticated only a timestamp and nonce with a process-global key. A token obtained by one browser client could therefore be replayed from another origin in a victim client carrying ambient credentials. The request boundary now validates the browser-controlled source origin in addition to the token signature.

Verification

  • .venv/bin/pytest — 813 passed
  • .venv/bin/ruff format --check . — passed
  • .venv/bin/ruff check . — passed
  • .venv/bin/ty check . — passed
  • git diff --check — passed

Regression coverage includes cross-client token replay, exact origin and Referer matching, default and non-default ports, hostname-suffix tricks, null/missing/duplicate origins, userinfo, weak and empty secrets, secret rotation, and oversized/non-text tokens.

Validate browser source origins before accepting signed AirForm tokens and require 32-byte process-global secrets.

Co-authored-by: Audrey M. Roy Greenfeld <audrey@feldroy.com>
Signed-off-by: Audrey M. Roy Greenfeld <audrey@feldroy.com>
@audreyfeldroy
audreyfeldroy marked this pull request as ready for review August 4, 2026 05:08
@audreyfeldroy
audreyfeldroy merged commit 8644187 into main Aug 4, 2026
16 checks passed
@audreyfeldroy
audreyfeldroy deleted the security/bind-airform-csrf branch August 4, 2026 05:26
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