fix(contrib): reject explicitly empty permission options - #156
Open
monody0007 wants to merge 1 commit into
Open
monody0007 wants to merge 1 commit into
monody0007 wants to merge 1 commit into
Conversation
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
PermissionBrokertreated an explicitly emptyoptions=[]ordefault_options=[]likeNone. An empty per-request sequence therefore fell back to the broker defaults, which could be custom; an empty default sequence was replaced by the standard Approve / Approve for session / Reject choices. The existingMissingPermissionOptionsErrorguard could not catch either input.Use defaults only when the argument is
None. An explicit empty sequence now raisesMissingPermissionOptionsErrorbefore the requester callback runs. Omitted andNonearguments still use defaults; nonempty custom options, including a reject-only default, still work.Callers that intentionally want default choices should omit the argument or pass
None.Related issues
No linked issue. Searches of current upstream issues and PRs found no PermissionBroker or empty-options report or competing fix.
Testing
9d07d787:uv run --frozen python -m pytest tests/contrib/test_contrib_permissions.py -q— 2 expected failures (DID NOT RAISEfor explicit empty per-request and default options), 5 passed controls.acp.contrib.permissionsin both checkouts: empty per-request and empty default sources raise before the requester callback; omitted,None, custom-default, and reject-only controls are unchanged.make check— passed (lockfile consistency, pre-commit/Ruff,ty,deptry); the first pass let the repo formatter normalize the new test file, and reruns are clean.make test— 361 passed, 1 skipped (the opt-in Gemini CLI smoke test).Docs & screenshots
Updated
docs/contrib.mdto state theNoneversus empty-sequence behavior. No screenshots apply. No schema regeneration was needed.Checklist
fix: reject explicitly empty permission options.AI assistance: GPT-6 Sol and DeepSeek assisted with implementation, tests and this description. AI tools ran the checks above, and Claude Opus 5.5 independently reviewed the final patch. No human code review is claimed.