Feat: ConfigMap-driven workflow HTTP denylist and SSRF hardening

Merged
RO
3mo ago
+2296-5

Description of your changes

Hardens workflow HTTP (request / provider http) against SSRF, with a default denylist on install and an operator-friendly path to extend it later.

Day 1 (plain Helm install)

helm install workflow kubevela/vela-workflow -n vela-system

With default values, users get SSRF protection without extra setup:

  1. Controller discovers ConfigMaps labeled config.oam.dev/type=vela-workflow-http-deny
  2. Chart installs ConfigTemplate config-template-vela-workflow-http-deny
  3. Chart installs labeled ConfigMap vela-workflow-http-deny-default
  4. Binary also ships the same floor as Go constants in BuiltinDeny(), so empty discovery or deleting the default ConfigMap cannot open SSRF

Per-chart ownership (dual install with kubevela): each chart owns its own ConfigTemplate and default deny ConfigMap so Helm installs do not conflict on those objects:

ChartConfigTemplateDefault ConfigMapDiscovery label / flag
vela-workflowconfig-template-vela-workflow-http-denyvela-workflow-http-deny-defaultvela-workflow-http-deny
vela-coreconfig-template-vela-core-http-denyvela-core-http-deny-defaultvela-core-http-deny

Uninstalling one release leaves the other's template and default CM intact.

Blocked by default (cloud metadata / link-local):

EntryPurpose
metadata.google.internalGCP metadata hostname
169.254.0.0/16Link-local / AWS IMDS (169.254.169.254)
fe80::/10IPv6 link-local
fd00:ec2::254AWS IMDS IPv6
100.100.100.200Alibaba metadata

Still allowed by default: in-cluster ClusterIP/pod traffic and public destinations.

Where the defaults live:

LayerLocationRole
Helm valuesworkflow.httpDeny.defaultConfig.*What the chart ships
Cluster objectConfigMap/vela-workflow-http-deny-defaultEditable, discovered at runtime
Binary floorpkg/utils/httpguard/defaults.go (BuiltinDeny consts)Always-on failsafe

Enforcement is dial-time (resolved IP via net.Dialer.Control), plus host checks on the URL and redirects. A blocked call fails the step with blocked SSRF host / blocked SSRF target.

Day 2 (operators extend or tighten)

Add more denials (unioned with defaults; hot-reloaded). Use the chart's template name:

vela config create team-http-deny \
  --template vela-workflow-http-deny \
  --namespace vela-system \
  'denyHosts={*.evil.example}' \
  'denyCIDRs={10.0.0.0/8}'

Raw labeled ConfigMaps work the same way if they carry config.oam.dev/type=vela-workflow-http-deny. For vela-core Application workflows, use vela-core-http-deny instead.

Optional Helm toggles:

ValueDefaultEffect
workflow.httpDeny.configTemplateNamevela-workflow-http-denyLabel used for discovery ("" disables discovery)
workflow.httpDeny.defaultConfig.enabledtrueShip the default labeled ConfigMap
workflow.blockPrivateHTTPAddressesfalseAlso block RFC1918 + IPv6 ULA (breaks most ClusterIP calls)
workflow.disableWorkflowHTTPfalseBlock all workflow outbound HTTP

blockPrivateHTTPAddresses uses Go ip.IsPrivate() (10/8, 172.16/12, 192.168/16, fc00::/7). It is off by default so legitimate in-cluster request steps keep working. Link-local/metadata stay covered by the Day 1 floor either way.

Implementation notes

  • Feature gates: DisableWorkflowHTTP, BlockPrivateHTTPAddresses
  • Startup load uses API Reader (cache is not ready before mgr.Start), then hot-reload on create/update/delete
  • ConfigTemplate stamps discovery labels on output ConfigMaps; parameter defaults stay empty lists so vela config-template apply OpenAPI schema generation keeps working
  • Chart rewrites the shipped CUE discovery label to match configTemplateName; empty name skips installing the template/default ConfigMap

I have:

  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

  • Unit tests for pkg/utils/httpguard, ConfigMap discovery/aggregation, and HTTP provider deny paths
  • Live k3d install-order matrix (ssrf-matrix): kubevela alone, workflow alone, kubevela→workflow, workflow→kubevela for the deny ConfigTemplate/CM ownership; WorkflowRun and Application request steps to IMDS are blocked
  • Live DisableWorkflowHTTP=true on both controllers: in-cluster request steps fail with workflow outbound HTTP is disabled by DisableWorkflowHTTP feature gate for WorkflowRun and Application

Special notes for your reviewer

  • Merge this first. KubeVela main and release backports need a published workflow revision that includes these commits.
  • Companion KubeVela PR (fix/ssrf-workflow-http-guard) mirrors the ConfigTemplate, Helm defaults, and controller flag wiring, and will pin the published workflow SHA after this lands.
  • Related release follow-ups after this is tagged as needed:
    • release-0.6 backport for KubeVela 1.9
    • pin-based branch for KubeVela 1.10 (v0.6.3-0.20250717221743-56b80cee4121)