feat: Node.js SDK update for version 24.0.0#149
Conversation
Greptile SummaryThis PR upgrades the Node.js SDK to v24.0.0, applying a set of breaking renames to the Webhook service (
Confidence Score: 5/5Safe to merge; all findings are P2 — a security documentation gap on All breaking renames are consistently applied across service implementations, model types, example docs, and tests. The new src/client.ts (getHeaders credential exposure) and src/services/webhooks.ts (update() missing secret param vs PR description)
|
| Filename | Overview |
|---|---|
| src/client.ts | Added getHeaders() method that returns a copy of all request headers including sensitive auth tokens; SDK version bumped to 24.0.0 and response format updated to 1.9.1. |
| src/services/webhooks.ts | Renamed fields (security→tls, httpUser→authUsername, httpPass→authPassword), renamed updateSignature()→updateSecret(), added optional secret to create() but update() still lacks this parameter despite the PR description claiming it was added to both. |
| src/services/project.ts | New service: full CRUD for API keys, platforms (Android/Apple/Linux/Web/Windows), protocol/service status endpoints, and project variables; all parameter overloads follow established patterns correctly. |
| src/models.ts | Added new models: Project, Key, KeyList, DevKey, MockNumber, AuthProvider, platform types, PlatformList, BillingLimits, Block; Webhook fields renamed; Log gains userType field. |
| src/enums/scopes.ts | Added KeysRead, KeysWrite, PlatformsRead, PlatformsWrite scopes to support the new Project key/platform endpoints. |
| src/index.ts | Exports new Project service and new enums (PlatformType, ProtocolId, ServiceId); all other new models are accessible via the Models namespace. |
| .github/workflows/publish.yml | Updated to Node.js 24.14.1 and pinned npm to 11.10.0 for trusted publishing provenance; permissions and publish command are correct. |
Comments Outside Diff (1)
-
src/client.ts, line 193-197 (link)getHeaders()returns sensitive credentials verbatimThis method returns a shallow copy of
this.headers, which includesX-Appwrite-Key,X-Appwrite-JWT,X-Appwrite-Session, and other auth tokens set viasetKey(),setJWT(),setSession(), etc. Any caller who inadvertently passes the result toconsole.log, an error-reporting SDK, or an HTTP response body will leak live credentials.The docstring says "Handle with care," but that warning is easy to overlook. Consider redacting known sensitive header names before returning, or at minimum listing them explicitly in the JSDoc so callers know what they're receiving:
/** * … * The returned copy contains authentication headers such as * `X-Appwrite-Key`, `X-Appwrite-JWT`, and `X-Appwrite-Session`. * Never log or transmit these values to untrusted parties. */ getHeaders(): Headers { return { ...this.headers }; }
Reviews (1): Last reviewed commit: "chore: update Node.js SDK to 24.0.0" | Re-trigger Greptile
| * @returns {Promise<Models.Webhook>} | ||
| */ | ||
| update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, security?: boolean, httpUser?: string, httpPass?: string }): Promise<Models.Webhook>; | ||
| update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise<Models.Webhook>; |
There was a problem hiding this comment.
Webhooks.update() is missing the secret parameter
The PR description states "Added secret parameter to Webhook create and update methods." create() correctly includes the optional secret parameter, but the update() signature does not. If the Appwrite v24 API's PUT /webhooks/{webhookId} endpoint accepts a secret field (consistent with create()), omitting it here means callers cannot update the secret through the standard update path and must rely solely on updateSecret().
If omitting secret from update() is an intentional design choice (i.e., secrets can only be set at creation or rotated via updateSecret()), the example file docs/examples/webhooks/update.md and the PR description should be updated to clarify this. If it was an oversight, the parameter and its payload assignment should be added here to match create().
This PR contains updates to the Node.js SDK for version 24.0.0.
What's Changed
security→tls,httpUser→authUsername,httpPass→authPassword,signatureKey→secretsecurity→tls,httpUser→authUsername,httpPass→authPasswordWebhooks.updateSignature()toWebhooks.updateSecret()with new optionalsecretparameterClient.getHeaders()method to retrieve request headerssecretparameter to Webhook create and update methodsxOAuth provider toOAuthProviderenumuserTypefield toLogmodelpurgeparameter toupdateCollectionandupdateTablefor cache invalidationKey,KeyList,Project,DevKey,MockNumber,AuthProvider,PlatformAndroid,PlatformApple,PlatformLinux,PlatformList,PlatformWeb,PlatformWindows,BillingLimits,BlockPlatformType,ProtocolId,ServiceIdBuildRuntime,Runtimeenums withdart-3.11andflutter-3.41Scopesenum withkeysRead,keysWrite,platformsRead,platformsWriteX-Appwrite-Response-Formatheader to1.9.1