Move flowSecret to a request header for /flow/execute - #3808
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughThe Flow Secret for ChangesFlow Secret header migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant FlowExecHandler
participant serverconst
Client->>FlowExecHandler: POST /flow/execute with Flow-Secret header
FlowExecHandler->>serverconst: read FlowSecretHeaderName
FlowExecHandler->>FlowExecHandler: sanitize header value
FlowExecHandler-->>Client: flow execution response
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
docs/content/guides/guides/applications.mdxESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. tests/e2e/utils/authentication/admin-api-auth.tsParsing error: error TS5012: Cannot read file '/tsconfig.json': ENOENT: no such file or directory, open '/tsconfig.json'. tests/e2e/utils/server-setup/mfa-setup.tsParsing error: error TS5012: Cannot read file '/tsconfig.json': ENOENT: no such file or directory, open '/tsconfig.json'. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ThaminduDilshan
left a comment
There was a problem hiding this comment.
Don't this require a SDK change to send the flow secret in API requests? Better to merge this along with sdk bump
3b7a41b to
923b7af
Compare
Aligns the Flow Secret transport with the header-based convention used for the atomic API server-level secret. flowSecret is no longer accepted in the JSON body of POST /flow/execute; it must be presented via the X-Flow-Secret request header instead. Verification behavior is otherwise unchanged. Refs thunder-id#3795
923b7af to
6cb7988
Compare
Purpose
As part of the secured-by-default flow initiation model (parent: #2380),
flowSecretwas presented in the JSON request body ofPOST /flow/execute. In design discussion #2744, reviewers noted this is inconsistent with the server-level secret for the Direct API (atomic auth endpoints, #3762), which is sent via a request header. This PR movesflowSecretfrom the request body to a dedicatedFlow-Secretheader, aligning both mechanisms on the same transport convention.Approach
FlowSecretfield fromFlowRequest(backend/internal/flow/flowexec/model.go) and theflowSecretproperty from theInitialFlowRequestOpenAPI schema.Flow-Secretheader (serverconst.FlowSecretHeaderName) instead of the decoded request body. The service-layer verification logic (checkDirectFlowInitiationAllowed) is unchanged since it already accepted the secret as a plain string parameter.FlowSecretHeaderNametobackend/internal/system/constants/server_constants.go, alongside the other well-known request header constants.api/flow-execution.yamlwith aFlowSecretapiKey/header security scheme (mirroring theAtomicApiSecretscheme pattern) and removedflowSecretfrom the request body schema/examples.tests/integration/flow/common/utils.go,tests/integration/testutils/api_utils.go) and the Flow Secret guard suite (tests/integration/flow/authentication/flow_secret_flow_test.go) to send the secret via the header./flow/executedirectly to use the header.docs/content/guides/guides/applications.mdxto describe the header instead of the body field.Related Issues
Related PRs
X-Atomic-API-Secretheader convention this change aligns with)Flow-Secretheader on native flow initiation🔧 Summary of Breaking Changes
POST /flow/executeno longer acceptsflowSecretin the JSON request body.💥 Impact
Any caller (SDKs, samples, custom integrations) that presented
flowSecretin the request body must switch to sending it via theFlow-Secretrequest header, or flow initiation for Flow Secret-gated applications will fail with401 Unauthorized.🔄 Migration Guide
Move the
flowSecretvalue out of the JSON body and set it as theFlow-Secretrequest header instead:Checklist
make lint, unit tests, and compiled/vetted the integration test module; did not spin up a live server for an end-to-end manual pass)breaking changelabel added.Security checks
Summary by CodeRabbit
New Features
Flow-Secretrequest header.Bug Fixes
Tests