Skip to content

Add secrets management tools (scopes and secrets CRUD)#417

Open
jralfonsog wants to merge 4 commits intodatabricks-solutions:mainfrom
jralfonsog:feat/secrets-management
Open

Add secrets management tools (scopes and secrets CRUD)#417
jralfonsog wants to merge 4 commits intodatabricks-solutions:mainfrom
jralfonsog:feat/secrets-management

Conversation

@jralfonsog
Copy link
Copy Markdown

Summary

Adds a new secrets management module — previously a Tier 1 gap (entirely missing from the tool suite).

  • Scope CRUD: create_secret_scope, list_secret_scopes, delete_secret_scope
  • Secret CRUD: put_secret (upsert), get_secret, list_secrets, delete_secret
  • Resource tracking: Scope create/delete integrates with manifest system

Security design

Secret values are sensitive material that must not leak into LLM conversation context. The tools implement a layered security approach:

Tool What it returns Why
get_secret (MCP) Metadata only: exists, value_length Sufficient for debugging ("is it set?", "is it empty?", "right size for an API key?") without exposing the value
get_secret (core lib) Metadata by default, full value opt-in via return_value=True Programmatic use only — caller controls output
put_secret Confirmation only, never echoes the value Prevents accidental logging
list_secrets Keys + timestamps only API design — values are never in list responses

The core library function's return_value parameter is documented with a WARNING that it must never be exposed through MCP tools.

Changes

Layer File What changed
Core secrets/__init__.py New module with exports
Core secrets/secrets.py 7 functions + security documentation
MCP tools/secrets.py 7 @mcp.tool(timeout=30) wrappers with manifest tracking
MCP server.py Register secrets in tool imports
Tests tests/unit/test_secrets.py 18 unit tests across all operations

Test plan

  • 18 unit tests pass (scope CRUD, secret CRUD, validation, not-found, metadata-only vs full-value modes)
  • Ruff lint + format pass (line-length=120, py311)
  • Full integration test against aws-fe workspace:
    • Create scope → list scopes → put secret → get secret (metadata: exists=True, length=13, no value) → get secret (programmatic: value matches) → list secrets → delete secret → delete scope
    • Not-found handling for scopes, secrets, and nonexistent keys
  • get_secret MCP tool confirmed to never return secret values

This pull request was AI-assisted by Isaac

Scope CRUD (create, list, delete) and secret operations (put, get,
list, delete). get_secret defaults to metadata-only (exists + byte
length) to prevent leaking values into LLM context. Full value
retrieval is opt-in via return_value=True for programmatic use only.

Co-authored-by: Isaac
7 tools: create/list/delete scopes, put/get/list/delete secrets.
get_secret returns metadata only (exists + byte length) — secret
values are never exposed to the LLM. Scope create/delete integrates
with manifest resource tracking.

Co-authored-by: Isaac
Covers create/list/delete scopes, put/get/list/delete secrets,
metadata-only vs full-value get_secret modes, validation errors,
and not-found handling.

Co-authored-by: Isaac
- Docstrings: opening """ on its own line
- MCP module header: add tool listing
- Returns sections: bullet list format for dict keys
- Manifest imports: late imports in try blocks
- Idempotent create: create_secret_scope returns created flag on ResourceAlreadyExists
- MCP tool renamed to create_or_update_secret_scope

Co-authored-by: Isaac
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