Repository navigation
Fewer code reader errors; real client addresses behind the portal - #27
Merged
Merged
Conversation
- Code reader: the root listing checks the commit first, so an unreadable commit is reported once without further requests, and the parent listing tells files from directories, so a directory is no longer read as a file (NOT_A_FILE). The latest-commit offer checks the path through the parent listing instead of a read. - BINARY_FILE is a caller-side warning, not a service error. - SOURCEGRAPH_TRUSTED_PROXIES (comma-separated CIDRs) names gateways whose X-Forwarded-For identifies the client; fly.toml trusts the Fly private network the portal uses, so anonymous limits and the query error log see each visitor. Co-Authored-By: Claude Opus 5.5 <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.
Background
The query error log on the public site filled with warnings from code-reader page views (mostly a crawler): every directory view read the directory as a file (
NOT_A_FILE), and a link to a commit outside retention produced four or five failing requests. All visitors also appeared as the portal's address.Changes
BINARY_FILEis a caller-side warning.SOURCEGRAPH_TRUSTED_PROXIES: gateways whoseX-Forwarded-Fornames the client;fly.tomltrustsfdaa::/16(the portal reaches the service over Fly's private network and forwardsFly-Client-IP, Pass the Fly client IP to Source Graph portal#58).docs/interfaces.md).Compatibility
Without the setting nothing is trusted, as before. Deploy context4ai/portal#58 first.
Testing
go vet,go test ./...,bun run check; a headless browser against a local build: directory views make no failing request (before: oneread422), a stale commit makes one (before: four or five) and still offers the latest commit; a spoofedX-Forwarded-Forfrom an untrusted peer is ignored.🤖 Generated with Claude Code