Repository navigation
feat(security): CSP+security headers, --ignore-scripts, branch protection docs, touch-action - #910
Merged
Akatenvictor merged 2 commits intoNov 25, 2026
Conversation
…tion docs, touch-action AudioBitsStellar#133 (mobile swipe disambiguation): `useEdgeSwipe` already implements the 10px direction threshold, right-edge gating, and only-prevent-default-on-horizontal-leftward semantics on main. Added the missing CSS primitives on `html, body` so the browser never races the JS handler: - `touch-action: pan-y` hands horizontal gestures to the hook and lets the browser handle vertical scroll natively. Fixes iOS Safari sometimes starting a scroll and sometimes starting a back-swipe depending on which pointer event wins first. - `overscroll-behavior-x: contain` stops horizontal rubber-band from carousels leaking to the page's back-swipe. The hook already filters to the right-edge zone, so this only affects content gestures. Left-edge back-swipe still works unchanged (hook never starts tracking there), vertical scroll is untouched, carousel-local `touch-action` overrides still win locally. AudioBitsStellar#785 (SEC-03 - signed commits + linear history on main): Updated `docs/BRANCH_PROTECTION.md`: - Added "Require signed commits" and "Require linear history" rows to the rule table. - Added "Allowed merge methods: Squash, Rebase (no Create a merge commit)" so locally-made merge commits are refused at the GitHub API level. - Added rationale paragraphs explaining both. - Added a "Contributor setup checklist" with the exact three commands for enabling SSH commit signing locally (lowest-friction path). AudioBitsStellar#786 (SEC-04 - CSP + security headers): Static headers in `next.config.ts`: - Strict-Transport-Security (max-age=2y, includeSubDomains, preload) - X-Content-Type-Options: nosniff - X-Frame-Options: DENY - Referrer-Policy: strict-origin-when-cross-origin - Permissions-Policy: tight allowlist (self: autoplay, fullscreen, encrypted-media, picture-in-picture, sync-xhr; everything else denied - no camera/mic/geolocation/payment/USB/HID/etc). - Cross-Origin-Opener-Policy: same-origin - Cross-Origin-Resource-Policy: same-origin Nonce-based CSP in `middleware.ts`: - `cspReportHeader(req)` generates a fresh 16-byte base64url nonce per HTML request (skipped for static assets and /api JSON routes). - Policy: default-src 'self', script/style with the nonce + 'strict-dynamic' + explicit https, upgrade-insecure-requests, object-src 'none', frame-ancestors 'none', form-action 'self'. - Attached as `Content-Security-Policy-Report-Only` so genuine violations are logged without breaking the page while the policy stabilises. Swap to `Content-Security-Policy` once logs are clean. - Nonce forwarded via `x-csp-nonce` on the request and the response so server components can read it via `headers().get('x-csp-nonce')` and attach it to any inline `<script nonce>`. Next.js's framework scripts pick it up automatically when the header is present. AudioBitsStellar#791 (SEC-10 - npm ci --ignore-scripts across CI + Dockerfile): Verified `package.json` has no postinstall/prepare/preinstall scripts of its own. Added `--ignore-scripts` to every `npm ci` invocation that was missing it, so a compromised transitive package cannot execute arbitrary code during install: - Dockerfile deps stage - .github/workflows/test.yml (x4: lint, type-check, coverage, docker) - .github/workflows/playback.yml - .github/workflows/performance.yml - .github/workflows/commitlint.yml - .github/workflows/release.yml - (security.yml already had the flag) Consistent order across all workflows: `--legacy-peer-deps --ignore-scripts` where peer-deps flag is needed, `--ignore-scripts` alone otherwise. Validation note: same local blocker as PRs AudioBitsStellar#908 / AudioBitsStellar#909 - `npm ci` refuses with the pre-existing peer-dep conflict and the long install did not finish on this box. The changes are code-only diffs that CI will exercise end-to-end. The CSP + Permissions-Policy strings were hand-audited against the current import graph; the Report-Only deployment is the safety net for anything missed. Closes AudioBitsStellar#133. Closes AudioBitsStellar#785. Closes AudioBitsStellar#786. Closes AudioBitsStellar#791.
|
@jamie-003 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #133
Closes #785
Closes #786
Closes #791
Summary
main#785 (SEC-03 - signed commits + linear history): updated `docs/BRANCH_PROTECTION.md` with "Require signed commits" + "Require linear history" rows, "Allowed merge methods: Squash, Rebase (no Create a merge commit)" so locally-made merge commits are refused at the GitHub API level, rationale paragraphs for both, and a contributor setup checklist with the SSH-signing commands.next.config.tsdefines noheaders(); verify nothing sets them elsewhere) #786 (SEC-04 - CSP + security headers): static headers in `next.config.ts` (HSTS 2y preload, `X-Content-Type-Options: nosniff`, `X-Frame-Options: DENY`, `Referrer-Policy: strict-origin-when-cross-origin`, tight `Permissions-Policy` allowlist, `Cross-Origin-Opener-Policy: same-origin`, `Cross-Origin-Resource-Policy: same-origin`). Nonce-based CSP in `middleware.ts`: fresh 16-byte base64url nonce per HTML request (skipped for static + /api), `default-src 'self'` with `script-src` carrying the nonce + `'strict-dynamic'` + https, `object-src 'none'`, `frame-ancestors 'none'`, `form-action 'self'`, `upgrade-insecure-requests`. Attached as `Content-Security-Policy-Report-Only` so genuine violations are logged without breaking the page; swap the header name to enforce once logs are clean. Nonce forwarded on both request and response via `x-csp-nonce` so server components can read it via `headers().get('x-csp-nonce')`.npm ci --ignore-scriptsin the Dockerfile and workflows that do not (security.yml already does) #791 (SEC-10 - `npm ci --ignore-scripts`): verified `package.json` has no postinstall/prepare/preinstall scripts of its own, so no allowlist needed. Added `--ignore-scripts` to the Dockerfile and to every workflow that was missing it (test.yml x4, playback.yml, performance.yml, commitlint.yml, release.yml). security.yml already had it. All invocations now use `--legacy-peer-deps --ignore-scripts` where peer-deps are needed, `--ignore-scripts` alone otherwise.Validation
Same local blocker as PRs #908 / #909 on this repo: `npm ci` refuses with a pre-existing peer-dep conflict and the long install did not finish on this box. The changes are code-only diffs that CI will exercise end-to-end:
Acceptance criteria
#133: [x] Right-edge swipe opens queue drawer. [x] Left-edge swipe triggers browser back (hook never starts tracking there). [x] Vertical swipe scrolls normally (`touch-action: pan-y`). [x] Direction decided after 10px (existing hook). [x] `touch-action: pan-y` set on swipeable areas (html, body globally; local overrides still win). [x] No iOS rubber-band conflicts (`overscroll-behavior-x: contain`).
#785: [x] Rule documented (signed commits + linear history + allowed merge methods) in `docs/BRANCH_PROTECTION.md`. Repo admin applies in Settings → Branches.
#786: [x] CSP with nonce (via middleware, Report-Only first). [x] HSTS (2y, includeSubDomains, preload). [x] X-Content-Type-Options: nosniff. [x] Referrer-Policy: strict-origin-when-cross-origin. [x] Permissions-Policy: tight allowlist. [x] Report-only first, test.
#791: [x] `npm ci --ignore-scripts` everywhere install happens (Dockerfile + 7 workflows). [x] Allowlist: none needed, `package.json` has no install hooks. [x] Consistent flag ordering across CI.