Skip to content

feat: add secret requirement contract to dynamic parameters#24785

Merged
dylanhuff-at-coder merged 4 commits into
mainfrom
split/plat-100-secret-requirements-contract
Apr 29, 2026
Merged

feat: add secret requirement contract to dynamic parameters#24785
dylanhuff-at-coder merged 4 commits into
mainfrom
split/plat-100-secret-requirements-contract

Conversation

@dylanhuff-at-coder

@dylanhuff-at-coder dylanhuff-at-coder commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Adds structured secret_requirements to dynamic parameter responses and enforces missing required secrets during workspace start.

Stop, delete, and tag rendering paths skip secret requirement enforcement so unmet secrets do not prevent cleanup. The SDK, generated API docs/types, and backend render/resolver/wsbuilder tests are updated for the new contract.

Replaces this closed PR:
#24697

@github-actions

Copy link
Copy Markdown

Docs preview

📖 View docs preview

dylanhuff-at-coder commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

@dylanhuff-at-coder
dylanhuff-at-coder force-pushed the split/plat-100-secret-requirements-contract branch from 07e4175 to 054e408 Compare April 28, 2026 15:41
@dylanhuff-at-coder

Copy link
Copy Markdown
Contributor Author

/coder-agents-review

@coder-agents-review coder-agents-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clean feature with strong test coverage (16+ new test cases, ~2:1 test-to-code ratio). The conditional secret blocks, lifecycle bypass via SkipSecretRequirements, and the non-owner privacy boundary are all well designed. The integration test that creates a workspace, deletes the secret, then verifies start fails while stop/delete succeed is the anchor of the whole change.

One P2, six P3, one P4, three Nits.

The P2 is a contract violation: autostart runs under a subject that lacks user_secret:read, so the enforcement this PR promises ("enforces missing required secrets during workspace start") silently degrades for every auto-started workspace. Five reviewers independently traced the same call chain. The fix is one line in subjectAutostart's site permissions.

The SecretRequirementDoesNotBlockStopOrDelete test is "a genuine full-stack test. Real gem." (Bisky)

Design note: non-owner admin builds (CLI/API, no WebSocket preview) silently skip secret validation. This is deliberate (privacy boundary: admin can't read target user's secrets), but CLI callers get zero indication validation was skipped. If the workspace fails at terraform time, the error is opaque. This needs a human decision on whether to surface a warning in the build response for admin callers.


coderd/dynamicparameters/render.go:311

Nit [DEREM-14] The old code had a TODO about surfacing preview parser logs:

// Do not emit parser logs to coderd output logs.
// TODO: Returning this logs in the output would benefit the caller.

Behavior is unchanged (preview@v1.0.9 nil-defaults to discard), but the comment documented a deliberate design choice and a known improvement opportunity. Four reviewers noted the loss of context. (Gon, Mafuuu, Ryosuke, Razor)

🤖

🤖 This review was automatically generated with Coder Agents.

Comment thread coderd/dynamicparameters/render.go
Comment thread coderd/wsbuilder/wsbuilder.go Outdated
Comment thread coderd/wsbuilder/wsbuilder_internal_test.go
Comment thread coderd/parameters_test.go
Comment thread codersdk/parameters.go Outdated
Comment thread coderd/dynamicparameters/render.go
Comment thread coderd/dynamicparameters/resolver_test.go
Comment thread coderd/dynamicparameters/render.go Outdated
Comment thread coderd/dynamicparameters/render.go Outdated
Comment thread coderd/dynamicparameters/render.go Outdated
Comment thread coderd/dynamicparameters/render.go Outdated
Comment thread codersdk/parameters.go Outdated
@dylanhuff-at-coder
dylanhuff-at-coder force-pushed the split/plat-100-secret-requirements-contract branch from b61307b to d2f81bc Compare April 29, 2026 17:24
@dylanhuff-at-coder
dylanhuff-at-coder merged commit fb84e72 into main Apr 29, 2026
32 checks passed
@dylanhuff-at-coder
dylanhuff-at-coder deleted the split/plat-100-secret-requirements-contract branch April 29, 2026 23:38
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants