Skip to content

docs(integrations): add security section to MongoDB README - #7921

Closed
atandon2024 wants to merge 3 commits into
google:mainfrom
atandon2024:docs/mongodb-readme-security
Closed

atandon2024 wants to merge 3 commits into
google:mainfrom
atandon2024:docs/mongodb-readme-security

Conversation

@atandon2024

Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

2. Or, if no issue exists, describe the change:

Problem:
The MongoDB integration README explains least-privilege roles and keeping the connection string out of Agent Engine packages. It doesn't say what the session and memory services store, which inputs they trust, or where the boundary between users and tenants lies.

Solution:
Add a ## Security section, placed before "Required permissions", modeled on the security section of mongodb-developer/claude-agent-sdk-mongodb-session-store. Documentation only; no code changes.

  • Stored data is sensitive: events are stored verbatim in event_data. Covers TLS and auth, least-privilege users, write access, and encryption at rest or CSFLE (including which fields must stay unencrypted).
  • Identifiers must come from an authenticated identity: app_name, user_id and session_id go straight into query filters and are not type-checked, so a dict such as {"$ne": ""} acts as an operator.
  • Search filters are allowlisted: lists the exact operators _check_filter accepts, and notes that the allowlist limits what a filter can express, not what data it can reach.
  • Search results are untrusted input: they can carry prompt injection.
  • Reads are bounded by configuration: defaults for max_results and timeout_ms, and how timeoutMS and GetSessionConfig tighten them.

Testing Plan

Documentation-only change.

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

pytest tests/unittests/integrations/mongodb: 128 passed.

I also checked each claim with a throwaway test file using the existing fakes (23 passed, not committed):

  • event text is stored verbatim in event_data;
  • session-service queries touch only _id, app_name, user_id, session_id and event_id, never event_data or state;
  • memory recall matches on keywords;
  • a {"$ne": ""} user_id reaches the query filter without validation;
  • the filter allowlist matches the documented set exactly, and $where, $expr and nested $regex raise ValueError;
  • the max_results and timeout_ms defaults are 50 and 60000;
  • GetSessionConfig(num_recent_events=..., after_timestamp=...) limits loaded events.

Every in-page anchor resolves to a heading, and the external MongoDB doc links return 200.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

Documents what the session and memory services store, why app_name,
user_id and session_id must come from an authenticated identity, the
search-filter operator allowlist, untrusted search results, and how
reads are bounded.
@google-cla

google-cla Bot commented Nov 1, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@atandon2024

Copy link
Copy Markdown
Contributor Author

@theshanbhag could you please review this PR?

@atandon2024
atandon2024 marked this pull request as ready for review November 2, 2026 15:26
copybara-service Bot pushed a commit that referenced this pull request Nov 4, 2026
@adk-bot

adk-bot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Thank you @atandon2024 for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 1f49e28.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot added the merged [Status] This PR is merged label Nov 4, 2026
@adk-bot adk-bot closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged [Status] This PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants