fix(xai): guard local media inputs against credential reads - #57727
Closed
kshitijk4poor wants to merge 2 commits into
Closed
fix(xai): guard local media inputs against credential reads#57727kshitijk4poor wants to merge 2 commits into
kshitijk4poor wants to merge 2 commits into
Conversation
Self-review follow-up on the salvaged NousResearch#57695 credential-read guard: - image_gen/xai: extract _raise_if_blocked_local_input mirroring the video_gen/xai plugin, so both xAI plugins guard local media inputs identically instead of one inlining and one using a helper. - Simplify the guard body in both plugins: only a real deny-list block raises ValueError; import/unexpected failures fail open with a debug log (defense-in-depth, consistent with the openai-codex sibling). Drops the 'except ValueError: raise' clause that coupled recovery to the assumption that the only ValueError in the try-block was ours. - image edit path: surface a read-deny block as error_type=access_denied instead of mislabeling it as a generic io_error.
kshitijk4poor
enabled auto-merge (rebase)
July 3, 2026 13:06
kshitijk4poor
disabled auto-merge
July 3, 2026 13:09
kshitijk4poor
added a commit
to kshitijk4poor/hermes-agent
that referenced
this pull request
Jul 3, 2026
Fold the xAI video credential-read guard into the same shared agent.file_safety.raise_if_read_blocked chokepoint this PR introduces for the image providers, so the whole image+video bug class is covered by one enforced boundary. Consolidates the parallel salvage of NousResearch#57695 (xAI image+video) into this PR; NousResearch#57727 is now redundant and will be closed. - video_gen/xai: guard _image_ref_to_xai_url and _video_ref_to_xai_url (the video image + video byte-read chokepoints) via the shared helper. - Regression tests: symlinked auth.json with .png/.mp4 names are blocked across both video read paths (mutation-checked).
Collaborator
Author
|
Consolidating into #57726. Both PRs salvage @necoweb3's credential-read guard work; they overlapped on the xAI image path (both would have collided on Closing this in favor of #57726 |
kshitijk4poor
added a commit
that referenced
this pull request
Jul 3, 2026
Fold the xAI video credential-read guard into the same shared agent.file_safety.raise_if_read_blocked chokepoint this PR introduces for the image providers, so the whole image+video bug class is covered by one enforced boundary. Consolidates the parallel salvage of #57695 (xAI image+video) into this PR; #57727 is now redundant and will be closed. - video_gen/xai: guard _image_ref_to_xai_url and _video_ref_to_xai_url (the video image + video byte-read chokepoints) via the shared helper. - Regression tests: symlinked auth.json with .png/.mp4 names are blocked across both video read paths (mutation-checked).
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
Fold the xAI video credential-read guard into the same shared agent.file_safety.raise_if_read_blocked chokepoint this PR introduces for the image providers, so the whole image+video bug class is covered by one enforced boundary. Consolidates the parallel salvage of NousResearch#57695 (xAI image+video) into this PR; NousResearch#57727 is now redundant and will be closed. - video_gen/xai: guard _image_ref_to_xai_url and _video_ref_to_xai_url (the video image + video byte-read chokepoints) via the shared helper. - Regression tests: symlinked auth.json with .png/.mp4 names are blocked across both video read paths (mutation-checked).
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
Fold the xAI video credential-read guard into the same shared agent.file_safety.raise_if_read_blocked chokepoint this PR introduces for the image providers, so the whole image+video bug class is covered by one enforced boundary. Consolidates the parallel salvage of NousResearch#57695 (xAI image+video) into this PR; NousResearch#57727 is now redundant and will be closed. - video_gen/xai: guard _image_ref_to_xai_url and _video_ref_to_xai_url (the video image + video byte-read chokepoints) via the shared helper. - Regression tests: symlinked auth.json with .png/.mp4 names are blocked across both video read paths (mutation-checked).
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Fold the xAI video credential-read guard into the same shared agent.file_safety.raise_if_read_blocked chokepoint this PR introduces for the image providers, so the whole image+video bug class is covered by one enforced boundary. Consolidates the parallel salvage of NousResearch#57695 (xAI image+video) into this PR; NousResearch#57727 is now redundant and will be closed. - video_gen/xai: guard _image_ref_to_xai_url and _video_ref_to_xai_url (the video image + video byte-read chokepoints) via the shared helper. - Regression tests: symlinked auth.json with .png/.mp4 names are blocked across both video read paths (mutation-checked).
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
Fold the xAI video credential-read guard into the same shared agent.file_safety.raise_if_read_blocked chokepoint this PR introduces for the image providers, so the whole image+video bug class is covered by one enforced boundary. Consolidates the parallel salvage of NousResearch#57695 (xAI image+video) into this PR; NousResearch#57727 is now redundant and will be closed. - video_gen/xai: guard _image_ref_to_xai_url and _video_ref_to_xai_url (the video image + video byte-read chokepoints) via the shared helper. - Regression tests: symlinked auth.json with .png/.mp4 names are blocked across both video read paths (mutation-checked).
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.
Summary
xAI image/video generation reads local
image_url/reference_image_urlsinputs and base64-encodes them into the outbound xAI request without Hermes' read deny-list guard — so a symlink like~/.hermes/leak.png -> ~/.hermes/auth.jsoncould have its credential-store target embedded in the payload. This applies the sameagent.file_safety.get_read_block_error()guard the OpenAI Codex image path already uses, at every local-file byte-read chokepoint in both xAI plugins.Changes
plugins/image_gen/xai/__init__.py: guard_xai_image_field(the image byte-read); read-deny blocks surface aserror_type=access_deniedin the edit path instead of a mislabeledio_error.plugins/video_gen/xai/__init__.py: guard_image_ref_to_xai_urland_video_ref_to_xai_url(video image + video byte-reads)._raise_if_blocked_local_inputhelper form; the guard fails open only ifagent.file_safetyis unavailable (defense-in-depth, consistent with the Codex sibling).auth.jsonwith.png/.mp4names are blocked across all three read paths.Validation
.png/.mp4symlink →auth.jsonValueError: Access denied— never read.pngmain; guard verified to.resolve()symlinks and match the credential denylist.plugins/image_gen/openai-codex/__init__.py).Salvaged from #57695 by @necoweb3; authorship preserved via cherry-pick. Closes #57695.