security: fix lang-guard prototype pollution, harden api/version - #19
Merged
Merged
Conversation
- src/main.js: the lang guard used !STRINGS[state.lang], an object-key lookup rather than an allowlist check, so ?lang=__proto__ (or any other Object.prototype key) passed it. state.lang would then reach STRINGS[state.lang].aboutDataItems as undefined and throw, blanking the page for whoever clicked a crafted link. Switch to a strict he/en allowlist. - scripts/prerender.mjs: assert loc.slug matches [a-z0-9-] before using it in a path join. Currently safe only because build_data.py already collapses slugs to that charset; this makes the guarantee local instead of relying on the data pipeline never changing. - api/version.mjs: add a 5s timeout to the outbound GitHub fetch. - .devcontainer/devcontainer.json: pin the base image by digest.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This branch was successfully deployed
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.
Summary
src/main.js: the lang guard used!STRINGS[state.lang], an object-key lookup rather than an allowlist check, so?lang=__proto__(or any otherObject.prototypekey) passed it.state.langwould then reachSTRINGS[state.lang].aboutDataItemsasundefinedand throw, blanking the page for whoever clicked a crafted link - a reflected client-side DoS. Switched to a stricthe/enallowlist.scripts/prerender.mjs: assertloc.slugmatches[a-z0-9-]before using it in a path join. Currently safe only becausebuild_data.pyalready collapses slugs to that charset; this makes the guarantee local instead of relying on the data pipeline never changing.api/version.mjs: add a 5s timeout to the outbound GitHub fetch (it already had a method gate and correctly skipped caching on failure - that part was already solid)..devcontainer/devcontainer.json: pin the base image by digest.Test plan
npm run build- Vite build + all 536 prerendered locality pages generate clean