Skip to content

fix(security): memory-privacy IDOR + workspace-shell CSWSH hardening - #10989

Merged
mrveiss merged 1 commit into
Dev_new_guifrom
hotfix-memidor
Jul 6, 2026
Merged

mrveiss merged 1 commit into
Dev_new_guifrom
hotfix-memidor

Conversation

@mrveiss

@mrveiss mrveiss commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Thinking Path

Two background security reviews flagged HIGH-severity issues in this session's merged memory-privacy (#10554) and workspace-shell (#10544) code. All are real IDOR / cross-origin gaps — fixed fail-closed.

What Changed

IDOR — arbitrary Redis key deletion & fail-open ownership (memory/transparency.py, api/memory_privacy.py)

  • New canonical is_working_memory_key() in memory/working_memory.py (allowlists the autobot:session:*:memory:* shape).
  • _forget_working_memory / _amend_working_memory: reject any non-working-memory key before any Redis op (no arbitrary-key read/delete), and require the decoded value to be a dict owned by the caller — a non-dict payload is now denied (was fail-open: if isinstance(value, dict) and ... skipped the check for non-dicts).
  • _forget_graph_entity: deny-by-default ownership — dropped the fail-open if owner and owner != user_id guard so a missing/blank owner is no longer deletable by a normal caller (shared/system entities protected).

CSWSH — missing Origin validation (api/task_workspace_ws.py)

  • _validate_ws_origin now validates the Origin header against the CORS allowlist (get_config_manager().get_cors_origins()) before a shell is attached. Browser cross-origin connections (which carry ambient cookies but a disallowed Origin) are rejected; non-browser clients omit Origin and authenticate via the internal-service key. Fail-closed if config is unavailable. Auth-header requirement retained.

Verification

memory/security_idor_hotfix_test.py — 13 tests pass: key-shape allowlist; forget/amend reject arbitrary keys without touching Redis; non-dict payload denied; tenant mismatch denied; owner can delete; graph-entity missing-owner denied by default; WS disallowed-Origin rejected, allowlisted-Origin + absent-Origin(non-browser) pass, absent-auth rejected in production. Black (26.3.1) clean.

Model Used

Opus 4.8

- _forget/_amend_working_memory: allowlist canonical key shape before any Redis op (no arbitrary-key delete) + require dict payload owned by caller (fail-closed on non-dict)
- _forget_graph_entity: deny-by-default ownership (drop fail-open 'owner and' guard)
- task_workspace_ws: validate Origin against CORS allowlist before shell attach (CSWSH)
- 13 regression tests
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

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.

1 participant