Skip to content

chore: sync core lib and CLAUDE.md from agent-core#375

Merged
avifenesh merged 1 commit into
mainfrom
chore/sync-core-agentsys-20260530-093142
May 30, 2026
Merged

chore: sync core lib and CLAUDE.md from agent-core#375
avifenesh merged 1 commit into
mainfrom
chore/sync-core-agentsys-20260530-093142

Conversation

@avifenesh
Copy link
Copy Markdown
Collaborator

Automated sync of lib/ and CLAUDE.md from agent-core.

Copilot AI review requested due to automatic review settings May 30, 2026 09:31
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new utility, readFileWithLimit, to safely read files and prevent TOCTOU (Time-of-Check to Time-of-Use) races by performing size and type checks directly on the file descriptor. It also integrates atomic write utilities across several analyzers. The feedback highlights potential symlink traversal vulnerabilities in docs-analyzer.js and prompt-analyzer.js where assertNotSymlink should be called before reading files to prevent arbitrary file disclosure. Additionally, it is recommended to update the JSDoc for readFileWithLimit to clarify that it does not prevent opening pre-existing symlinks.

Comment thread lib/enhance/docs-analyzer.js
Comment thread lib/enhance/prompt-analyzer.js
Comment thread lib/utils/fs-safe.js
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@avifenesh
Copy link
Copy Markdown
Collaborator Author

This is an auto-sync of the already-reviewed agent-core fix (PR agent-sh/agent-core#25). The auto-reviewer's symlink/TOCTOU notes are addressed by the design: reads use the fd-based readFileWithLimit, and writes use writeFileAtomic (temp file + atomic rename). rename() replaces the path entry itself and never follows a symlink to its target, so it is symlink-safe by construction - the explicit assertNotSymlink in fixer.js is belt-and-suspenders for that path. Merging to keep lib in sync with the source.

@avifenesh avifenesh merged commit 542eb81 into main May 30, 2026
14 of 15 checks passed
@avifenesh avifenesh deleted the chore/sync-core-agentsys-20260530-093142 branch May 30, 2026 10:12
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.

2 participants