Skip to content

fix(memory): guard local uploads against credential reads - #58751

Merged
teknium1 merged 1 commit into
mainfrom
salvage/memory-upload-read-guard
Jul 5, 2026
Merged

fix(memory): guard local uploads against credential reads#58751
teknium1 merged 1 commit into
mainfrom
salvage/memory-upload-read-guard

Conversation

@teknium1

@teknium1 teknium1 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Salvage of #57841 by @necoweb3 (cherry-picked onto current main, authorship preserved). Memory-provider local upload tools now route model-supplied local paths through the shared agent.file_safety.raise_if_read_blocked() guard before reading bytes, so credential stores (~/.hermes/auth.json, .env, etc.) can no longer leave the machine via memory-backend upload APIs.

Changes

  • plugins/memory/retaindb/__init__.py: retaindb_upload_file calls the read guard before read_bytes(); blocked paths return a clear error.
  • plugins/memory/openviking/__init__.py: viking_add_resource guards single-file uploads; _zip_directory skips read-denied files when building directory archives (symlinks were already skipped).
  • Regression tests: blocked credential store rejected (client never called), directory zip excludes credential files, ordinary files still upload.

Validation

Check Result
tests/plugins/memory/test_retaindb_provider.py + test_openviking_provider.py 137 passed, 0 failed
E2E (real imports, temp HERMES_HOME): auth.json direct, .env anywhere, symlink disguise, mixed-dir zip all blocked; zip contains only safe files
E2E positive control: ordinary file upload unchanged, uploads

Plugin-directories-only diff — no core files touched. Same defense-in-depth chokepoint as #57698 (image/video-gen) and #58709 (vision/video analyze).

Closes #57841.

Infographic

memory-upload-read-guard

@alt-glitch alt-glitch added type/security Security vulnerability or hardening comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data needs-repro Bug needs reproduction steps P3 Low — cosmetic, nice to have labels Jul 5, 2026
@teknium1
teknium1 merged commit e02cef0 into main Jul 5, 2026
31 checks passed
@teknium1
teknium1 deleted the salvage/memory-upload-read-guard branch July 5, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins needs-repro Bug needs reproduction steps P3 Low — cosmetic, nice to have sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data tool/memory Memory tool and memory providers type/security Security vulnerability or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants