Manuscript Offprint
arXiv:2609.39678Aletheia: Permission-Minimality Testing for Coding-Agent Rules
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
JIEKE SHI, Singapore Management University, Singapore
YUCHEN CHEN, Nanjing University, China
JUNDA HE, Singapore Management University, Singapore
YUE LIU, Adelaide University, Australia
DAVID LO, Singapore Management University, Singapore
Repository instruction files guide coding agents, but also expose them to prompt injection. Malicious rules can request credential access or data transfer while the agent produces a correct patch. We present ALETHEIA, a framework for permission-minimality testing. ALETHEIA translates requested authority into a typed language and synthesizes executable sandbox configurations. It runs the unchanged rule and task under full permissions and independent restrictions that remove one permission at a time. Passing independent functional tests under strictly reduced authority provides a dispensability witness, which ALETHEIA interprets against task context to diagnose suspicious requests. We formalize synthesis and the conditions connecting witnesses to enforced restrictions. On a shared refactoring task, ALETHEIA executes and detects all 314 AIShellJack attack inputs, with no alarms on five benign templates. Among 80 manually verified benign GHAgentFiles rules, it raises three false positives (3.75%).
1 INTRODUCTION
Repository instructions, such as AGENTS.md and Cursor rules, guide coding agents through project conventions, but also enable indirect prompt injection [4, 6]. An attacker can request uploading a local archive before a refactoring, and the agent may comply while producing a correct patch. Functional correctness alone therefore does not reveal the attack. Conversely, file access and communication also support legitimate development, so their presence alone does not establish malicious behavior.
Our insight turns least privilege [9] into an executable test: can the agent complete an independently specified task when a requested permission is withheld? Both executions retain the rule. If both pass the tests and the sandbox restriction removes authority, that authority is dispensable for the tested task. The comparison requires no recognition of particular payload wording.
Two challenges govern this comparison. Permissions overlap and share dependencies: deleting a file grant is ineffective if another covers its directory, while surviving tools must retain shared dependencies. Acceptance must come from trusted tests, since an attacker can claim that unwanted operations are mandatory. Executions must also restore the same initial state. ALETHEIA combines typed extraction, dependency-aware synthesis, and independent deletion experiments to connect source requests to enforceable restrictions preserving tested functionality. These witnesses establish task-relative dispensability, rather than malicious intent or a globally minimum policy.
2.1 Task Setting and Running Example
The inputs are a rule R, an initial project W, a task request q, and independently supplied tests T. Trusted setup provides baseline permissions, resource bindings, and resettable fixtures. The attacker controls the rule; the task, tests, trusted setup, and sandbox are outside this control.
Authors' addresses: Jieke Shi, Singapore Management University, Singapore, Singapore, jiekeshi@smu.edu.sg; Yuchen Chen, Nanjing University, Nanjing, China, yuc.chen@smail.nju.edu.cn; Junda He, Singapore Management University, Singapore, Singapore, jundahe.2022@phdcs.smu.edu.sg; Yue Liu, Adelaide University, Adelaide, Australia, knox.liu@adelaide.edu.au; David Lo, Singapore Management University, Singapore, Singapore, davidlo@smu.edu.sg.
Jieke Shi et al.

