Files
windmill/backend/tests
Ruben Fiszel 2d24b3ac49 fix(jobs): enforce self_approval_disabled on the UI resume path (#10262)
* fix(jobs): enforce self_approval_disabled on the UI resume path

The "Resume" button in the run detail UI calls the resume_suspended endpoint,
whose owner shortcut skipped the approval-condition checks entirely. A flow
owner/operator who triggered the run could therefore self-approve despite
self_approval_disabled, unlike the owner endpoint which enforces it. Only
admins should bypass self-approval.

- Extract require_not_self_approval and enforce it before the owner shortcut in
  resume_suspended and can_approve_step (button visibility), matching
  resume_suspended_flow_as_owner.
- Persist approval_conditions when self_approval_disabled is set even without
  user_auth_required, so the restriction is not silently dropped at the resume
  boundary for raw-flow/CLI authors.

Fixes WIN-2223

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(jobs): keep self-approval capability-based on the secret path; docs/tests

Scope the self_approval_disabled enforcement to identity-based resume boundaries
only. Possession of the full HMAC resume URL is the authorization on the secret
path (the URL is disclosed only to intended approvers, e.g. when a step returns
it), so resume_suspended_job intentionally keeps skipping approval conditions and
token-only (anonymous) resumes on resume_suspended are not gated either. The
logged-in owner/operator self-approval fix stays.

- Add extract_approval_conditions helper (WAC vs classic) reused in resume_suspended.
- Update can_approve_step doc to reflect that self_approval_disabled bars the
  triggerer before the owner shortcut (codex nit).
- Reword new test comments to state the invariant, not prior behavior (codex nit).
- Add test_self_approval_disabled_without_user_auth_required covering the
  persistence + authenticated self-approval check for a non-owner triggerer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 16:52:46 +02:00
..