fix: production hardening audit — Phase 2 (steps 2.1–2.4)#7
Draft
brucelikeeat wants to merge 2 commits into
Draft
fix: production hardening audit — Phase 2 (steps 2.1–2.4)#7brucelikeeat wants to merge 2 commits into
brucelikeeat wants to merge 2 commits into
Conversation
- Change datasource provider to 'postgresql' with directUrl support - Add @db.Text to Account.refresh_token, access_token, id_token - Update .env.example with PostgreSQL URL format and DIRECT_URL entry - Create docs/launch-log.md with Phase 1 status and agent log Co-authored-by: brucelikeeat <brucelikeeat@users.noreply.github.com>
- Guard [ENV CHECK] debug log in [...nextauth]/route.ts behind NODE_ENV !== 'production' - Guard [NextAuth signIn] event log in lib/auth.ts behind NODE_ENV !== 'production' (prevents OAuth access_token/refresh_token from reaching production logs) - Replace detail: String(error) in generate route catch block with NODE_ENV-conditional (dev: raw error string, prod: safe message) - Update docs/launch-log.md with full Phase 2 audit results (A-G) and fix log Co-authored-by: brucelikeeat <brucelikeeat@users.noreply.github.com>
cursor Bot
pushed a commit
that referenced
this pull request
May 29, 2026
Co-authored-by: brucelikeeat <brucelikeeat@users.noreply.github.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.
Phase 2 — Production Hardening Audit
Full codebase audit across 7 categories (A–G), with targeted fixes applied to the 3 mandated areas.
Fixes applied
src/app/api/auth/[...nextauth]/route.ts[ENV CHECK]debug log wrapped inNODE_ENV !== "production"guard — stops it firing duringnext buildand in productionsrc/lib/auth.ts[NextAuth signIn]event log wrapped inNODE_ENV !== "production"guard — prevents OAuthaccess_token,refresh_token,id_tokenfrom reaching production logssrc/app/api/posts/generate/route.tsdetail: String(error)in catch block replaced withNODE_ENV-conditional — dev sees the raw error string, production returns"See server logs for details."Audit summary
A — Hardcoded localhost URLs: None found anywhere in
src/.B — Sensitive console.log: 2 issues found and fixed (see table above). All other 12 console statements reviewed — no token, password, email, session, or user objects logged.
C — Missing error boundaries (report only): 6 route handlers have partial or missing try/catch coverage:
debug-session,disconnect,select-repo,github/status— no top-level catchrepos,repos/.../commits— auth/token section outside try/catchD — Exposed stack traces: 1 issue fixed (
generateroute). Additional security note:debug-sessionreturns full unauthenticated session dump — should be removed or guarded.E — Dead imports / unused files (report only): 9 dead files found (superseded code not yet cleaned up):
src/features/github/mapCommitsToTimeline.tssrc/features/timeline/data.tssrc/lib/github/index.ts(unused barrel) +oauth.tssrc/components/timeline/TimelineView.tsx+TimelineList.tsx+TimelineFilters.tsxsrc/components/ui/timeline.tsxsrc/features/timeline/useTimelineFilter.tsF — TypeScript
any: None found in any of the 5 critical files.G — Env var coverage: All 7
process.env.*vars used in code are present in.env.OPENAI_API_KEYandREDIS_URLare in.envbut not yet used in code.Build
npx next buildpasses cleanly. The[ENV CHECK]log no longer appears in build output.