Harden local viewer and git source inspection#52
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Harden local viewer and git source inspection#52devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Security pass over the Python implementation. Four fixes, all in the untrusted-input paths:
inlineMarkdowninviewer/jobs.jsescaped the label but passed the URL straight intohref, so transcript text (agent output, fetched web pages, GitHub PR bodies) containing[x](javascript:...)executed onlocalhost:3927:server/security.pyaddsTrustedHostMiddlewarerestricted to loopback names when the server is bound to loopback, plus CSP /X-Frame-Options: DENY/nosniff/no-referreron every response. When the user explicitly binds beyond loopback (serve --host 0.0.0.0) the Host check is skipped, so LAN access still works as before./docs,/redoc,/openapi.jsonare disabled; they fall through to the viewer shell.git.git:range:--output=<path>was forwarded as a positional arg togit log/git diff, turning read-only inspection into a write.require_revision_rangenow rejects ranges starting with-.Not changed, checked and clean: SQL is fully parameterized (including the FTS builder in
search_views.py), noshell=Trueanywhere, no hardcoded secrets (the PostHog key inintegrations/telemetry/sender.pyis a public project write key), API request models already reject negative limits and traversal-shaped paths,pip-auditon the locked dependency set reports no known vulnerabilities.Why
The viewer serves repo content with no authentication and renders text produced by agents and third-party sources, so the browser is its real trust boundary: a
javascript:link in a run transcript or a rebinding page on any site the user visits was enough to read or act on local wiki state. The git fix closes the one place where source input reached a subprocess as an option rather than data.Verification
Docs and wiki
Notes for reviewers
TestClientdefaults toHost: testserver, which the loopback check rejects, sotests/test_server.pybuilds clients through aviewer_clienthelper pinned tohttp://127.0.0.1:3927. That is the only behavioral ripple: any non-loopback hostname pointed at a loopback-bound viewer (a custom/etc/hostsalias, some tunnel setups) now gets a 400 and needs--hostto opt in.Link to Devin session: https://app.devin.ai/sessions/7a1c08bc606c46ae89fef876a2673c3d
Requested by: @rohans0509