Skip to content

[codex] Validate workflow response token#2797

Open
caydyan wants to merge 1 commit into
stakwork:masterfrom
caydyan:codex/validate-workflow-response-token
Open

[codex] Validate workflow response token#2797
caydyan wants to merge 1 commit into
stakwork:masterfrom
caydyan:codex/validate-workflow-response-token

Conversation

@caydyan

@caydyan caydyan commented Jun 13, 2026

Copy link
Copy Markdown

Summary

  • Gate POST /workflows/response with the SWWF_RESKEY environment token before processing the response body.
  • Accept x-api-token, x-swwf-reskey, or Authorization: Bearer ... so the endpoint can work with existing project header conventions while satisfying the token-header requirement.
  • Return 500 when the server token is not configured and 401 when the request token is missing or invalid.
  • Add workflow response token validation coverage and refresh the generated Database mock with GetBountyByUnlockCode so the handlers package compiles.

Fixes #1930

Validation

  • go test ./handlers -run '^TestHandleWorkflowResponseTokenValidation$' -count=1\n- go test ./routes -run 'TestWorkflowRoutes' -count=1\n- go test ./... -run TestNonExistent -count=0\n\n## Note\n- go test ./handlers -run 'TestHandleWorkflowResponse|TestHandleWorkflowResponseTokenValidation' -count=1 requires the local test Postgres on localhost:5532; in this environment it failed with connection refused after the package compiled.

@caydyan caydyan marked this pull request as ready for review June 13, 2026 23:17
@caydyan

caydyan commented Jun 14, 2026

Copy link
Copy Markdown
Author

Current-head validation rerun on 0db528d:

  • go test ./handlers -run TestHandleWorkflowResponseTokenValidation -count=1 -v passed, including all 5 token-validation subtests.
  • go test ./... -run ^$ passed as a compile/no-test package sweep.
  • git diff --check origin/master...HEAD passed.

I also attempted broader go test ./handlers -run Test.*Workflow -count=1 -v; it is blocked locally by the documented test Postgres not running on localhost:5532. Docker is installed here, but the daemon API returns 500 on docker ps, so I could not start docker/testdb-docker-compose.yml in this environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

endPoint authentication confirm token header (env.SWWF_RESKEY)

1 participant