Skip to content

fix(functions): keep server credentials out of client-readable schedules - #15259

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/schedule-strip-ephemeral-credentials
Nov 3, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/schedule-strip-ephemeral-credentials

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

What

A scheduled function execution stored the full request header set in the schedule data payload, including the server-minted ephemeral API key (x-appwrite-key) and the user session JWT (x-appwrite-user-jwt). That field is returned by GET /v1/projects/{projectId}/schedules (scope schedules.read), so a caller holding only that scope could read live credentials for the project.

This strips every reserved x-appwrite-* header from the set before it is persisted, keeping only x-appwrite-client-ip — the one value the worker reads back from the schedule.

Why it is safe

The worker re-mints every reserved header when the schedule fires (src/Appwrite/Platform/Workers/Functions.php:617-631): the ephemeral API key, the user JWT and the user id are all regenerated, overwriting whatever was stored. Only the client IP is consumed from the stored data, and it is preserved. No functionality depends on the stored credential copies.

Test

Extended FunctionsScheduleTest::testCreateScheduledAtExecution to read the schedule back through GET /v1/projects/{projectId}/schedules and assert the stored data.headers:

  • no x-appwrite-key
  • no x-appwrite-user-jwt
  • x-appwrite-client-ip retained
  • the caller's own custom header preserved

Covered by the FunctionsSchedule CI lane. composer lint and composer analyze pass locally.

Reported by a Strix penetration test (medium, CVSS 5.3).

Related: appwrite-labs/cloud#6673

A scheduled execution stored the full request header set in the schedule
`data`, including the server-minted ephemeral API key and the user session
JWT. That field is returned by GET /v1/projects/{projectId}/schedules, so a
schedules.read caller could read live credentials. The worker re-mints every
reserved x-appwrite-* header when the schedule fires, so strip them before
storing and keep only the client IP the worker reads back.
@luxor-code-review

luxor-code-review Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


The change updates the scheduled-execution creation flow so request headers are filtered before they are stored in schedule documents, preventing client-provided headers from being persisted wholesale. An e2e test was added for the FunctionsSchedule service to cover the behavior. All scans (correctness, security, secrets-hygiene domain, holistic, and a full sweep) came back clean; both raw sweep candidates were refuted against the source.

Files Change
src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php Filters request headers before storing schedule data.
tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php Adds e2e coverage for scheduled executions.

Reviewed commit: efab56d

@appwrite

appwrite Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The schedule persistence filter matches the worker's reserved-header handling, and no concrete behavioral defect was found.

Scheduled function executions now persist only non-reserved request headers plus the client IP, rather than storing generated Appwrite credential headers in schedule data. The schedule e2e test reads the persisted schedule and checks both header filtering and preservation of caller headers.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php Filters reserved Appwrite headers from the persisted schedule data while retaining the client IP.
tests/e2e/Services/FunctionsSchedule/FunctionsScheduleTest.php Reads the created schedule and verifies credentials are absent and required/custom headers remain.

Reviewed efab56d · Details · Comment @appwrite review to re-run, or mention @appwrite with a question.

@appwrite appwrite Bot 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

github-actions Bot commented Nov 3, 2026

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.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/schedule-strip-ephemeral-credentials (after).

Metric Before After Change
🚀 Requests/sec 197.16 177.69 🔴 -9.9%
⏱️ Latency P50 86.22 ms 98.35 ms 🔴 +14.1%
⏱️ Latency P95 210.58 ms 225.8 ms 🔴 +7.2%
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 98.35 225.8 11,400 177.69 +15.22
Account 181.79 334.85 600 10.05 +17.26
TablesDB 94.75 171.78 6,200 99.05 +19.74
Storage 91.26 208.35 3,000 49.32 +14.47
Functions 139.79 265.65 1,600 26.97 -23.9

Top API waits (after)

API request Max wait (ms)
account.name.update 496.83
account.prefs.update 473
functions.delete 462.19
functions.variables.update 444.37
functions.variables.create 437.62

@ChiragAgg5k
ChiragAgg5k merged commit 579ba96 into main Nov 3, 2026
39 checks passed
@ChiragAgg5k ChiragAgg5k self-assigned this Nov 4, 2026
ChiragAgg5k added a commit that referenced this pull request Nov 12, 2026
…credentials

fix(functions): keep server credentials out of client-readable schedules

(cherry picked from commit 579ba96)
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