Repository navigation
Ask for a template's required secrets when installing it - #354
Merged
tnkuehne merged 3 commits intoNov 23, 2026
Merged
Conversation
This was referenced Nov 23, 2026
A template whose wrangler.jsonc requires secrets is installed with their values. The install checks before building that every required value and no other is provided. The values are saved with the app's first deployment, under the same app lock and with the same authorization and limits as a secret edit, so they never reach a deployment that someone else made while the template was building. - The template detail lists requiredSecrets, which catalog templates show prints. - The template page asks for each value in a password field and enables Install once all are filled. - widefleet catalog templates install reads values with --secret-file NAME=PATH. - The secret status reports the secrets the latest deployment requires. The Secrets page lists unset ones as missing with a shortcut to set them and marks set ones as required; widefleet secret list prints the missing names.
On Cloudflare a deployment is accepted after the upload transaction, so saving the install's secrets there let another deployment of the draft app, prepared meanwhile, receive them, and left them saved when Cloudflare rejected the install. The hosted deployment command now carries the encrypted values and claims the app's first deployment. Recording the accepted deployment saves them under the app lock, in the same transaction, and a deployment recorded earlier rejects the install without saving anything. The operation history keeps the command without the values. Agent installations keep saving them in the transaction that accepts the deployment.
Cloudflare can accept an older request after a newer one, so request times do not order hosted deployments. The secret status now follows the order in which deployments were accepted, as secret refreshes do, and request times where there is none.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | 65b93e0 | Nov 23 2026, 05:54 PM |
tnkuehne
force-pushed
the
feat/required-secrets-install
branch
from
November 23, 2026 17:53
e210dae to
65b93e0
Compare
tnkuehne
added a commit
that referenced
this pull request
Nov 23, 2026
## Problem Wrangler's `secrets.required` declares the secrets a Worker cannot run without. Widefleet rejects unknown Wrangler keys, so a project that uses the key cannot be deployed, and a deployment cannot record which secrets its code needs. ## Change **`widefleet deploy` and the template builder accept `secrets.required`.** - The format follows [Cloudflare's configuration reference](https://developers.cloudflare.com/workers/wrangler/configuration/): `"secrets": { "required": ["API_KEY"] }`. - Names follow the contract's rules: valid secret names, without the reserved `WIDEFLEET_` prefix or `__proto__`, unique, at most 128, and different from every binding and variable, including the `ASSETS` binding every deployment gets. The CLI and the builder report a mistake before building. **Template installs validate the build before creating the app.** A template whose build the upload would reject now fails without leaving an app behind. **Each deployed version carries its list.** - The deployment metadata stores it as `required_secrets`, so every stored version, including one a rollback selects, keeps its own list. - The control plane validates the list again. Runtimes do not receive it. The next PRs in this stack check the list when deploying (#353), ask for the values when installing a template (#354), and declare the list in the templates that need their organization's OAuth client (#355). ## Tests - CLI unit test for parsing and every validation rule, including `__proto__`, 129 names and `ASSETS` without an `assets` key. - Builder test for the metadata it produces and its validation errors, with the same cases (`RUN_BUILDER_TESTS=1`). - Integration test: a template build with an undeployable list fails before the app exists. - Contract tests for the metadata, including that runtimes do not receive the list. - Ran `pnpm check`, the unit and integration suites, `cargo clippy --workspace` and the CLI Rust tests. Stack: #352 (this PR) → #353 → #354 → #355. The docs follow in #356. <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=116868847&sig=8186589490fcb6f27be9c10c3a9940bc27064ec179368c3f1891dcb21edb80df"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=mendra&next=%2Fwidefleet%2Fwidefleet%2Fpull%2F352&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> This PR appears safe to merge; both previous findings are fixed and no new actionable issues were found. <details open><summary><h3>Summary</h3></summary> Carries Wrangler's `secrets.required` into each deployment as `required_secrets`, while keeping it out of runtime metadata. - CLI deployments carry Wrangler's required secret names into their metadata. - Template builds carry Wrangler's required secret names into bundle metadata. - The control plane keeps required secret names with each version and leaves them out of runtime metadata. </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (2) · Last reviewed commit: ["Validate a template's build before creat..."](75571e6) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub> <!-- /greptile_comment -->
tnkuehne
added a commit
that referenced
this pull request
Nov 23, 2026
## Problem A version that declares required secrets still deploys when the app does not have them, so the app starts without its credentials. ## Change **Deployments and rollbacks fail while the app lacks a secret the version requires.** - The error lists every missing name, as `wrangler deploy` does: `The following required secrets have not been set: API_KEY, API_SECRET.` It points to the app's Secrets page and `widefleet secret put`. - The check runs where every deployment is queued: CLI and API uploads, template installs, previews and rollbacks, for agent and Cloudflare executions alike. - A rollback checks the list of the version it selects. **Secret edits keep working.** - Changing or deleting a secret redeploys the selected code without the check, so a required secret can be deleted, as Cloudflare allows. The app's code reports its missing setup until the secret is set again. **Differences from Wrangler.** - `widefleet deploy` creates a new app before uploading, so the first deployment of a new app fails after the app exists. Set its secrets and deploy again, or create it first with `widefleet create`. Wrangler fails before creating the Worker. - Previews are separate apps with their own secrets, so a preview needs the required secrets set on it. ## Tests - Integration test: a deployment without both secrets lists both, then the remaining one; it succeeds once both are set; deleting a required secret is allowed; a rollback to the version is rejected through the API with the missing name until the secret is set again. - Ran `pnpm check` and the unit and integration suites. - Not run: the container runtime suites. The Cloudflare suite ran on #354, which includes this change. Stack: #352 → #353 (this PR) → #354 → #355. The docs follow in #356. <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=116868905&sig=0a90f4561e35c8039a6c3e0790389f3ed107d0ea2df43d6a05233adfa0005d11"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=mendra&next=%2Fwidefleet%2Fwidefleet%2Fpull%2F353&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> The PR appears safe to merge, with template secret input supplied by dependent PR #354. <details open><summary><h3>Summary</h3></summary> Deployments and rollbacks now reject versions whose required secrets are missing. Errors list the missing names and explain where to set them. - Deployments and rollbacks stop when their selected version needs missing secrets. </details> <details open><summary><h3>Diagram</h3></summary> ```mermaid %%{init: {'theme': 'neutral'}}%% flowchart TD A[Upload or rollback] --> B[Read selected version] B --> C{Required secrets present?} C -->|No| D[Return missing names] C -->|Yes| E[Queue agent or hosted deployment] F[Secret edit] --> G[Redeploy selected code without required-secret check] G --> E ``` </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (2) · Last reviewed commit: ["Reject deployments and rollbacks without..."](39782a2) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub> <!-- /greptile_comment -->
tnkuehne
added a commit
that referenced
this pull request
Nov 23, 2026
#355) ## Problem The Gmail, Google Calendar, Google Sheets, Google Drive, WHOOP and Strava templates cannot connect accounts without the organization's own OAuth client, but nothing asks for it when installing. The app deploys and reports `setup_required` until an administrator finds the Secrets page. ## Change **These templates require their OAuth client.** - Each `wrangler.jsonc` lists the client ID and secret under `secrets.required`: `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET`, `WHOOP_CLIENT_ID` and `WHOOP_CLIENT_SECRET`, `STRAVA_CLIENT_ID` and `STRAVA_CLIENT_SECRET`. - Installing from the template page or the CLI asks for the values, and deploying without them fails with their names. - Templates with a managed client (Outlook, OneDrive, Excel, Teams, GitHub, Linear) and Garmin Connect, whose users bring their own keys, keep optional secrets. **The templates still handle a deleted secret.** They keep reporting `setup_required`, and their connect page now asks the administrator to set the secrets on the app's Secrets page. **`template.md` follows the new order.** - Deploying a copy creates the app, sets both secrets with `widefleet secret put` and then runs `widefleet deploy`. - The setup steps say that installs ask for the values, and that the provider's redirect URL or callback domain can be added once the app's URL is known. ### Screenshots The Gmail template page now asks for both values before installing (1280 px, light): <img src="https://gist.githubusercontent.com/tnkuehne/0ac26ce32c2037ae89a7e23f9f9ae198/raw/6742d313e346ee88719a8ff56f49044b2a232540/compare-template-install-1280-light.png" alt="Gmail template page before and after" width="840"> The Secrets page shots are in #354. Not checked visually: the other five template pages, which use the same form. ## Tests - A browser test installs Gmail from its page, checks that Install waits for both password fields, that both secrets are saved encrypted, and that the Secrets page marks them as required. It removes one, checks that it is listed as missing, and sets it again through **Set value**. - The template install integration tests install Gmail with its secrets, and check that an install raced by another deployment leaves that app's secrets unchanged. - Ran `pnpm check`, the unit and integration suites, each changed template's tests and the browser test. - Not run: the container runtime suites. The Cloudflare suite ran on #354. Stack: #352 → #353 → #354 → #355 (this PR). The docs follow in #356. <!-- greptile_comment --> <!-- greptile_summary --> <h2><a href="https://app.greptile.com/api/retrigger?id=116868985&sig=77c5cca5d263520146b5239cfce7e6cc935679b4d72cae0f37f1ef1cc9cd1d08"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=mendra&next=%2Fwidefleet%2Fwidefleet%2Fpull%2F355&utm_source=greptile_review&utm_medium=github&utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 5/5</h2> <!-- greptile-impact-verdict --> The PR appears safe to merge; no new actionable issues were found. <details open><summary><h3>Summary</h3></summary> Requires OAuth client secrets for Gmail, Google Calendar, Google Drive, Google Sheets, WHOOP and Strava. - Six OAuth templates ask for provider credentials before deployment. - Connection pages tell admins where to restore missing OAuth keys. - Setup guides put app creation and OAuth keys before deployment. </details> <!-- greptile_confidence_score:5 --> <sub>Reviews (3) · Last reviewed commit: ["Find the setup prompt in its own section..."](48691a1) · [Reviewed by Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub> <!-- /greptile_comment -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A template whose code requires secrets cannot be installed in one step: the install deploys before anyone can set the secrets, so the deployment fails. The template page, CLI and API also do not say which secrets a template needs.
Change
Template installs take the values of the required secrets.
wrangler.jsoncrequires has a value, and that no other secret is given.secretsin the install request.widefleet catalog templates install ID --secret-file NAME=PATHreads each value from a file, aswidefleet secret put --filedoes, and sendssecretsonly when given.The template detail lists
requiredSecrets.widefleet catalog templates showprints them for agents.The template page asks for each value.
The secret status reports what the deployed code requires.
requiredlists the secrets of the latest accepted deployment's version, in Cloudflare's acceptance order on Cloudflare.widefleet secret listprints the missing names.Screenshots
Gmail with its two required secrets (declared in #355), 1280 px, light.
GOOGLE_CLIENT_IDsetFilled form: 1280 light. Narrow and dark: template 390 (before), missing 390 (before), required 390 (before), template 1280 dark (before), missing 1280 dark (before), required 1280 dark (before).
The after shot of the missing secret shows Skip to content because the keyboard focus followed the previous action. The before Secrets page shows two deployments because saving each secret redeployed the installed app.
Checked: desktop and 390 px in light and dark without horizontal scrolling, Install disabled until every value is filled, the install through to the Secrets page, removing a required secret and setting it again with Set value.
Not checked visually: an install whose template changed its required secrets after the page loaded (the server rejects it and lists the missing names), a secret name long enough to wrap, and the pages on a Cloudflare installation.
Tests
requiredand out ofnames.wrangler.json, and the CLI request body and--secret-fileerrors (RUN_CLI_TESTS=1).pnpm check, the unit and integration suites, the CLI Rust tests and the Cloudflare suite (RUN_CLOUDFLARE_TESTS=1).Stack: #352 → #353 → #354 (this PR) → #355. The docs follow in #356.


Confidence Score: 5/5
The PR appears safe to merge; both previous findings are fixed and no new blocking issue was found.Summary
Adds required secrets to template details and accepts their values during installation.
Both previous findings are addressed. No new actionable issues were found. Tests and browser checks were not run during this review.
Diagram
sequenceDiagram actor Installer participant Install participant Builder participant Publish participant Cloudflare participant Database Installer->>Install: Required secret values Install->>Install: Check missing and extra names Install->>Builder: Build template sources Builder-->>Install: Worker and metadata Install->>Publish: Worker and encrypted values Publish->>Cloudflare: First-deployment command Cloudflare->>Database: Lock app and check deployment history alt App has no deployment Cloudflare->>Database: Save values and record deployment together else Another deployment exists Cloudflare-->>Installer: Reject without saving values endReviews (2) · Last reviewed commit: "Report the required secrets of the deplo..." · Reviewed by Greptile