mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-07 03:48:17 +02:00
mcp: add mcp method and tool logging to authorize (#5668)
## Summary Adds support for extending authorization log with Model Context Protocol details. i.e. ```json { "level": "info", "server-name": "all", "service": "authorize", "mcp-method": "tools/call", "mcp-tool": "describe_table", "mcp-tool-parameters": { "table_name": "Categories" }, "allow": true, "allow-why-true": ["email-ok", "mcp-tool-ok"], "deny": false, "deny-why-false": [], "time": "2025-06-24T17:40:41-04:00", "message": "authorize check" } ``` ## Related issues Fixes https://linear.app/pomerium/issue/ENG-2393/mcp-authorize-each-incoming-request-to-an-mcp-route ## User Explanation <!-- How would you explain this change to the user? If this change doesn't create any user-facing changes, you can leave this blank. If filled out, add the `docs` label --> ## Checklist - [x] reference any related issues - [x] updated unit tests - [x] add appropriate label (`enhancement`, `bug`, `breaking`, `dependencies`, `ci`) - [x] ready for review
This commit is contained in:
parent
eacf19cd64
commit
9363457849
14 changed files with 271 additions and 82 deletions
|
@ -15,7 +15,7 @@ allow:
|
|||
and:
|
||||
- mcp_tool:
|
||||
is: list_tables
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Tool: "list_tables", Method: "tools/call"}})
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Method: "tools/call", ToolCall: &InputMCPToolCall{Name: "list_tables"}}})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, A{true, A{ReasonMCPToolOK}, M{}}, res["allow"])
|
||||
require.Equal(t, A{false, A{}}, res["deny"])
|
||||
|
@ -27,7 +27,7 @@ allow:
|
|||
and:
|
||||
- mcp_tool:
|
||||
is: list_tables
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Tool: "read_table", Method: "tools/call"}})
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Method: "tools/call", ToolCall: &InputMCPToolCall{Name: "read_table"}}})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, A{false, A{ReasonMCPToolUnauthorized}, M{}}, res["allow"])
|
||||
require.Equal(t, A{false, A{}}, res["deny"])
|
||||
|
@ -39,7 +39,7 @@ allow:
|
|||
and:
|
||||
- mcp_tool:
|
||||
in: ["list_tables", "read_table"]
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Tool: "list_tables", Method: "tools/call"}})
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Method: "tools/call", ToolCall: &InputMCPToolCall{Name: "list_tables"}}})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, A{true, A{ReasonMCPToolOK}, M{}}, res["allow"])
|
||||
require.Equal(t, A{false, A{}}, res["deny"])
|
||||
|
@ -51,7 +51,7 @@ allow:
|
|||
and:
|
||||
- mcp_tool:
|
||||
in: ["list_tables", "read_table"]
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Tool: "delete_table", Method: "tools/call"}})
|
||||
`, []*databroker.Record{}, Input{MCP: InputMCP{Method: "tools/call", ToolCall: &InputMCPToolCall{Name: "delete_table"}}})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, A{false, A{ReasonMCPToolUnauthorized}, M{}}, res["allow"])
|
||||
require.Equal(t, A{false, A{}}, res["deny"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue