Skip to content

PPT-2536: hostile and malformed input never 5xx or leak - #12

Merged
camreeves merged 1 commit into
masterfrom
PPT-2536-hostile-input
Jul 29, 2026
Merged

PPT-2536: hostile and malformed input never 5xx or leak#12
camreeves merged 1 commit into
masterfrom
PPT-2536-hostile-input

Conversation

@camreeves

Copy link
Copy Markdown
Contributor

PPT-2536 test-matrix SEC-01. Second slice of the test-suite campaign.

Why

/auth/* is internet-facing and continuously scanned. The dev nginx logs show a steady trickle of probes against /auth/authority.php, .env, .bak and friends — these ride on a real route prefix, so not_found_spec.cr's unmatched-path cases never covered them.

The bar is deliberately low and absolute: never a 5xx, never a backtrace, never a credential. A 5xx on a scanner probe is both an availability signal and an information leak.

This has to hold in development mode too: auth.cr only suppresses backtraces when SG_ENV=production, and per tasks/PPT-2536/config-parity nothing in the delivered config actually sets SG_ENV.

Coverage

  • scanner suffixes observed live (.php .env .bak .json .old .txt .zip .config .aspx ~ %00 .git/config .aws/credentials)
  • path traversal, double-encoded traversal, CRLF header injection
  • malformed token bodies: empty, missing params, unknown grant, junk JWT, JWT-shaped junk, 8KB oversized, array params
  • wrong content-type on the token endpoint
  • junk authorize query strings, including javascript: redirect_uri
  • garbage bearer tokens on /auth/token/info and /auth/userinfo
  • the open-redirect guard — a hostile redirect_uri must never come back as a Location

Result

158 examples, 0 failures. Every case already passes — this pins existing good behaviour against regression rather than fixing a defect.

🤖 Generated with Claude Code

PPT-2536 test-matrix SEC-01. /auth/* is internet-facing and continuously
scanned — the dev nginx logs show a steady trickle of probes against
/auth/authority.php, .env, .bak and friends. Those ride on a REAL route
prefix, so not_found_spec.cr's unmatched-path cases don't cover them.

Asserts an absolute floor across scanner suffixes, path traversal and
encoding tricks, malformed token bodies (empty, unknown grant, junk JWT,
oversized, array params), a wrong content-type, junk authorize queries,
and garbage bearer tokens: never a 5xx, never a backtrace, never a
credential in the body.

Also pins the open-redirect guard — a hostile redirect_uri must never come
back as a Location.

Backtraces are only suppressed when SG_ENV=production, which the delivered
config does NOT set (tasks/PPT-2536/config-parity), so these have to hold
in development mode too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@camreeves
camreeves merged commit d10ab01 into master Jul 29, 2026
7 checks passed
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