diff options
| author | Claude <noreply@anthropic.com> | 2026-11-12 15:01:04 +0000 |
|---|---|---|
| committer | Claude <noreply@anthropic.com> | 2026-11-12 15:01:04 +0000 |
| commit | 052eeb00464b9db2079325ae538356c49494fb1b (patch) | |
| tree | ce074a2bbbc98df60e77957df599016d61568718 /plugins/plugin-dev/skills/plugin-settings | |
| parent | e0ab6e51219eef74e417a0e1d89e5d53e5e763d4 (diff) | |
security-guidance: open the review records and markers through one helpermhegazy/sg-record-files
The commit and push reviews keep two small records (sg-reviewed-shas,
sg-reviewed-diffs) and one marker per commit under review
(sg-inflight-<sha>) in the git directory.
The plugin should only read and write files it made itself; the session
state file is already written in a similar way. All three are now opened
through one helper, which takes a regular file with no second hard link that
is no larger than a record can be. Anything else at that path is replaced by
a new file when the record is about to be written, and passed over when it
is only read. A folder is left alone. The open never waits, and reads from a
record are capped. Anything old at a marker's path that is not such a file,
other than a folder, is removed without being opened.
Three more fixes on the same lines:
- sg-reviewed-shas was locked with a blocking flock just before the findings
go out, so the findings waited for the lock, up to the hook's timeout. The
hook now waits half a second and then appends without the lock, as it does
where there is no flock.
- Bytes in that record that are not text ended the push review with a
traceback. They now cost only their own row.
- The rewritten record was still in the buffer when the lock was released, so
rows written by several sessions at once were lost. It is flushed first.
Cost: in a repository copied with hard links (cp -al) the records have two
names, so neither copy reads them. The first copy to write starts them
afresh, and commits reviewed before the copy may be reviewed once more.
Co-authored-by: mhegazy <mhegazy@anthropic.com>
Diffstat (limited to 'plugins/plugin-dev/skills/plugin-settings')
0 files changed, 0 insertions, 0 deletions
