Skip to content

fix(response): keep key and webhook secrets out of the 1.9.4 project format - #14815

Merged
ChiragAgg5k merged 2 commits into
mainfrom
fix/response-filter-v26-secrets
Oct 22, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
fix/response-filter-v26-secrets

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What

The V26 response filter (formats older than 1.9.5) rebuilds the legacy keys and webhooks arrays of the project model from the raw project document, so it did not apply the redaction the current models and key endpoints use.

  • Key secret is only included when the caller holds keys.write or organization.projects.keys.write, matching the project and organization key endpoints. The filter reads the caller's scopes from the request it is constructed with.
  • Webhook authPassword and secret are always empty, matching the current webhook model (password is write-only, signature key is only returned on creation and rotation).

V26 is the only response filter that reads the raw document, so no other filter needed the same change.

Compatibility

Clients using a response format older than 1.9.5 no longer receive webhook credentials in the project model, and only receive key secrets when they can manage keys.

Tests

  • Unit: tests/unit/Utopia/Response/Filters/V26Test.php covers the project and project list models with and without keys.write (fails on main, passes here).
  • E2E: ProjectCustomServerTest::testGetProjectLegacyFormatHidesSecrets calls GET /v1/project with response format 1.9.4 using a project.read key and a full server key (CI only). ProjectsConsoleClientTest::testGetProject now expects empty webhook credentials in the legacy format.

Related: appwrite-labs/cloud#6674

…format

The V26 filter rebuilds legacy project keys and webhooks from the raw project document, so it bypassed the redaction the current models and key endpoints apply. Key secrets now require keys.write, and webhook credentials stay write-only like the current webhook model.
@luxor-code-review

luxor-code-review Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 1 nitpick below.

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 Legacy webhook credentials emptied silently (V26.php:148) — parseWebhook now unconditionally returns '' for authPassword and secret (src/Appwrite/Utopia/Response/Filters/V26.php:148-149) where 1.9.4-format callers previously received httpPass/signatureKey.

This change makes the legacy response-format filter (V26) strip sensitive project credentials unless the caller holds keys.write, and threads the current request into the filter so the scope check is possible. It adds unit coverage for the masking logic and an E2E contract test on the legacy project endpoint.

Files Change
app/controllers/general.php Passes the Request into the version response filter when instantiating it in the router.
src/Appwrite/Utopia/Response/Filters/V26.php Empties project key and webhook secret fields in legacy responses unless the caller has keys.write scope.
tests/unit/Utopia/Response/Filters/V26Test.php Unit tests covering the new secret-masking behavior.
tests/e2e/Services/Project/ProjectCustomServerTest.php E2E contract test verifying legacy responses mask secrets.

Reviewed commit: bca29a0

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 22, 2026
@ghost

ghost commented Oct 22, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The previously reported organization-level scope gap is fixed, and the latest changes introduce no additional issues.

The V26 response filter now redacts webhook credentials in legacy project responses and includes key secrets only for callers authorized to manage keys. It uses request scopes for both individual project and project-list responses, with unit and E2E coverage for the redaction behavior.

Latest changes: The newest commits also allow organization.projects.keys.write to reveal key secrets and update the console-client E2E expectations to require empty webhook credentials.

Verdict New comments Fixed Still open
✅ Approved 0 1 0
📂 Walkthrough · 5
File Change
app/controllers/general.php Passes the request into the V26 response filter.
src/Appwrite/Utopia/Response/Filters/V26.php Redacts legacy webhook credentials and gates key secrets on the caller's key-write scopes.
tests/e2e/Services/Project/ProjectCustomServerTest.php Covers legacy project response redaction through the API.
tests/e2e/Services/Projects/ProjectsConsoleClientTest.php Updates webhook response expectations so password and signature secrets are empty.
tests/unit/Utopia/Response/Filters/V26Test.php Covers project and project-list redaction, including both project and organization key-write scopes.
✅ Fixed since the last review · 1
  • Honor organization-level key write scope · src/Appwrite/Utopia/Response/Filters/V26.php:165

Reviewed the commits since bca29a0 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · See the inline comments. Summary

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/response-filter-v26-secrets (after).

Metric Before After Change
🚀 Requests/sec 220.39 219.48 ⚪ -0.4%
⏱️ Latency P50 78.02 ms 77.55 ms ⚪ -0.6%
⏱️ Latency P95 184.99 ms 192.13 ms ⚪ +3.9%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 77.55 192.13 13,680 219.48 +7.14
Account 157.74 288.9 720 12.09 +11.67
TablesDB 75.45 143.59 7,440 121.17 -1.48
Storage 70.28 166.08 3,600 60.83 -2.46
Functions 116.42 227.61 1,920 33.2 +13.9

Top API waits (after)

API request Max wait (ms)
account.name.update 463.51
functions.variables.update 424.12
functions.create 405.11
functions.variables.create 368.98
account.prefs.update 360.7

@ChiragAgg5k

Copy link
Copy Markdown
Member Author

On the tenki nitpick about webhook credentials: this is intended. The current webhook model makes authPassword write-only and only returns secret on creation and rotation, so the 1.9.4 project format now follows the same rule. ProjectsConsoleClientTest::testGetProject is updated to match.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@ChiragAgg5k
ChiragAgg5k merged commit 9f332f7 into main Oct 22, 2026
71 checks passed
ChiragAgg5k added a commit that referenced this pull request Oct 24, 2026
Tapraj-Pathak pushed a commit to Tapraj-Pathak/appwrite that referenced this pull request Oct 24, 2026
…26-secrets

fix(response): keep key and webhook secrets out of the 1.9.4 project format

(cherry picked from commit 9f332f7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant