Commit graph

6 commits

Author SHA1 Message Date
Kevin Turcios
e2940da25f fix: add @swc/helpers as direct dependency for Azure deployment
pnpm doesn't hoist @swc/helpers to cf-webapp/node_modules/ by default,
so it's missing from the deploy zip. Azure runs npm start which can't
resolve it through pnpm's virtual store. Adding it as a direct dep
ensures it's included in the zip.
2026-04-15 06:47:06 -05:00
Kevin Turcios
e5374c3f50
fix: provide JWT_SECRET to CI build workflows (#2607)
## Summary
- Reverts lazy JWT_SECRET initialization — keeps eager fail-fast at
module load
- Adds `JWT_SECRET` secret to both `deploy_cfwebapp_to_azure.yml` and
`nextjs-build.yaml` CI workflows so `next build` page data collection
succeeds for the `/codeflash/auth/oauth/token` route

## Context
The deploy workflow ([run
#24425211765](https://github.com/codeflash-ai/codeflash-internal/actions/runs/24425211765/job/71357530269))
was failing because `JWT_SECRET` isn't available during CI build,
causing an eager throw at module load time. The secret already exists as
a GitHub repo secret.
2026-04-14 19:25:41 -05:00
Kevin Turcios
91b692c1a0 fix: harden cf-webapp security across auth, XSS, and headers
- Add auth0.getSession() to unauthenticated observability endpoints
  (llm-call-debug, llm-export, observability chat)
- Remove hardcoded JWT_SECRET fallback; require env var
- Sanitize markdown HTML with DOMPurify before innerHTML assignment
- Escape user data in Intercom boot snippet via JSON.stringify
- Add security headers (CSP, HSTS, X-Frame-Options, X-Content-Type-Options,
  Referrer-Policy, Permissions-Policy) via next.config.mjs
- Move OAuth params from sessionStorage to signed HttpOnly cookie
- Add input validation: clamp page/pageSize bounds, allowlist sort fields
- Stop leaking error.message to clients in API responses
- Remove ~40 console.log/error statements that logged user IDs, org IDs,
  PKCE params, and OAuth flow details
- Delete unused api-client.ts (NEXT_PUBLIC_CF_API_KEY never imported)
2026-04-13 19:25:19 -05:00
Kevin Turcios
c1b0076cb8 fix: align TypeScript versions to deduplicate @prisma/client in pnpm
Root cause: cf-webapp used typescript@~5.4.5 while common used
typescript@^5.9.3. Since @prisma/client has typescript as a peer
dep, pnpm created two separate instances. prisma generate wrote to
one, but Next.js resolved the other — causing "Cannot find module
'.prisma/client/default'" at build time.

Fix: upgrade cf-webapp to typescript@^5.9.3 to match common. This
deduplicates @prisma/client to a single pnpm instance.

Also fixes cf-api deploy: exclude node_modules from copyfiles glob
and use cp -rL to dereference pnpm symlinks.
2026-04-13 12:10:16 -05:00
Kevin Turcios
48b5e2b46d
fix: make tree-sitter WASM build failure non-fatal when cache exists (#2602)
## Summary
- If the WASM build fails (e.g. GitHub CDN outage for tree-sitter-cli or
wasi-sdk) but a cached `.wasm` file already exists, warn instead of
crashing `pnpm install`
- Only hard-fail when no cached WASM exists at all

This prevents transient CDN outages from blocking deploys when the WASM
artifacts are already cached.

## Test plan
- [ ] CI passes on this PR (validates the postinstall script doesn't
crash)
- [ ] Verify deploy workflow can proceed when WASM cache hits
2026-04-13 11:43:07 -05:00
Kevin Turcios
d7a8b8f227
perf: fix CI build + lazy-load heavy libs + parallelize DB queries (#2601)
## Summary
- **Fix CI build failure**: Auth0Client crashes during Next.js
prerendering when env vars aren't set. Returns a no-op stub (`getSession
→ null`) when domain is missing — semantically correct for static
generation
- **Lazy-load markdown libs (~260kb)**: ReactMarkdown, remarkGfm, and
react-syntax-highlighter were eagerly imported in monaco-diff-viewer but
only rendered when user expands "Generated Tests". Extracted into a
dynamic component
- **Parallelize repo detail query**: `getRepositoryById` ran the
activity count sequentially after the repo lookup. Since `repoId` is
already available, all three queries now run in parallel

## Test plan
- [ ] CI `build` check passes (was failing since #2598)
- [ ] Trace page still renders generated tests correctly when expanded
- [ ] Repository detail page loads correctly with activity status
2026-04-13 11:03:05 -05:00