22 lines
1.3 KiB
Markdown
22 lines
1.3 KiB
Markdown
# Adversarial Bug Report: fix-register-guards
|
|||
|
|
|
||
|
|
## Summary
|
||
|
|
Adversarial review of the register-guards.sh fix. One edge case noted but not blocking.
|
||
|
|
|
||
|
|
## Bugs Found
|
||
|
|
No blocking bugs found.
|
||
|
|
|
||
|
|
## Analysis
|
||
|
|
- **Security — command injection**: The `$OPENCODE_CONFIG` variable is expanded inside a Python string. If the path contained single quotes, it could break the Python syntax. However, the path is derived from `$HOME/.config/opencode/opencode.json` — a controlled path with no user input. Not exploitable in practice.
|
||
|
|
- **JSONC stripping edge case**: `re.sub(r'//.*?$', '', text)` strips `//` to end of line. If a JSON string value contains `//` (e.g., `"http://example.com"`), the `//example.com"` portion would be stripped, corrupting the JSON. This is a known limitation noted in the code review. In practice, opencode config files don't contain URLs with `//` in string values.
|
||
|
|
- **Multiple runs**: If the script runs twice, the `grep -q "automaton-guard"` check prevents duplicate registration. Correct.
|
||
|
|
- **Config preservation**: `cfg.setdefault('plugin', []).append(...)` preserves existing entries. Correct.
|
||
|
|
|
||
|
|
## Note
|
||
|
|
The `//`-in-strings edge case could be fixed by using a proper JSONC parser (e.g., `json5`), but adding a dependency for this edge case is not warranted.
|
||
|
|
|
||
|
|
## Score
|
||
|
|
0
|
||
|
|
|
||
|
|
ADVERSARIAL_BUG_FIND_COMPLETE
|