Merged
Conversation
Enhances audit log directory naming from `{hostname}_{uuid}` to
`{timestamp}_{appName}_{hostname}_{shortId}` for better discoverability
and benchmarking analysis.
Changes:
- Add extractAppName() helper to extract app name from config files
- Add smart fallback: use port number for localhost without config
- Update generateSessionIdentifier() to include timestamp prefix
- Shorten session ID to first 8 characters for readability
Examples:
- With config: 20251025T193847Z_myapp_localhost_efc60ee0/
- Without config: 20251025T193913Z_8080_localhost_d47e3bfd/
- Remote: 20251024T004401Z_noconfig_example-com_d47e3bfd/
Benefits:
- Chronologically sortable audit logs
- Instant app identification in directory listings
- Efficient filtering for benchmarking queries
- Non-breaking: existing logs keep their names
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Fixed bug where audit system would create duplicate folders for the same
session because it was using current time instead of the session's original
createdAt timestamp.
Bug behavior:
- Session created at T1 → folder: {T1}_app_host_id/
- Audit re-initialized at T2 → NEW folder: {T2}_app_host_id/
- Result: 2 folders per session with same ID but different timestamps
Root cause:
- metrics-tracker.js:65 was calling formatTimestamp() (current time)
- Should use sessionMetadata.createdAt (original creation time)
Impact: Each running benchmark was creating 2 audit log folders instead of 1
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This reverts the timestamp-based naming scheme that was causing audit log
fragmentation. Each agent execution was creating a new folder because the
timestamp kept changing.
Reverting back to simple, stable naming: {hostname}_{sessionId}
This ensures ONE folder per session, preventing the bug where multiple
folders were created for the same session.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
ajmallesh
added a commit
that referenced
this pull request
Jan 13, 2026
Feature/improve audit log naming
ajmallesh
added a commit
that referenced
this pull request
Mar 4, 2026
Feature/improve audit log naming
mm5srh4ngk-droid
pushed a commit
to mm5srh4ngk-droid/shannon
that referenced
this pull request
Apr 20, 2026
… escapes CRITICAL KeygraphHQ#3 from AUDIT-2026-04-19-INTERNAL-CRITICAL.md. The previous guard only checked that the lexical resolution of --file-path started with cwd. readFileSync then followed symlinks silently. A prompt- injected agent could plant a symlink in .shannon/scratchpad/ pointing at /proc/self/environ, /app/credentials/google-sa-key.json, or any file readable by UID 1001, pass the symlink's cwd-local path to --file-path, and see the target file's contents land inside a persisted deliverable that eventually ships to a CYSTEMS customer. resolveSafeFilePath now enforces four stages: 1. Reject NUL bytes in raw input. 2. Lexical-only traversal fast-reject. 3. realpathSync.native on both cwd and the resolved target; require the final canonical target to live inside cwd. Defeats symlink-escape. 4. statSync + isFile + 8 MiB size cap. Rejects /proc/self/environ (char device), FIFOs, directories, and oversized reads. Verified with a reproducer: - /etc/passwd symlink in .shannon/scratchpad/ -> rejected with "Symlink escapes cwd (realpath=/private/etc/passwd, cwd=...)" - Legitimate .shannon/scratchpad/real.md -> still read and saved. - pnpm --filter @shannon/worker check passes.
mm5srh4ngk-droid
pushed a commit
to mm5srh4ngk-droid/shannon
that referenced
this pull request
Apr 20, 2026
… escapes CRITICAL KeygraphHQ#3 from AUDIT-2026-04-19-INTERNAL-CRITICAL.md. The previous guard only checked that the lexical resolution of --file-path started with cwd. readFileSync then followed symlinks silently. A prompt- injected agent could plant a symlink in .shannon/scratchpad/ pointing at /proc/self/environ, /app/credentials/google-sa-key.json, or any file readable by UID 1001, pass the symlink's cwd-local path to --file-path, and see the target file's contents land inside a persisted deliverable that eventually ships to a CYSTEMS customer. resolveSafeFilePath now enforces four stages: 1. Reject NUL bytes in raw input. 2. Lexical-only traversal fast-reject. 3. realpathSync.native on both cwd and the resolved target; require the final canonical target to live inside cwd. Defeats symlink-escape. 4. statSync + isFile + 8 MiB size cap. Rejects /proc/self/environ (char device), FIFOs, directories, and oversized reads. Verified with a reproducer: - /etc/passwd symlink in .shannon/scratchpad/ -> rejected with "Symlink escapes cwd (realpath=/private/etc/passwd, cwd=...)" - Legitimate .shannon/scratchpad/real.md -> still read and saved. - pnpm --filter @shannon/worker check passes.
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.
No description provided.