Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion infisical_sdk/api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ class AgentVaultAccessBundleRef(BaseModel):
class AgentVaultService(BaseModel):
"""A service in an Agent Vault access bundle. type is http, mcp, postgres, mysql or ssh, and the API returns only that type's fields: hostPattern, allowedMethods, allowedPathPrefixes, customHeaders and substitutions for http; serverUrl, transport, hostPattern, allowedTools and customHeaders for mcp; host, port, database and tls for postgres and mysql; host and port for ssh. Its nested settings, such as credential and tls ({"enabled", "verify", "ca"}), are left as the API returns them."""
id: str
accessBundleId: str
name: str
type: str
hostPattern: Optional[str] = None
Expand Down
13 changes: 8 additions & 5 deletions tests/test_agent_vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,19 @@ def test_access_bundles_list_reads_the_services_requiring_setup(api, agent_vault
assert bundle.services is None


def test_access_bundles_get_reads_services_and_keeps_their_nested_settings(api, agent_vault, json_response):
# Servers still send accessBundleId on each service for older SDK releases; this one reads both shapes.
@pytest.mark.parametrize("legacy", [{}, {"accessBundleId": BUNDLE["id"]}], ids=["current", "with accessBundleId"])
def test_access_bundles_get_reads_services_and_keeps_their_nested_settings(api, agent_vault, json_response, legacy):
service = {
"id": SERVICE_ID, "accessBundleId": BUNDLE["id"], "name": "github", "type": "http",
"id": SERVICE_ID, "name": "github", "type": "http",
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
"hostPattern": "api.github.com", "credential": {"type": "bearer", "memberProvidedFields": []},
"customHeaders": [], "substitutions": [], "personalValues": None,
"createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"],
"createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"], **legacy,
}
api.session.get.return_value = json_response({"accessBundle": dict(BUNDLE, services=[service])})
[read] = agent_vault.access_bundles.get(BUNDLE["id"]).services
assert (read.name, read.credential["type"], read.variableReferences) == ("github", "bearer", None)
assert not hasattr(read, "accessBundleId")


def test_access_bundles_update_sends_an_empty_description_to_remove_it(api, agent_vault, json_response):
Expand Down Expand Up @@ -440,7 +443,7 @@ def test_sessions_create_keeps_the_servers_explanation_when_it_refuses_services(

def test_access_bundles_get_reads_the_tools_an_mcp_service_allows(api, agent_vault, json_response):
service = {
"id": SERVICE_ID, "accessBundleId": BUNDLE["id"], "name": "linear", "type": "mcp",
"id": SERVICE_ID, "name": "linear", "type": "mcp",
"serverUrl": "https://mcp.linear.app/mcp", "transport": "streamable-http", "hostPattern": "mcp.linear.app",
"allowedTools": ["list_issues"],
"credential": {"type": "bearer", "memberProvidedFields": []}, "customHeaders": [],
Expand All @@ -452,7 +455,7 @@ def test_access_bundles_get_reads_the_tools_an_mcp_service_allows(api, agent_vau

def test_access_bundles_get_reads_database_and_ssh_services_without_http_fields(api, agent_vault, json_response):
shared = {
"accessBundleId": BUNDLE["id"], "description": None, "variableReferences": [], "createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"],
"description": None, "variableReferences": [], "createdAt": BUNDLE["createdAt"], "updatedAt": BUNDLE["updatedAt"],
}
postgres = dict(shared, id=SERVICE_ID, name="orders-db", type="postgres", host="db.internal", port=5432,
database="orders", tls={"enabled": True, "verify": True, "ca": None},
Expand Down
Loading