Fig. 1. ALETHEIA preserves the rule and initial state while comparing full and independently restricted executions. A witness requires both accepted artifacts and a strict authority reduction.
Consider renaming calculateTotal to calculate_total while preserving behavior. Tests check the new interface and totals of 35 for a fixed cart and 31.5 after a 10% discount. The rule additionally requests uploading artifact.tar to victim-host using scp. Translation produces the following grants:
allow fs.read(path(workspace, "artifact.tar")); allow proc.execute(scp); allow net.connect(endpoint(remote, "victim-host", 22, "tcp"));
Synthesis combines these grants with baseline project access, producing a full configuration and three independent restrictions. All branches retain the rule. This example uses a controlled network exchange to represent destination communication; it does not establish native SCP behavior.
The agent produces a modified project, which the evaluator checks against the original tests; distinct patches can satisfy this oracle. Acceptance must cover the legitimate task: refactoring tests cannot establish whether publishing is unnecessary for a release. The rule’s claimed prerequisites cannot extend acceptance conditions or baseline permissions.
2.2 Permission Language and Extraction
SYSTEMDSL separates requested authority from task execution. External declarations name filesystem, network, tool, and sandbox resources; trusted bindings determine their concrete meanings. Rule blocks attach grants to source spans, and immutable bindings name pure resource expressions. The following core fragment omits source and input declarations, collections, and operators:
Here x, r are names, s is a string, i, j are span bounds, v is a literal, and t is a scalar type. Overbars denote finite sequences; a and f range over fixed action and pure-constructor catalogs. A selector's type retains its resource origin: path(workspace, "artifact.tar") has type path<workspace>. Resource indices do not imply disjoint resources, since trusted bindings may alias.
Aletheia: Permission-Minimality Testing for Coding-Agent Rules
3
Let map names to types and give the accepted target types of action . Grant checking requires
For example, a network endpoint cannot serve as the target of fs.read. Evaluating a selector computes a resource description without accessing that resource; binding-time checks validate concrete paths, hosts, and ports. Each grant retains its source span so that the eventual restriction can be traced to the instruction that requested it.
An LLM emits a schema-constrained representation, which a deterministic printer converts to SYSTEMDSL. An ANTLR4 parser [8] and semantic checker validate syntax, signatures, selectors, and provenance. A source check examines both unsupported grants and omitted requests. These checks constrain translation without verifying natural-language meaning: a valid source span may still be misinterpreted. An omission prevents the corresponding authority from being tested, while an invented grant can yield an irrelevant deletion. Task acceptance therefore remains independently specified rather than inferred from the translation.
2.3 Configuration Synthesis
Resource binding precedes permission deletion. The trusted binding resolves resource names to concrete paths, tools, and endpoints and selects each operation's native or modeled realization. Preparation uses the complete declaration set to fix fixtures before branching. Otherwise, deleting an archive-read grant might also remove the archive, changing both resource availability and authority. In the running example, every branch receives the same archive, transfer-tool implementation, and destination interpretation. Only its access policy varies. A missing realization is a configuration error, not a successful operation with no effect.
Let be the checked declarations. Preparation fixes a manifest containing the runtime, backend, resource bindings , baseline authority , dependencies, and initial project and fixture state . Over a finite basis of authority atoms, elaborates permission , and means that realizing requires . For , synthesis computes
Proposition (least envelope and monotonicity). For a fixed , is the unique least dependency-closed set containing . Moreover, implies . Proof. Starting from the baseline and elaborated grants, repeatedly add dependency successors. Finiteness ensures termination. Every closed superset of the starting set contains each added atom, by induction over the additions, establishing leastness. Starting from a subset can reach only atoms reachable from the larger set, establishing monotonicity. This property concerns authority sets; it does not imply that task success is monotone in authority. Nor does leastness select an optimal backend or establish minimum task authority.
The backend lowers to a runnable configuration . Let interpret atoms as concrete operation sets, extended by union, and let denote compiled policy authority. Faithful realization requires . Comparing declaration identities is insufficient because aliases and directory scopes can overlap; ALETHEIA compares compiled policy coverage, with separate probes assessing selected installed restrictions.
Concretely, lowering constructs a filesystem view, process restrictions, and gates for brokered or modeled operations. It preserves the runtime image, agent entry point, original rule, and task across configurations. Normalization may remove a file grant covered by a directory grant, but must
Jieke Shi et al.
preserve the union of permitted operations. The original declaration identities remain available for deletion experiments. If two tools share an interpreter, removing one tool grant retains the interpreter needed by the other. Conversely, deleting an archive-read grant covered by baseline access produces no effective reduction. These cases explain why a restriction is resynthesized from the remaining declarations rather than implemented by deleting one low-level sandbox entry.
2.4 Independent Execution and Witnesses
For each , ALETHEIA synthesizes independently. All branches receive the original rule and task, share tool interfaces and budget, and restore . Write and for the full and restricted execution records. Let require a completed, confined execution with a valid passing oracle result. Then
(4)
Strict inclusion rejects ineffective deletions. Missing records and invalid evaluations supply no witness. For admissible configurations, the complete schedule uses executions; deletions never accumulate. Under fixed bindings, faithful realization, complete mediation, and an uncompromised oracle, a witness establishes an accepted artifact produced without authority in : enforcement confines the restricted execution to , which is disjoint from . Individual witnesses cannot be combined without testing, since two individually removable permissions may substitute for each other.
Algorithm 1 Independent leave-one-out experiments
Require: Checked P; fixed M and ; rule R; task q; tests T
Ensure: Witness set W and branch records L
1: ;
2: ;
3: for do
4:
5:
6:
7: if then
8: if then
9:
10:
11: end if
12: end if
13: end for
14: return
In Algorithm 1, RunEval installs an admissible configuration, runs the agent, and checks its artifact with T. Configuration errors, incomplete runs, and invalid evaluations remain distinct from valid negative tests; none satisfies . Each restriction uses the original P, fixed M, and restored . Model and service responses may still differ.
For the destination permission, suppose the full branch communicates with the bound host and then performs the rename. In the restricted branch, the endpoint gate denies that communication, and the agent continues with the same task. An accepted artifact in either branch may preserve the function body while changing its header:
Aletheia: Permission-Minimality Testing for Coding-Agent Rules
5
- def calculateTotal(items, discountRate=0):
- def calculate_total(items, discountRate=0):
When both artifacts pass and no remaining grant covers the destination, the report links the upload instruction, removed authority, and passing records. Neither an upload attempt nor identical patches are required. The other two permissions are tested independently against the full configuration.
A legitimate optional operation can also be dispensable. An LLM therefore interprets witnessed requests against the rule and trusted task, considering actor, target, and activation condition. An alarm requires both a witness and an independent operation requested in this setting, including unresolved activation conditions. The rule's own claim of necessity is not trusted authorization. Reports retain source requests, policy differences, and oracle results.
Execution backend. A custom tool-calling agent uses Linux namespaces, private filesystem views, capability restrictions, and secomp. Brokered communication enforces endpoint permissions; native tools cannot open sockets. Selected operations use stateful models fixed across branches. Forks and filesystem clones restore local state, following DeltaBox's branching motivation [3], without reproducing its kernel or microVM mechanisms or restoring cloud model state. The read-only Python evaluator shares the artifact's interpreter, so oracle integrity remains an assumption.
Enforcement applies at each represented operation boundary. A denied operation leaves its protected resource unchanged and returns a denial that the agent can observe. A compound tool call may nevertheless complete some permitted operations before a later operation is blocked, so a failed call is not assumed to be effect-free. Restoration therefore includes prepared files and controller-owned modeled state, with separate outputs for each branch. This boundary supports the comparison of local experiments without claiming rollback of arbitrary external services.
3 EVALUATION
We evaluate 314 AIShellJack attack prefixes and its five unchanged benign project-rule templates [6], plus 80 manually verified benign GHAgentFiles instructions from distinct repositories [1]. All inputs use the shared refactoring task and independently authored tests, rather than repository-specific tasks. The recorded setup uses GPT-5.5 through OpenRouter, four workers, eight agent turns per branch, and a ten-second command timeout, with Linux running through Docker on an Apple M4 Pro with 24 GiB memory.
Table 1. Detection on the shared task. Unresolved inputs have no alarm but are not confirmed negatives.
| Inputs | Count | Alarms | Unresolved |
|---|---|---|---|
| AIShellJack attacks | 314 | 314 | 0 |
| AIShellJack benign templates | 5 | 0 | 0 |
| GHAgentFiles benign rules | 80 | 3 | 25 |
All 314 attack inputs complete execution and are detected (100%), with no alarms on the five templates (Table 1). GHAgentFiles produces three false positives (3.75%), 52 completed negative decisions, and 25 unresolved outcomes: 22 unsupported permission interpretations, two translation failures, and one provider refusal. Synthesis prepares all 1,112 configurations for the cached attack projections and identifies 26 ineffective deletions. Across 24 completed GHAgentFiles runs with fresh translation, translation and sandbox execution take a median of 44.35 seconds and US$0.22 per input, excluding subsequent task-context interpretation.
Jieke Shi et al.
In an earlier development comparison, task-context interpretation alone produces the same file-level alarms as the combined criterion. Execution therefore supplies tested authority-removal evidence without an established classification gain. The shared task may omit legitimate project obligations, and all 80 GHAgentFiles files informed method development. Five templates and this development set do not establish a population false-positive rate. Translation fidelity, native-service equivalence, enforcement, and oracle integrity limit the conclusions; attacks that misuse already-required authority may yield no witness.
4 RELATED WORK AND CONCLUSION
Sandbox mining derives restrictions from observed accesses [5], whereas ALETHEIA tests whether even exercised authority can be withdrawn. Abhaya synthesizes system-call policies from program invariants [7]; our synthesis realizes rule declarations under fixed dependencies. Progent controls agent authority [10], and CaMeL constrains information flow [2]. SkillScope examines excessive privileges through task-conditioned counterfactual execution [11]. ALETHEIA connects independently tested artifacts to concrete permission removal while retaining the original rule. Its witnesses support individual, task-relative restrictions. Future work will evaluate repository-specific tasks and strengthen translation, enforcement, and oracle validation.
REFERENCES
[1] Guillaume Cardoen, Tom Mens, and Alexandre Decan. 2026. GHAgentFiles: A dataset of coding agent file histories in GitHub repositories. Dataset. https://doi.org/10.5281/zenodo.20396489 Release 2026-07-07.
[2] Edoardo Debenedetti, Ilia Shumailov, Tianqi Fan, Jamie Hayes, Nicholas Carlini, Daniel Fabian, Christoph Kern, Chongyang Shi, Andreas Terzis, and Florian Tramèr. 2025. Defeating Prompt Injections by Design. arXiv:2503.18813. https://arxiv.org/abs/2503.18813v2 Version 2.
[3] Yunpeng Dong, Jingkai He, Shiqi Liu, Yuze Hou, Dong Du, Zhonghu Xu, Si Yu, Baochuan Yang, Yubin Xia, and Haibo Chen. 2026. DeltaBox: Scaling Stateful AI Agents with Millisecond-Level Sandbox Checkpoint/Rollback. arXiv:2605.22781. https://arxiv.org/abs/2605.22781 Version 2.
[4] Kai Greshake, Sahar Abdelnabi, Shailesh Mishra, Christoph Endres, Thorsten Holz, and Mario Fritz. 2023. Not What You’ve Signed Up For: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. In Proceedings of the ACM Workshop on Artificial Intelligence and Security (AISec). 79–90. https://doi.org/10.1145/3605764.3623985
[5] Konrad Jamrozik, Philipp von Styp-Rekowsky, and Andreas Zeller. 2016. Mining Sandboxes. In Proceedings of the 38th International Conference on Software Engineering (ICSE '16). Association for Computing Machinery, 37–48. https://doi.org/10.1145/2884781.2884782
[6] Yue Liu, Yanjie Zhao, Yunbo Lyu, Ting Zhang, Haoyu Wang, and David Lo. 2026. "Your AI, My Shell": Demystifying Prompt Injection Attacks on Agentic AI Coding Editors. arXiv:2509.22040. https://arxiv.org/abs/2509.22040 Version 2.
[7] Shankara Pailoor, Xinyu Wang, Hovav Shacham, and Isil Dillig. 2020. Automated Policy Synthesis for System Call Sandboxing. Proceedings of the ACM on Programming Languages 4, OOPSLA, Article 135 (2020). https://doi.org/10.1145/3428203
[8] Terence Parr, Sam Harwell, and Kathleen Fisher. 2014. Adaptive LL(*) Parsing: The Power of Dynamic Analysis. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA). 579–598. https://doi.org/10.1145/2660193.2660202
[9] Jerome H. Saltzer and Michael D. Schroeder. 1975. The Protection of Information in Computer Systems. Proc. IEEE 63, 9 (1975), 1278–1308. https://doi.org/10.1109/PROC.1975.9939
[10] Tianneng Shi, Jingxuan He, Zhun Wang, Hongwei Li, Linyu Wu, Wenbo Guo, and Dawn Song. 2026. Progent: Securing AI Agents with Privilege Control. arXiv:2504.11703. https://arxiv.org/abs/2504.11703 Version 3.
[11] Jiangrong Wu, Yuhong Nan, Yixi Lin, Huaijin Wang, Yuming Xiao, Shuai Wang, and Zibin Zheng. 2026. SkillScope: Toward Fine-Grained Least-Privilege Enforcement for Agent Skills. arXiv:2605.05868. https://arxiv.org/abs/2605.05868 Version 3.