Skip to content

security: fix lang-guard prototype pollution, harden api/version - #19

Merged
NX1X merged 1 commit into
mainfrom
security/hardening-sept2026
Sep 7, 2026
Merged

NX1X merged 1 commit into
mainfrom
security/hardening-sept2026

Conversation

@NX1X

@NX1X NX1X commented Sep 6, 2026

Copy link
Copy Markdown
Owner

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 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 - a reflected client-side DoS. Switched 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 (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

- 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.
@vercel

vercel Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
opentaxmap Ready Ready Preview Sep 6, 2026 6:47pm UTC

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: bbe543f4-a98c-4a46-84ca-4dc8f61903a9


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NX1X
NX1X merged commit 9ff0a8b into main Sep 7, 2026
10 checks passed
@NX1X
NX1X deleted the security/hardening-sept2026 branch September 7, 2026 03:36

This branch was successfully deployed

1 active deployment
Preview — 6a8dcc1d Deployed Sep 6, 2026 by vercel[bot]
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.

1 participant