feat(raw-api): add gitea_request schema, path parsing, client dispatch and handler

Adds the RawApiRequestArgs schema (extra=forbid), raw path normalization/
parsing helpers, a GiteaClient.raw_request that audits method+path only (never
the body), and the raw_api_request_tool handler. The handler derives a coarse
virtual tool name (gitea_request:METHOD:topsegment) plus repository/target_path
from the path and runs them back through the policy engine, enforces an
admin/credential sensitive-path denylist, and bounds responses. Two config
flags gate it: RAW_API_ENABLED (killswitch) and RAW_API_ALLOW_SENSITIVE.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
LatteandClaude Opus 4.8 committed 2026-06-26 12:26:26 +02:00
1 parent 227122263b
commit 2844c42ec8
4 files changed
+339 -1

No files matched your search

+13
View File
@@ -211,6 +211,19 @@ class Settings(BaseSettings):
"Disabled by default."
),
)
# Raw API dispatch (gitea_request escape hatch)
raw_api_enabled: bool = Field(
default=True,
description="Enable the generic gitea_request raw API dispatch tool",
)
raw_api_allow_sensitive: bool = Field(
default=False,
description=(
"Allow gitea_request to reach admin/credential endpoints "
"(/admin, *tokens*, *secrets*, *hooks*, *keys*, applications/oauth2, "
"runner registration tokens). Disabled by default."
),
)
automation_enabled: bool = Field(
default=False,
description="Enable automation endpoints and workflows",