Harden Vercel serverless boundaries: remove secret leakage, enforce typecheck-on-build, and lock down data routes#3
Draft
Copilot wants to merge 4 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/alittler/Plothole/sessions/e695aa55-48f8-4733-8613-3078f28988c1 Co-authored-by: alittler <66809141+alittler@users.noreply.github.com>
This reverts commit 6e4b2c8. Co-authored-by: alittler <66809141+alittler@users.noreply.github.com>
Agent-Logs-Url: https://github.com/alittler/Plothole/sessions/e695aa55-48f8-4733-8613-3078f28988c1 Co-authored-by: alittler <66809141+alittler@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Harden Vercel configuration and improve safety
Harden Vercel serverless boundaries: remove secret leakage, enforce typecheck-on-build, and lock down data routes
May 18, 2026
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.
This PR tightens Next.js/Vercel safety without a full architecture rewrite: it removes client-exposed secret patterns, restores build/type failure visibility, and makes
/api/data/*behavior explicit for serverless constraints. It keeps static-first repo data reads while blocking unsafe assumptions about durable local writes.Next.js config hardening
typescript.ignoreBuildErrorsso build/type failures are no longer masked.next.config.tsenvexposure to safe public values only.OPENROUTER_API_KEY) and eliminated server→NEXT_PUBLIC_*fallback mapping.Script intent cleanup
typecheckscript:tsc --noEmit.lintdelegate totypecheck.Serverless-safe data route behavior
/api/data/readand/api/data/listwith strict input/path validation and traversal protection./api/data/treeto only enumerate expected data file types./api/data/writeto explicit501with guidance to use durable external storage (Blob/S3/DB), avoiding false durability semantics on local FS in serverless.Hardcoded secret/config fallback removal
scripts/analyze-manuscript.ts.BrowserRouterWrapperto be env-driven for Auth0 config, removing embedded fallback domain/client values and failing clearly when missing.Example of the new serverless write guard:
Original prompt
Make
alittler/Plotholesafer and more compatible with Vercel serverless deployment, with minimal product behavior changes.Goals:
Repository context discovered from the repo:
next.config.ts,vercel.json,app/, andpackage.jsonscripts usingnext build.next.config.tscurrently includestypescript.ignoreBuildErrors = trueand exposes env values includingOPENROUTER_API_KEYand aNEXT_PUBLIC_GEMINI_API_KEYfallback that can source from server-only env vars.app/api/data/tree/route.tsandapp/api/data/read/route.tscurrently read from the localdata/directory at runtime usingfs/promisesandprocess.cwd().src/services/decap-sync.tsperforms local filesystem reads/writes for Decap YAML.app/BrowserRouterWrapper.tsxcontains hardcoded fallback Auth0 values.scripts/analyze-manuscript.tscontains a hardcoded fallback OpenRouter API key.Requested implementation scope:
A. Harden Next config
next.config.tsso that only safe public env values are exposed to the client.envblock, especiallyOPENROUTER_API_KEY.NEXT_PUBLIC_*values.typescript.ignoreBuildErrors: trueso Vercel builds fail on real type issues.B. Clean package scripts
package.jsonscripts to make intent clearer.typecheckscript usingtsc --noEmit.lintalone or make it consistent, but avoid large linting migrations.C. Make runtime data routes safer for Vercel
app/api/data/tree/route.tsandapp/api/data/read/route.ts.D. Remove obvious hardcoded secret fallbacks
scripts/analyze-manuscript.ts.app/BrowserRouterWrapper.tsx, replacing them with env-driven behavior and a safe failure mode.E. Add focused documentation/comments if helpful
Constraints:
Deliverables:
maininalittler/Plotholewith code changes implementing the above.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: what Framework should Plothole be built upon to work with Vercel as a serverless system?
Assistant: Use Next.js.
It’s the most natural framework for building a serverless app on Vercel, because Vercel is the company behind Next.js and provides first-class support for:
If “Plothole” needs to run as a web app with backend logic on Vercel, the usual recommendation is:
This pull request was created from Copilot chat.