Repository navigation
Harden API + fix bugs (v3.1) - #6
Closed
willscott-v2 wants to merge 3 commits into
Closed
willscott-v2 wants to merge 3 commits into
willscott-v2 wants to merge 3 commits into
Conversation
Security:
- SSRF guards in api/chunk.js: http/https only, DNS-resolve + reject
private/reserved IP ranges (incl. 169.254 metadata, CGNAT, IPv6 ULA),
per-hop redirect re-validation, 5MB body cap, content-type allowlist
- escapeHtml now escapes quotes — closes title="${fragment}" attribute
XSS from scraped heading ids
- Slack mrkdwn escaping in feedback.js kills <!channel> pings + link
spoofing; pageUrl scheme-checked and length-capped
- Input validation with allowlists (400 not 500); error details no longer
leak to clients
Bugs:
- Overlap slider was permanently stuck on Auto (unreachable else branch)
- Dead node-fetch timeout replaced with native fetch + AbortSignal.timeout;
node-fetch dependency removed
- extract=defuddle now fails 422 instead of silently falling back to cheerio
Housekeeping:
- Removed scripts/build.js + vercel buildCommand; GTM-4G43 (shared SI
container, matches grader/ontologizer) hardcoded; GTM_SETUP.md rewritten
- Deleted ~1,900 lines of unused root design-system files
- README: MIT license, searchinfluence/getchunks URLs, v3/v3.1 history,
honest data-security FAQ
Verified locally: SSRF/scheme/validation rejections, live extraction,
http->https redirect following, slider fix, and XSS containment.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Summary
Stacked on #5 (SI design system). Fixes the security issues and bugs from the full code review. No visual changes — review this one for behavior.
Base is
feature/si-design-system, notmainso the diff stays focused on logic. Merge #5 first, then this retargets to main automatically.Security
api/chunk.js): http/https only; DNS-resolve the host and reject private/reserved ranges (127/10/172.16/192.168, 169.254 cloud metadata, 100.64 CGNAT, IPv6 loopback/ULA/link-local); every redirect hop re-validated (manual redirect, max 5); 5MB response cap; content-type allowlist. The endpoint was an open fetch proxy — anyone could scrape through our Vercel IPs or probe internal addresses.escapeHtmlnow escapes"and'. It's used insidetitle="${fragment}"wherefragmentcomes from the scraped page's headingid— a page with<h2 id='x" onmouseover=...'>could inject a live handler. Verified the payload now stays trapped in the attribute value.api/feedback.js): escape&<>in message/email/pageUrl/user-agent — kills<!channel>pings and<url|label>link spoofing. pageUrl must be http(s), length-capped.error.messageto clients.Bugs
overlap: 25.timeout: 30000is ignored by node-fetch v3. Replaced with nativefetch+AbortSignal.timeout(25s), and dropped node-fetch entirely (engines already >=18).extract=defuddlewas a lie — it silently fell back to cheerio. Now fails 422.Housekeeping
scripts/build.js+ vercelbuildCommand. The build step mutatedpublic/index.htmlin place (how the live GTM ID got committed).GTM-4G43confirmed identical to the grader/ontologizer shared container; hardcoded.searchinfluence/getchunksURLs, removed stale v1.2 section, honest "is my data secure" FAQ.Testing
Local Vercel-style harness + Playwright:
Deferred (not this PR)
🤖 Generated with Claude Code