Skip to content

Keep an Other-account Command log under its accepted log directory - #1685

Merged
JacobStephens2 merged 2 commits into
mainfrom
issue-1684
Nov 1, 2026
Merged

JacobStephens2 merged 2 commits into
mainfrom
issue-1684

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

logs <other-account command>
  load Activity
    command_log_text
      resolved path leaves the accepted log directory → empty text
      otherwise → read the Command log
  stream the Command log
    stays_under(accepted directory, path) or refuse
    open the file

thirdshift logs <command> reads an Other-account Command's Command log only when its canonical path stays under that account's accepted log directory. Activity-log recovery, which logs runs first, uses the same rule. A symlink whose canonical path stays inside the accepted directory is still read. The serving account has no accepted directory, so its Command logs are read as before.

Seam: thirdshift logs <command> for an Other-account Command, including Activity-log recovery that logs loads before it streams the Command log.

Evidence

  • Before: logs widgets#7 streamed CANARY-ESCAPED-COMMAND-LOG from a Command log symlinked outside the accepted directory. After that stream check, cargo test --test console logs_does_not_read_an_activity_named_command_log_outside_the_accepted_directory failed with no Command matches widgets#7: Activity recovery followed a directory symlink, and readable mode dropped the account.
    After: other_account_command_logs_stay_under_their_accepted_log_directory and logs_does_not_read_an_activity_named_command_log_outside_the_accepted_directory pass. scripts/affected-tests main ran the full Rust suite: 3631 passed, 75 skipped (PASS cargo nextest run, 2236.20s).

Merge Danger

Door: two-way

Revert the two commits. Nothing on disk is rewritten.

Blast Radius: Other-account Command logs

A missing Other-account Command log fails stays_under before open, and the stream reports outside accepted log directory. Activity recovery still treats a missing log as empty text. The serving account is unchanged.

Unaddressed findings

Standards

  1. Duplicated code in command_log_text (src/logs/reading/history.rs, lines 291–299). Declined. stays_under (src/logs/reading/inventory.rs, lines 69–72) is false both when canonicalize fails and when the canonical path leaves the accepted directory. Activity recovery still has to call cache::text (src/logs/reading/cache.rs, lines 133–149) when the path does not resolve: NotFound stays an empty read, and any other error still fails the capture. Treating every stays_under failure as escaped would skip that read for a missing Command log. The review recorded this as a judgement call and did not claim the behaviour is wrong.

Spec

None. The Activity-log finding was fixed, and its test is kept.

Security

None.

Security review outcome

No unaddressed introduced findings.

Review coverage

The review left no changed file unread.

Closes #1684

Built with grok grok 1.0.70 (f50904eaee6c) [stable] · default model · default effort

When logs opens that Command log, read it only when its canonical path stays under the directory discovery accepted for the account.
An Other-account Activity line can name a Command log whose canonical path leaves the accepted directory. Skip that read so logs still shows the account's other Commands.
@JacobStephens2
JacobStephens2 merged commit 0805399 into main Nov 1, 2026
16 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-1684 branch November 1, 2026 10:57
@JacobStephens2 JacobStephens2 mentioned this pull request Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep an Other-account Command log under its accepted log directory

1 participant