Repository navigation
Confine the broker socket to the user's cache (SonarCloud #41–#44) - #48
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
The broker's container and home arrive as command-line arguments; validate the container as a runtime container name and keep the socket, its directory and any stale socket removed in its place under <home>/.cache/tig/<container>. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Project Requirements: PASSPR #48 passes all three requirements. It adds input checks to the internal broker entry point (server.py broker_address) so the socket cannot be placed outside ~/.cache/tig//. The change is not user-facing, so no doc updates are needed. It is portable, using only the standard library and Docker/Podman-compatible naming. It comes with regression tests that run in CI.
Automated pre-check hints
Evaluated at Criteria: |
…solves Co-Authored-By: jason.han <hanhuijun@gmail.com>
This branch has not been deployed
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
python -m tig_cli.broker <container> <home>passes both arguments straight toserver.Broker, which usedsocket_path(home, container)(os.path.join(home, ".cache", "tig", container, ...)) foros.makedirs,bind,unlinkof a stale socket, and aconnectprobe. A container like../../xor/tmp/xwould steer all of these outside the cache.Broker.__init__now gets its address from the newserver.broker_address(container, home), which is the single trust-boundary check:Errors are raised as
OSError, sobroker.mainalready maps them to exit 69 (unavailable), and the client simply falls back to the slow path like any other broker failure. Real names (tig-vicar-<12 hex>) and real homes are unaffected;broker.pyis untouched.server.py:86os.makedirs(dirname(self.address))inBroker()broker_address, confined to<home>/.cache/tig/<container>/server.py:700server.bind(address)in_listen_unix_listen_unixserver.py:704os.unlink(address)in_listen_unixserver.py:713probe.connect(address)in_answeringTests (
tests/test_broker.py): rejects traversing, absolute, dot-leading, empty, space and NUL container names with nothing created under home; rejects a missing or non-directory home; normalizes relative /..homes;broker.main(["../../escaped", home])returns 69. Full suite:pytest tests/ --no-cov -m "not integration"→ 432 passed.Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/7a159dce623f4472ac339e1a75590320
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/7a159dce623f4472ac339e1a75590320?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work