Repository navigation
fix(security): outbound-fetch allow-list, scrape budget, AutoPilot input, auth/XML hardening - #19
Merged
Merged
Conversation
…ation host allow-list - Add DocumentationHostAllowList with exact-label/suffix matching (no substring bypass) - Skip ExternalPage fetch when the host is not on the curated allow-list Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…scrape budget - Add IScrapeBudget port (Application) + ScrapeBudget adapter (API) over IRateLimitCounterStore - Thread the analysing IP into TriggerBackgroundScrapingAsync so enqueue reserves the shared per-IP(30/hr)+global(600/hr) budget - Keep the 12h per-package dedup before the reserve; System refresh bypasses the budget - Reduce PackageController.MayQueueScrapeAsync to the shared port Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…eject shell-pipe code blocks - Wrap scraped release notes in a labelled untrusted-data delimiter block with an ignore-instructions guard - Reject drafts whose fenced code blocks pipe a downloaded URL into a shell (curl/wget | sh, bash -c piped URL, iex/Invoke-Expression download) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Set ValidAlgorithms so only HS256-signed tokens are accepted (blocks algorithm confusion) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Derive both the token expiry and LoginResponse.ExpiresAt from TokenLifetimeHours (8h), fixing the 24h/8h mismatch Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Replace XDocument.Parse with a DtdProcessing.Prohibit, resolver-null, entity-capped XmlReader feeding XDocument.Load Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Increment then check-and-release so concurrent requests from one IP cannot exceed the cap; release the slot exactly once via an acquired flag Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Use Math.Clamp so non-positive values become 1 and oversized values are capped at 50 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
8 of 9 tasks
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
Harden the outbound-fetch, analysis and auth surfaces from an internal defensive security review. Eight small, self-contained backend fixes; no user-facing behaviour change beyond tightening what the server will fetch.
Why
Closes #17. An internal review found a handful of hardening gaps on the scraping/outbound-fetch, analysis and auth code. No working exploit is shipped here and the specifics are kept out of the public issue on purpose (see
SECURITY.md); this PR is the fix.Changes
DocumentationHostAllowList, exact-label/domain-suffix match — never substring).ReleaseNotesUrlResolverskips non-allowed hosts; the existing private-IPSsrfGuardis unchanged and GitHub handling is untouched.IScrapeBudgetApplication port +ScrapeBudgetAPI adapter overIRateLimitCounterStore, registered alongside theIProgressReporterprecedent). The 12h per-package dedup is kept; theSystemrefresh job bypasses the budget.IsPublished=false).ValidAlgorithms)..nuspecXDocument.Parsesites against XXE (DtdProcessing.Prohibit,XmlResolver=null,MaxCharactersFromEntities=0), matching the manifest/POM pattern already in the codebase.limitto[1,50].Notes for reviewers
PostgresQueryTests.cs) gained a singlenull!for the newIScrapeBudgetconstructor parameter to keep the build green — no test logic was added..claude/CLAUDE.mdwere corrected locally, but.claudeis git-ignored, so that correction is not part of this diff.Checklist
developand is about one thingfeat(scope): ...,fix(scope): ...)