Skip to content

fix: security patches and bug fixes for trilhas feature#80

Draft
caimanoliveira wants to merge 1 commit into
mainfrom
claude/kind-keller-b12ve7
Draft

fix: security patches and bug fixes for trilhas feature#80
caimanoliveira wants to merge 1 commit into
mainfrom
claude/kind-keller-b12ve7

Conversation

@caimanoliveira

Copy link
Copy Markdown
Owner

Summary

Security

  • Next.js 16.2.0 → 16.2.10: patches 14 CVEs including Middleware/Proxy bypass (authentication bypass risk), cache poisoning, XSS in beforeInteractive scripts, SSRF via WebSocket upgrades, and multiple DoS vectors
  • ws: upgraded transitive dependency to patched version via npm audit fix
  • /api/exportar-star: added explicit mentorado ownership check (join through mentorados.user_id) before querying etapa_respostas, mirroring the pattern already used in /api/exportar-pdf

Bug Fixes

  • getEtapa crash on unknown slug (content.ts): added if (!trilha) return null guard before accessing .etapas, preventing a TypeError when callers pass an arbitrary string cast as TrilhaSlug
  • getTrilha unsafe calls (actions.ts): replaced both getTrilha(trilhaSlug as TrilhaSlug) calls in completeEtapa and submitPlanoAcao with getTrilhaSafe, guarding the allDone check against null
  • Supabase write errors silently swallowed (actions.ts): all upsert/update calls (startTrilhaIfNeeded, saveResposta, completeEtapa, submitPlanoAcao) now destructure and throw on error, preventing silent data-loss scenarios where revalidatePath was called after a failed write
  • planoAcao array length mismatch (schemas.ts + actions.ts): changed .length(3) to .min(1).max(5) in both planoAcaoRespostaSchema and submitPlanoAcaoInput to match the n_acoes: z.number().int().min(1).max(5) range in planoAcaoConfigSchema — previously any trilha configured with n_acoes ≠ 3 would produce a Zod validation error on submit

Remaining known risk

  • postcss < 8.5.10 (moderate, GHSA-qx2v-qp2m-jg93) lives inside Next.js's own bundled copy; the only available fix would downgrade Next.js to v9.3.3, which is not viable. Accepted as a transitive risk until Next.js ships an internal update.

Generated by Claude Code

- Upgrade Next.js 16.2.0 → 16.2.10 (patches 14 CVEs: middleware bypass,
  cache poisoning, XSS, DoS with Server/Cache Components, SSRF)
- Fix ws dependency: upgrade to patched version via npm audit fix
- fix(exportar-star): add explicit mentorado ownership check before
  querying etapa_respostas (mirrors pattern in exportar-pdf)
- fix(trilhas/content): guard getEtapa against undefined trilha to prevent
  TypeError crash on invalid slug input
- fix(trilhas/actions): replace getTrilha (unsafe cast) with getTrilhaSafe
  in completeEtapa and submitPlanoAcao; guard allDone check on null trilha
- fix(trilhas/actions): check and throw on Supabase write errors in
  startTrilhaIfNeeded, saveResposta, completeEtapa, and submitPlanoAcao
- fix(trilhas/schemas + actions): relax planoAcao array from .length(3) to
  .min(1).max(5) to match planoAcaoConfigSchema n_acoes range
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mentoria-crm Error Error Jul 10, 2026 7:17am
splinter Ready Ready Preview, Comment Jul 10, 2026 7:17am
splinter-yhcm Ready Ready Preview, Comment Jul 10, 2026 7:17am

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.

2 participants