Audit-plan fixes: password/cron/AI-limit security, submission race, perf, CI, tests#116
Open
Vijayabaskar56 wants to merge 2 commits into
Open
Audit-plan fixes: password/cron/AI-limit security, submission race, perf, CI, tests#116Vijayabaskar56 wants to merge 2 commits into
Vijayabaskar56 wants to merge 2 commits into
Conversation
- Override the line tab variant border so dark mode uses the intended gray-200 rail instead of the brighter default soft border.
Implements the improve-audit plans (code only; plan/docs .md kept local): - security: constant-time + scrypt-hashed form passwords, hashed on every write path (saveFormSettings AND updateForm/draftSettings) - security: cron auth requires CRON_SECRET; x-vercel-cron no longer trusted alone - security: per-org short-window rate limit on AI form generation (+ client "slow down" toast wired in both theme and streaming paths) - bug: atomic ON CONFLICT upsert for submission finalize (kills double-submit race) - perf: single multi-row upsert for question-progress batch (was N serial) - tech-debt: app console.* routed through the structured logger (embed excluded) - tech-debt: strip stale customization keys at read boundary + scrub script - tests: password, cron, submissions, AI rate-limit, batch analytics, number-format, scale, customization - ci: run tsc --noEmit and the vitest suite on every PR - deps: pin nitro (was "latest"); bump better-auth/vite/vitest/esbuild CVEs Also bundles in-progress local dashboard/settings WIP that shares files with the above (could not be cleanly separated). Co-authored-by: improve-skill workflow <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Implements the
/improve deepaudit plans (10 of 12) plus the fixes from a multi-agent high-effort code review. Code only — all plan/doc.mdfiles are intentionally kept local and excluded from this PR.What's included
Security
saveFormSettingsand theupdateForm/draftSettingsflush the settings UI actually uses (a HIGH-severity plaintext-at-rest gap the review caught and this PR fixes).CRON_SECRETbearer token is now authoritative;x-vercel-cronis honored only as a fallback on Vercel when no secret is set (closes the header-only bypass).quota/ai-rate-limitedcode and a "slow down" client toast wired into both the theme and streaming paths.Correctness / perf
ON CONFLICT DO UPDATEon(formId, draftId)— kills the double-submit 500 race; the no-downgrade (completed→incomplete) guard is preserved.Tech-debt / DX
console.*routed through the structured logger (embed IIFE scripts + the evlog drain intentionally excluded).coverFit) stripped at the read boundary + an idempotent scrub script.tsc --noEmitand the Vitest suite on every PR (previously neither ran in CI).nitropinned (was"latest");better-auth/vite/vitest/esbuildbumped to clear the critical + 2 high advisories.Tests added: password-hash, cron-auth, submissions upsert, AI rate-limit, batch analytics, number-format, scale values, customization migrate.
Verification
pnpm exec tsc --noEmit→ clean (exit 0).These need additive DDL applied via
DIRECT_URL(NOTdb:push/db:migrate— tracking is drifted):And to scrub stale customization (optional, idempotent —
scripts/scrub-stale-customization.ts):Also: the new CI
testjob needsDATABASE_URL+DIRECT_URLconfigured as GitHub Actions secrets.Not in this PR (by design)
pnpm-workspace.yaml(out of the plan's scope); some patches are inside the 7-day quarantine window.onChangewrites values wholesale, so blanking the field would risk wiping the password in active WIP — left as a deliberate follow-up..mddocs (README/CONTRIBUTING corrections + theplans/directory).Note on scope
The working tree had in-progress local WIP (dashboard/settings refactor) entangled in shared files with the fixes; it could not be cleanly separated (e.g.
dashboard.tsxdepends on new untracked components), so it rides along in this branch.