Feat: ConfigMap-driven workflow HTTP denylist and SSRF hardening - #235
Feat: ConfigMap-driven workflow HTTP denylist and SSRF hardening#235roguepikachu wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 13 files
Tip: instead of fixing issues one by one fix them all with cubic
Re-trigger cubic
3910b2d to
933aca6
Compare
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (27.01%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## main #235 +/- ##
===========================================
- Coverage 62.49% 24.70% -37.80%
===========================================
Files 62 68 +6
Lines 4415 5510 +1095
===========================================
- Hits 2759 1361 -1398
- Misses 1324 3884 +2560
+ Partials 332 265 -67
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
All reported issues were addressed across 13 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
9acd124 to
b77515e
Compare
16f14aa to
ba58efb
Compare
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
43b237b to
4436c7d
Compare
Move outbound HTTP guard and gate logic into workflow provider, add disable/private-block feature gates, and expose toggles via the vela-workflow Helm chart. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Support CIDR/IP/hostname/wildcard deny entries, load and watch deny policy from a namespaced ConfigMap, and enforce host plus dial-time blocks in workflow HTTP provider and chart wiring. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Cache client is not ready before mgr.Start, so initial denylist load must use the API reader. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Always dial through Control validation instead of delegating to a preset DialContext, wrap custom DialTLSContext hooks, reject port-qualified deny hosts, normalize trailing-dot FQDNs and IPv6 zone IDs, and reset global deny state in tests. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Rename unused controlFunc network parameter to satisfy revive, and add unit tests for denylist reload handlers, policy edge cases, controller namespace resolution, and BlockPrivateHTTPAddresses HTTP gating. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Extract configureWorkflowHTTPDeny for cmd tests and cover watchAndReload informer registration paths so codecov patch clears the 70% threshold. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Disable inherited HTTP proxy on guarded transport, copy ExactHosts map in MergeDeny to avoid mutating caller state, and reject denylist entries with paths, schemes, ports, or whitespace at parse time. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
The HTTP deny wiring was extracted to cmd/http_deny.go for unit tests, but Dockerfiles only copied cmd/main.go so image builds failed with an undefined configureWorkflowHTTPDeny symbol. Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com>
Ship a reusable ConfigTemplate so denylist entries can be validated while preserving the existing ConfigMap contract and live reload behavior. Signed-off-by: roguepikachu <65535504+roguepikachu@users.noreply.github.com>
4436c7d to
b2ce418
Compare
Description of your changes
Adds ConfigMap-driven HTTP denylist support on top of the default private-address / SSRF hardening for workflow HTTP requests (
request/ providerhttp).Controllers can load a denylist ConfigMap (
denyHosts,denyCIDRs) at startup, watch it for updates, and fail closed on missing/invalid ConfigMaps when the flag is set. Also includes a startup fix so the initial load uses the API reader instead of the cache client (cache is not ready beforemgr.Start).Helm wiring:
workflow.disableWorkflowHTTPworkflow.blockPrivateHTTPAddressesworkflow.httpDeny.configMapNameI have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
pkg/utils/httpguardand HTTP provider deny-host paths.fix/ssrf-workflow-http-guard): controllers Ready, ConfigMap reload logged, WorkflowRun tohttp://blocked.example.com/pathfailed withblocked SSRF host: blocked.example.com.Special notes for your reviewer
release-0.6backport for KubeVela 1.9v0.6.3-0.20250717221743-56b80cee4121)Summary by cubic
Adds default SSRF hardening for workflow HTTP requests with a ConfigMap-driven denylist and strict provider-level enforcement, plus Helm feature gates and a validated CUE
ConfigTemplate. Also fixes Docker image builds by including the new HTTP deny wiring.New Features
pkg/utils/httpguard: blocks link-local and cloud-metadata by default; pre-checks URL host and revalidates redirects; always validates dials (overridesDialContext, wraps customDialTLSContext) vianet.Dialer.Control; disables inherited HTTP proxy; normalizes trailing-dot FQDNs and IPv6 zone IDs; parser rejects schemes/ports/paths/whitespace.denyCIDRs,denyHosts, supports*.suffix): loaded at startup via API Reader; hot-reloaded; startup fails closed on missing/invalid; later invalid updates keep last good. Configured via--workflow-http-deny-configmap-name; controller namespace fromPOD_NAMESPACE(defaults tovela-system).pkg/providers/http):SecureTransportenforces policy;DisableWorkflowHTTPblocks all requests;BlockPrivateHTTPAddressesadds RFC1918/ULA blocking; URL host and each redirect are revalidated. Helm values:workflow.disableWorkflowHTTP,workflow.blockPrivateHTTPAddresses,workflow.httpDeny.configMapName.charts/vela-workflow/config-templates/workflow-http-deny.cuewith usage inconfig-templates/README.md; raw ConfigMap remains supported.Bug Fixes
cmd/http_deny.goand build from./cmdto fix image build failures.Written for commit b2ce418. Summary will update on new commits.