You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(permissions): hold a session network grant to the shared gate - #1351
Fix#1332: a SESSION network grant approved in a conversation's own sandbox reached the shared sandbox without passing the shared gate.
_prompt computed shared only from the refused executor (GRANTS.is_shared(executor)), so a session or always answer recorded under a conversation's own scope (GRANTS.grant(scope, grant)) reached the sandbox every conversation shares two ways: the executors_for(scope) sync and the union read in grants_for(None). There the conversation's looser mode spoke for everyone.
The prompt now marks the answer shared whenever it is keyed to a session scope (shared = bool(scope) or ...), so authorize_runtime(shared=True) holds it to the configured mode's floor, and the description carries a note saying what the answer reaches. The note was reworded across the Python constant, the gui.confirm.ev.net_shared en/zh entries, and the regenerated TUI catalogue.
Tests: three pinned tests reworded to the new behaviour, two added (a conversation sandbox prompt now states what a session answer opens; a refused sandbox registered under no scope still says so when there is nobody to ask).
uv run ruff format --check and uv run ruff check on the changed Python files -> clean
make check-source-language and make check-large-files -> exit 0
Relevant tests pass locally
Relevant lint / type checks pass locally
User-facing docs or screenshots are updated when needed
Risk
Security impact considered: this is the fix; a conversation's own looser mode no longer opens a target in the shared sandbox on everyone's behalf.
Backward compatibility considered: prompts whose grant was already shared keep the note; only a conversation-scoped prompt that previously omitted it now carries it, which is the intended disclosure.
Rollback path is clear for risky changes: revert the commit; no schema or persistence changes.
Reviewed at head 769ec5fd6d44aec8149824b1e31855fc91b77917 (base ace780956f6b). Scope: the full base-to-head diff (raven/permissions/sandbox_network.py, i18n/messages.json, ui-tui/src/i18n/messages.generated.ts, tests/test_permissions_sandbox_network.py), read against the consumer in raven/permissions/gate.py::authorize_runtime and the grant writers in sandbox_network.py::_apply.
No Windows compatibility issue found.
The logic change is platform-neutral: shared = bool(scope) or (executor is not None and GRANTS.is_shared(executor)) feeds authorize_runtime(shared=…), whose only effect is mode = _no_looser_than(mode, configured) (gate.py:459-460), exactly the floor the description now states. No filesystem, subprocess, path, encoding, or permission-API surface is touched.
The i18n edit is UTF-8 text in a JSON catalogue plus the generated TUI file; the Chinese string survives both without escaping problems, and there is no stale copy of the old wording left anywhere in the head tree (checked by grep for both the en and zh strings).
Verification, native Windows host (tree pinned to the head commit):
python -S runner.py tests/test_permissions_gate.py tests/test_permissions_network_grants.py tests/test_permissions_session.py tests/test_permissions_judge.py -q → 371 passed (430 together with the file above, matching the PR's stated count)
node ui-tui/scripts/gen-i18n.mjs --check → exit 0, i18n: generated catalogue is up to date (run with the portable node 22 in D:\tmp\node22; the system node on this box is unreliable)
Gaps and limitations: the head tree was obtained as GitHub's tarball of 769ec5fd (a direct git fetch from this host failed at the time), so the checkout is the commit's export rather than a git worktree. No live GUI/TUI prompt was driven — the wording is only checked through the description/refusal text the gate records. make check-source-language and check-large-files were not run here.
Reviewed at head a567e7cbba877812d7629b81b1cc5f6bb1b6f29e (base 20aaefd1161f). The PR's own diff is the same four files and is byte-identical to the revision reviewed at 769ec5fd (raven/permissions/sandbox_network.py blob e8f0e4e2ea..d855bc71ff in both); only the base moved, onto a newer main.
No Windows compatibility issue found. The change remains platform-neutral: shared = bool(scope) or … only feeds gate.authorize_runtime, where its single effect is mode = _no_looser_than(mode, configured), and the i18n edit is UTF-8 text in the JSON catalogue plus its generated TUI file.
Re-verified at this head on the native Windows host (GitHub tarball of a567e7cb, extracted under D:\tmp\rv1351b):
Hi @LivXue, your Windows compatibility review for this PR (posted at head a567e7cb) found no Windows compatibility issue, and CI on this head is green (22 pass / 1 skip). The merge gate still shows "review required" only because that conclusion arrived as an issue comment rather than a formal review. If you agree, could you submit the same conclusion with the Approve button? That is all this PR is waiting on.
Reviewed at head cc086ab211d137587bf852687a397caf0a38c15b (base moved onto newer main). The PR's own diff is unchanged from the revision reviewed at a567e7cb: raven/permissions/sandbox_network.py still e8f0e4e2ea..d855bc71ff and tests/test_permissions_sandbox_network.py still 614d042f57..2b3c07d377, with the same 168-line patch (the i18n files' blob ids differ only because new main entries joined the catalogue).
No Windows compatibility issue found. Same reasoning as the earlier rounds: shared = bool(scope) or … only feeds gate.authorize_runtime, whose single effect is the configured-mode floor, and the wording change is UTF-8 text in the JSON catalogue plus its generated TUI file.
Re-verified at this head on the native Windows host (GitHub tarball of cc086ab211, extracted under D:\tmp\rv1351c):
Reviewed at head 29ddf2892d0488e3b2f3194a2265ed249f7700e7 (rebased onto newer main). The PR's own diff is unchanged from the revision reviewed at cc086ab211: sandbox_network.py still e8f0e4e2ea..d855bc71ff, the tests still 614d042f57..2b3c07d377, same 168-line patch.
No Windows compatibility issue found. Same reasoning as the earlier rounds: shared = bool(scope) or … only feeds gate.authorize_runtime, whose single effect is the configured-mode floor, and the wording change is UTF-8 text in the JSON catalogue plus its generated TUI file.
Re-verified at this head on the native Windows host (GitHub tarball of 29ddf2892d, extracted under D:\tmp\rv1351d):
node ui-tui/scripts/gen-i18n.mjs --check → exit 0, i18n: generated catalogue is up to date (portable node 22)
Gaps: the tree is the commit's export rather than a git worktree; no live GUI/TUI prompt was driven.
This branch has not been deployed
No deployments
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
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
Fix #1332: a SESSION network grant approved in a conversation's own sandbox reached the shared sandbox without passing the shared gate.
_promptcomputedsharedonly from the refused executor (GRANTS.is_shared(executor)), so a session or always answer recorded under a conversation's own scope (GRANTS.grant(scope, grant)) reached the sandbox every conversation shares two ways: theexecutors_for(scope)sync and the union read ingrants_for(None). There the conversation's looser mode spoke for everyone.The prompt now marks the answer shared whenever it is keyed to a session scope (
shared = bool(scope) or ...), soauthorize_runtime(shared=True)holds it to the configured mode's floor, and the description carries a note saying what the answer reaches. The note was reworded across the Python constant, thegui.confirm.ev.net_shareden/zh entries, and the regenerated TUI catalogue.Tests: three pinned tests reworded to the new behaviour, two added (a conversation sandbox prompt now states what a session answer opens; a refused sandbox registered under no scope still says so when there is nobody to ask).
Type
Verification
PYTHONUTF8=1 uv run --frozen --python 3.12 pytest tests/test_permissions_sandbox_network.py -q-> 59 passedPYTHONUTF8=1 uv run --frozen --python 3.12 pytest tests/test_permissions_sandbox_network.py tests/test_permissions_gate.py tests/test_permissions_network_grants.py tests/test_permissions_session.py tests/test_permissions_judge.py -q-> 430 passeduv run ruff format --checkanduv run ruff checkon the changed Python files -> cleanmake check-source-languageandmake check-large-files-> exit 0Relevant tests pass locally
Relevant lint / type checks pass locally
User-facing docs or screenshots are updated when needed
Risk
Security impact considered: this is the fix; a conversation's own looser mode no longer opens a target in the shared sandbox on everyone's behalf.
Backward compatibility considered: prompts whose grant was already shared keep the note; only a conversation-scoped prompt that previously omitted it now carries it, which is the intended disclosure.
Rollback path is clear for risky changes: revert the commit; no schema or persistence changes.
Security impact considered
Backward compatibility considered
Rollback path is clear for risky changes
Related Issues
Fixes #1332