fix(webhooks): escape webhook_uri, lazy logging, document 401 header omission
Address round-5 reviewer feedback on PR #747: - Escape `webhook_uri` in the admin pane HTML template so an operator- controlled env value (`WEBHOOK_INTERNAL_URL`, `NEXTCLOUD_MCP_SERVER_URL`) can't inject markup. The sibling `preset_id` and exception messages were already escaped — this one was the odd one out. - Convert the eight remaining f-string `logger.warning`/`logger.error` calls in `api/webhooks.py` to lazy `%s` formatting, matching the style already adopted by `webhook_receiver.py` and `webhook_routes.py`. - Document why the 401 from `handle_nextcloud_webhook` deliberately omits `WWW-Authenticate`: NC's webhook delivery worker has no auth-flow state machine to negotiate against, the bearer is a static shared secret configured out-of-band via `WEBHOOK_SECRET`, and a challenge response wouldn't change client behaviour. The existing warning log already records the rejection. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
4a3857aabb
commit
affe29f72e
@@ -394,7 +394,7 @@ async def webhook_management_pane(request: Request) -> HTMLResponse:
|
||||
<div class="info-message">
|
||||
<p><strong>About Webhooks</strong></p>
|
||||
<p>Webhooks enable real-time synchronization by notifying this server when content changes in Nextcloud.</p>
|
||||
<p><strong>Endpoint:</strong> <code>{webhook_uri}</code></p>
|
||||
<p><strong>Endpoint:</strong> <code>{html.escape(webhook_uri)}</code></p>
|
||||
</div>
|
||||
|
||||
<h3 style="margin-top: 30px;">Available Presets</h3>
|
||||
|
||||
Reference in New Issue
Block a user