fix: owner-only session exports and surfaced token-store persist errors - #50
Merged
Conversation
Transcripts can carry sensitive tool output; the exported artifact now matches the tokens/settings store standard instead of being world-readable.
persist() now returns an error instead of silently swallowing every failure; Set/Delete report it on stderr while keeping best-effort semantics. A failed rename no longer leaves the staged .tmp behind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes S2 and S3 from the AI-slop / vulnerability audit:
bodek-<id>.md/json) were written world-readable (0644) to a predictable CWD-relative path. Transcripts can carry sensitive tool output; exports are now owner-only (0600), matching the tokens/settings store standard. (internal/tui/panels.go)persist()silently swallowed every failure (mkdir/marshal/write/rename), so a failed save broke session resume with no diagnostic and left an orphaned.tmp.persist()now returns an error;Set/Deletereport failures on stderr while keeping best-effort semantics; the staged.tmpis removed when the final rename fails. (internal/tokens/tokens.go)TDD: RED-first regression tests —
internal/tui/export_test.go(pins 0600),internal/tokens/persist_errors_test.go(pins error surfacing + tmp cleanup) — both failed against the un-fixed code, green after.Gate:
go vetclean ·golangci-lint0 issues ·go test -race ./... -count=17/7 packages ok.