Repository navigation
fix(functions): keep server credentials out of client-readable schedules - #15259
Conversation
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.
|
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.
Reviewed commit: efab56d |
🟢 Tier S · Ready to merge
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.
📂 Walkthrough · 2
Reviewed |
Security rulesNo new WARNING or ERROR findings from security rules. 6 existing findings tracked in
|
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
…credentials fix(functions): keep server credentials out of client-readable schedules (cherry picked from commit 579ba96)
What
A scheduled function execution stored the full request header set in the schedule
datapayload, including the server-minted ephemeral API key (x-appwrite-key) and the user session JWT (x-appwrite-user-jwt). That field is returned byGET /v1/projects/{projectId}/schedules(scopeschedules.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 onlyx-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::testCreateScheduledAtExecutionto read the schedule back throughGET /v1/projects/{projectId}/schedulesand assert the storeddata.headers:x-appwrite-keyx-appwrite-user-jwtx-appwrite-client-ipretainedCovered by the
FunctionsScheduleCI lane.composer lintandcomposer analyzepass locally.Reported by a Strix penetration test (medium, CVSS 5.3).
Related: appwrite-labs/cloud#6673