tui: local audit log rewrite races with the guard's lock-free append
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start at tui/locallog.go:204 and trace the TUI rewrite and guard append paths to see how each accesses the audit log. Reproduce the race using the listed steps, then inspect how the two paths can coordinate safely. Done when concurrent appends and rewrites preserve valid log entries; the issue does not name tests to run.
Written by the indexing model from the issue text.
Description
Problem
In packages/tui/locallog.go:204, the TUI rewrites the local audit log file (e.g. during a delete or export operation) by reading the whole file, modifying it, and writing it back, while the guard process appends new entries to the same file without taking any lock, assuming append-only writers never conflict with another writer rewriting the whole file.
Impact
If the guard appends a new log entry to the file at the same time the TUI is mid-rewrite, the result is a classic TOCTOU/write race: depending on timing, the newly appended entry can be lost (overwritten by the TUI's stale read-then-write), or the file can end up with corrupted/interleaved content if both processes' writes land at overlapping offsets.
Repro
- Start the guard process appending to the local audit log continuously (e.g. triggering frequent audit events).
- Simultaneously perform a rewrite-triggering operation in the TUI (delete/export) against the same log file.
- Observe that entries appended by the guard during the TUI's read-modify-write window can be lost from the file afterward, or that the file ends up with corrupted content.
Suggested fix
Introduce a shared locking mechanism (e.g. an advisory file lock via flock, or a well-known lock file both processes respect) that the guard's append path and the TUI's rewrite path both acquire before touching the log file, so a rewrite cannot proceed while an append is in flight and vice versa. Alternatively, redesign the rewrite operation to re-read and merge any entries appended after the TUI's initial read before writing back, rather than assuming the file is static for the duration of the rewrite.
- Dominant language
- Go
- Stars
- 157
- Forks
- 19
- Avg merge
- 4h 21m
- Merged PRs (30d)
- 91
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from solongate/agent-security
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
solongate/agent-security#226 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
solongate/agent-security#225 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
solongate/agent-security#224 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
solongate/agent-security#223 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
solongate/agent-security#222 ·
Maintainers usually reply within 1 day
All issues in solongate/agent-security
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
slavakurilyak/awesome-ai-agents#888 ·
Maintainers usually reply within 1 day
-
enhancement nav-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
kind/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
feat(gmail): make gmail get --format raw text output the exact message, like drafts get --format rawOpenclawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openclaw/gogcli#1276 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Seed a JRNYAx price before the last close so asset-detail S1.3 doesn't fail from 08:00Z to the openOpenbug tests
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
lognorman20/monaco#7231 ·