[BUG] global audit scans unmanaged Codex session history for hidden Unicode
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 362
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 132
Description
Describe the bug
APM 0.31.0's global audit scans Codex session history under ~/.codex/sessions/ as deployed content. A literal U+202E RIGHT-TO-LEFT OVERRIDE in an unmanaged session file causes apm audit --ci to fail its content-integrity check and recommend apm audit --strip.
This reproduces with an empty global dependency list. APM did not install or record ownership of the session file.
To Reproduce
-
In an isolated test home, create
~/.apm/apm.yml:name: global-profile version: 1.0.0 targets: [codex] dependencies: apm: [] mcp: [] -
Create
~/.codex/sessions/unmanaged.jsonlwith a JSON string containing a literal U+202E character. For example, this Python expression produces the file contents (the character must be literal, not a JSON escape):json.dumps({"message": "safe" + chr(0x202E) + "reversed"}, ensure_ascii=False) + "\n" -
Run
apm lock -g, then runapm audit --ci --no-policy --no-driftfrom~/.apmin that same test home. -
Observe exit code 1 and the content-integrity finding below.
Expected behavior
Audit excludes unrelated Codex application state such as session history. Hidden-Unicode scanning should still cover deployable primitive locations, including unrecorded files in those locations, and explicit deployment claims.
Environment (please complete the following information):
- OS: macOS
- Python Version: 3.14.7
- APM Version: 0.31.0 (Homebrew); also reproduced with current
main
Logs
content-integrity: 1 file(s) with critical hidden Unicode
-- run 'apm audit --strip' to clean Unicode
content-integrity details:
- unicode: .codex/sessions/unmanaged.jsonl
[x] 1 of 8 check(s) failed
Additional context
The Codex target declares .codex as its root. install_governance includes the whole root prefix, and the audit scanner recursively scans that prefix. This brings session history into the scan despite it being outside the target's primitive locations.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Codex target declaration in src/apm_cli/integration/targets.py, then trace install_governance in src/apm_cli/install/manifest_reconcile.py and the recursive audit logic in src/apm_cli/security/file_scanner.py. Reproduce the issue with the isolated ~/.codex/sessions/unmanaged.jsonl file and the stated audit command. Done means unrelated session history is excluded while deployable primitive locations and explicit deployment claims remain covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100