Repository navigation
The opening writer's marks refuse a re-bound path, a shadowed opened or request, and an unformatted path, and assume good faith (#868, record 0215) - #870
Conversation
…e-bound, a request or an opened shadowed, and a path not formatted (#868, record 0215) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…matted in, and not where a name is rebound unseen (#868, record 0215) The second reviews of PR 819 found seven more ways the marks failed open. A name is read only from `name = ` in its scope's own body, and a module's value in the module. The value formatted into the path is a parameter given once, or its attribute. An attribute or an item set on request's module, apply or harness rebinds that name. An opener decorated or named again is not the def. A module naming globals, setattr, exec, sys.modules and the like is not read. A call in a nested def, lambda, class or comprehension, or after a return or a raise, is not made. Record 0215's new row says what the syntax cannot hold: a request built and never sent, and a parameter holding a tuple. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd record 0215 says the marks assume good faith (#868, record 0215) The Factory Builder's ruling. A decorator over the top-level def may replace opened, so a decorated one fails closed. Four further evasions stay unfixed by design: importlib by a from-import, a call in a postponed annotation, an attribute set through another name for a module, and a method rebound in its class. The record's row names them as examples: the marks are syntax and assume code written in good faith; a crafted evasion is for the reviewers and the Maintainer's hand approval of the naming to catch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
There was a problem hiding this comment.
Code Review
This pull request updates the static analysis tool tools/check_authority.py and its corresponding decision documentation to enforce stricter rules on how pull requests are opened and recorded. It introduces checks for dynamic name rebinding (using a new _dynamic helper to detect functions like eval, exec, and importlib), restricts scope traversal to the current scope's own body, and refines parameter and import tracking. A security review comment points out that the _dynamic check can be bypassed using from importlib import ... style imports because ast.ImportFrom nodes are not checked for their module attribute, and suggests a fix to include n.module in the scanned words.
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|



Fixes #868
This is the follow-on to #819, record 0215.
tools/check_authority.pyholds that a configuration names no Role to open pull requests untilopen_pull_requesthas its writer, read as three marks in the code's syntax. The check fails closed on what it can't read. Reviewers of #819 found six ways crafted code could pass the marks without a real writer, and reviewers of this PR found seven more. All are refused here. #819 merged first so records 0216 to 0221 kept their approvals. The gaps were unreachable meanwhile, because no opening Role is named.What is refused now
if, loop,tryorwith, rebound, augmented, deleted, or used as a target. That holds for the path and the verb alike.'/repos/%s/pulls' % repo, or an f-string with one plain hole. A bare literal, a literal or computed value, any tuple, a conversion or a format spec are refused.requestcounts only as adapters.github's:from adapters.github import request [as X],from adapters import github, orimport adapters.github as G, at the module's top and bound nowhere else.openedcounts the same way. Inharness/apply.pyit counts only through an undecorated top-leveldef opened.globals,locals,vars,setattr,delattr,exec,eval,compile,__import__,importlib,modules,__dict__or__builtins__is not read.returnorraise.Record 0215 gains one Boundaries row, and no existing row changes. The row names the test, the check and the mutants. It states what syntax can't hold:
importlib, calls in postponed annotations, an alias's attribute rebound, and a method rebound in its class.Findings of that class are declined with the row cited.
Held by
tests/test_tools.py::test_a_role_named_to_open_pull_requests_waits_on_its_writergains each crafted refusal, plus the accepted forms.tools/check_authority.pyandtools/check_examples.pyare killed, and 30 of them are new.make checks: passes on this head, with main merged in.Second readers
openedinapply.py. Two declined into the limit: animportlibfrom-import, postponed annotationsopenedtaken. The rest declined into the limit as crafted evasions, per the ruling: animportlibfrom-import, annotations, an alias's attribute, a method rebound in its class🤖 Generated with Claude Code