Draft
Security hardening: root middleware auth backstop, CORS for v1 API, npm CVE fixes#12
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: ejay-dev <230797402+ejay-dev@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix 23 security issues in GitHub audit
Security hardening: root middleware auth backstop, CORS for v1 API, npm CVE fixes
Mar 13, 2026
3 tasks
ejay-dev
added a commit
that referenced
this pull request
May 13, 2026
, #14) (#87) Three related findings from docs/audit/2026-05-13-marketing-audit.md: - #12 MED: 20 page titles over 60 chars (Google truncates ~60) - #13 MED: 13 meta descriptions over 170 chars (truncates ~155-160) - #14 MED: 10 meta descriptions under 100 chars (wasted SERP) Each rewrite mirrors the page's existing positioning - no new claims, no scope shift. Approach per category: - Long titles: collapse the brand suffix and the trailing qualifier ("Healthcare Compliance Platform - Clinical Governance & Accreditation | FormaOS" 78c -> "Healthcare Compliance Platform | FormaOS" 40c). - Long descriptions: drop redundant trailing fluff while keeping the vertical-list and value claim (homepage 219c -> 151c). - Short descriptions: expand from one-line summaries to ~130-150c using the page's actual content (trust/sla 89c -> 129c). Where a page also had openGraph/twitter description overrides, both were updated so social previews and SERP stay aligned. Verified post-rewrite: zero titles >60, zero descriptions >170, zero descriptions <100. tsc --noEmit clean. Co-authored-by: ejaz <ejaz@local> Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.
Addresses remaining open findings from the March 2026 codebase security audit. The three items below were the only findings not yet remediated.
H-2 — Root
middleware.ts(auth backstop)No centralized auth enforcement existed; every route had to self-protect. Added
middleware.tsat project root:/app/*,/admin/*,/onboarding/*,/workspace-recovery/*): redirects unauthenticated users to/auth/signin?next=<path>/api/*): returns401for unauthenticated requests; explicit allowlist covers public endpoints (health, auth, billing webhook, SSO, SCIM, trust-packet, cron, debug)@supabase/ssrcreateServerClient+getUser()on every request — prevents session spoofing via stale JWTsx-verified-ipheader: prefersx-real-ip/cf-connecting-ipover user-controlledx-forwarded-for, so downstream rate limiters can trust itOPTIONS /api/v1/*returning204directly in middlewareL-6 — CORS headers for
/api/v1/routesThe external REST API had no
Access-Control-*headers, blocking browser-based integrators. Added vianext.config.ts:Wildcard origin is intentional: per the CORS spec it prevents the browser from sending cookies, so integrators must authenticate via ****** (Supabase JWT). No CSRF exposure.
npm CVEs —
npm audit fixReduced vulnerability count from 20 → 17. Remaining 17 are all in dev-only testing tools (backstopjs, pa11y, pa11y-ci, puppeteer) that cannot be resolved without major-version breaking changes to the test toolchain; no production impact.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.