fix: escape untrusted attachment names in prompt text - #106
Conversation
Display names are caller-supplied and currently interpolated into the agent prompt as-is. Escape brackets and collapse line breaks so the prompt stays a single description. On-disk sanitization is unchanged.
|
@ladydd, this pull request body does not match Lody's PR template. This PR is marked If the body remains invalid for 7 days, this PR will be closed and marked Every external PR must link a Lody issue and provide a complete public Context handoff with concise, PR-specific review instructions. Checker findings |
|
Companion PR is now open: LodyAI/acp-extension-codex#27 |
|
Closing this PR. This PR is being closed for scope, product fit, and lack of demonstrated value. The proposed change is not accepted as a security fix and does not address a sufficiently demonstrated user-facing problem. The submission appears to be AI-generated and insufficiently reviewed, escalating speculative edge cases into security claims and introducing user-facing behavior without prior product approval. Any further automated or unsolicited submissions on this topic, or similar submissions without prior maintainer approval, will result in this account being blocked from contributing to the project. If I have misunderstood the intent, impact, or context of this change, please explain it here before opening any follow-up. I am willing to reconsider based on concrete reproduction steps, demonstrated user impact, and an approved product direction. Do not open companion or follow-up PRs before that discussion. |
Author type
Problem / pressure
Attachment display names are stored as unconstrained strings and interpolated into the text given to the agent (
[User sent a file: …]). A name with]or a line break changes the shape of that sentence. Names are untrusted caller input (uploadFile.name, path basename). On-disksanitizeAttachmentFileNamealready applies to the saved path only.Summary
formatUntrustedFileNameForPromptescapes]and backslashes and collapses line breaks. Used bybuildAttachmentPromptTextandbuildUnavailableAttachmentPromptText. Saved attachment paths are unchanged.Companion (required, other repo):
ladydd/acp-extension-codexfix/escape-resource-link-filenames(32037d7, againstLodyAI/acp-extension-codex). That PR is the markdown-label half (escapeMarkdownLinkLabelin bothformatUriAsLinkimplementations). ACPresource_link.namestays the raw display name in this PR so that adapter can escape it at the markdown boundary. Open that PR together with this one.Before / after
]escaped; newlines flattened to spacesbuild.logTest plan
On this branch (
fix/escape-attachment-file-names@fd0f1dc), afterpnpm installat the repo root:Result: 22 passed.
Skipped: full
apps/clisuite; e2e.Agent handoff
Instructions for reviewing agents
formatUntrustedFileNameForPromptand the two prompt builders insession-file-attachments.ts.resource_link.nameis left as the raw display name for the adapter PR (ladydd/acp-extension-codexfix/escape-resource-link-filenames@32037d7) to escape.Authoring context
sanitizeAttachmentFileName. Do not put file bytes in the prompt.fileNameinto ACPresource_link.namefor the adapter to escape.Sharing consent (author side)
Declining context sharing is respected, but it does not guarantee review. If withheld context prevents maintainers from assessing provenance, scope, or risk, they may decline the contribution or close the pull request.
N/A/ redacted