Repository navigation
fix(webhooks): make authPassword write-only - #14016
Conversation
A key scoped to webhooks.read could read back the Basic-auth credential for the external endpoint, while the signing key on the same routes was already withheld. The response model now always returns authPassword empty, and updates that omit it keep the stored password so clients that can no longer read it back do not wipe it on unrelated edits.
🟢 Tier S · Ready to merge
Makes webhook Basic-auth passwords write-only in API responses. Updates preserve an omitted password unless the endpoint changes or TLS verification is downgraded. E2E coverage checks response redaction, read-only access, credential retention, and clearing on URL changes and TLS downgrades. Latest changes: Adds a delivery-based regression test that disables TLS verification without changing the URL or supplying a password, then verifies that no Authorization header is sent.
📂 Walkthrough · 6
✅ Fixed since the last review · 1
Reviewed the commits since |
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Keeping the stored password on an update that moves the URL or disables TLS verification let a webhooks.write key redirect the credential to an endpoint it can read. Also align the legacy-format tests with the masked response and pick deliveries by webhook ID so the project's catch-all webhook cannot answer the probe.
|
@greptile review |
|
@hansi-codes review |
|
@greptile review |
Brings in main's OAuth2 state and nonce validation (#14012), which cloud needs, along with the realtime origin alignment (#14020), subscriber target ownership (#14019), GitLab primary email (#14010), impersonation MFA (#14017), write-only webhook passwords (#14016), chunked-upload resume ownership (#14014), preview authorize validation (#14013), nightly forcing (#14015) and scheduled-function enqueue checks (#14011). The merge had no textual conflicts, and main left composer.json and composer.lock unchanged. So the lock keeps the branch's database and async pins. Main's assertResumeAllowed() in Storage Buckets/Files/Create checks Input(Database::PERMISSION_UPDATE, ...). utopia-php/database 8 has no PERMISSION_* constants, so every chunked resume would fail with an undefined-constant error. It now passes PermissionType::Update, as the rest of that action already does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What does this PR do?
Makes the webhook
authPasswordwrite-only.A key scoped only to
webhooks.readcould read the stored HTTP Basic-auth password for a webhook's external endpoint fromGET /v1/webhooks/:idandGET /v1/webhooks, while the signing key on the same routes was already withheld. The password is only ever needed by the webhooks worker, which reads it from the database directly.Response\Model\Webhook::filter()now always returnsauthPasswordas an empty string, so get, list, create and update responses no longer carry it.PUT /v1/webhooks/:idnow takesauthPasswordas optional and nullable: omitting it keeps the stored password, and sending''clears it. The retained password is dropped when the update changes the URL or turns TLS verification off, so awebhooks.writekey cannot redirect a credential it cannot read to an endpoint it controls. Without this, the Console (which currently echoes$webhook.authPasswordback on every edit) would silently wipe the password when a user renames a webhook or changes its URL or events.Out of scope: the V26 legacy response filter still serialises
httpPassandsignatureKeyintoproject.webhooks[]for old response formats on project reads. That path needs project-level read access rather thanwebhooks.read, and can follow separately.Behaviour change: Appwrite-to-Appwrite migrations can no longer copy a webhook's Basic-auth password, because the source API no longer returns it (the same caveat that already applies to
secret). The migration test now asserts that.Test Plan
testWebhookAuthPasswordNotExposedInResponses: create, get, list and update all returnauthPassword === ''and nohttpPass.testReadOnlyKeyCannotRecoverAuthPassword(custom server): a key with onlywebhooks.readgets an emptyauthPasswordandsecretfrom get and list.testUpdateWebhookKeepsAuthPasswordWhenOmitted: updating a webhook withoutauthPassword, then triggering an event, deliversAuthorization: Basic base64(user:password)to the request catcher, so the stored credential survived the update.testUpdateWebhookClearsAuthPasswordWhenUrlChanges: moving the URL withoutauthPassworddelivers noAuthorizationheader.httpPasstests) that expected the password to be echoed back.pint --testandphpstanpass on the changed files. E2E runs in CI.Related PRs and Issues
authPasswordon unrelated webhook edits and show "leave blank to keep" in the security form.secret)