Offer business logic scanning on Self-Managed
Problem
Business logic scanning (the bl_security foundational flow) is offered on GitLab.com and on GitLab Dedicated, but not on GitLab Self-Managed.
Three things block it on Self-Managed:
- The flow's
available_ondoes not list:self_managed. A validation also refusesself_managedtogether withdedicated_enabled_instances. - The flow only runs on GitLab-hosted runners, and Self-Managed has none.
- Rails never checks whether GitLab enabled the instance. The Duo Workflow Service refuses
bl_securityfor any instance it has not enabled. Listing the flow alone would show it, then fail every run.
Impact
Self-Managed Ultimate customers can run business logic scanning with the default model once GitLab enables their instance.
Enabling a customer is an ops change, not code: their instance UUID goes under bl_security in the Duo Workflow Service's DUO_WORKFLOW_AUTH__ENABLED_FLOW_INSTANCE_UIDS (with DUO_WORKFLOW_AUTH__ENFORCE_FLOW_ENABLEMENT on). This is the same path Dedicated uses.
| Case | Today on master | With this MR |
|---|---|---|
| Self-Managed, instance enabled by GitLab, both flags + instance beta setting on | Hidden | Available; findings reach the MR widget and Vulnerability Report |
| Self-Managed, instance not enabled | Hidden | Hidden; starting a run returns 403 |
Self-Managed, bl_security_analyzer flag or instance beta setting off |
Hidden | Hidden |
Self-Managed, instance enabled, agentic_analyzer_security_ingestion off |
Hidden | BLSA runs; findings are not ingested into the MR widget, Vulnerability Report or approval policies |
| Self-Managed runner | None accepted | Instance or top-level group runner with the gitlab--duo tag |
| GitLab.com (regression row) | Available | Unchanged |
| Dedicated, enabled / not enabled (regression row) | Available / hidden | Unchanged |
What changes
- Availability:
bl_securitylists:self_managed. On Self-Managed it uses the same per-instance gate as Dedicated (per_instance_gate_applies?). It is available only where GitLab enabled the instance, plus thebl_security_analyzerflag and the instance beta setting. On Dedicated, enablement still stands in for the flag. - Findings ingestion: where the per-instance gate applies,
Security::AgenticAnalyzer.enabled?also needs the flow enabled, checked on the top-level group. On Self-Managed theagentic_analyzer_security_ingestionflag still applies. Only Dedicated skips it, because feature flags can't be set there (FoundationalFlow#enablement_replaces_feature_flags?). - Runners: new
FoundationalFlow#gitlab_hosted_runner_required?is false on Self-Managed.RunnerValidatorthen accepts the customer's instance or top-level group runners. The job still uses GitLab's pinned image andduobinary. The trustedflow_config_idclaim follows the same rule, so Self-Managed jobs never carry it. - Validation: drops the branch that refused
self_managedwithdedicated_enabled_instances. Any flow may now list both. - Naming:
opted_in_on_dedicated?becomesbeta_opted_in?, since it now also runs on Self-Managed. - Docs: Self-Managed added as an offering, with its prerequisites.
New network call
A Self-Managed instance with the beta setting and the flag on now asks the AI gateway which flows GitLab enabled for it (EnabledFlowsClient, GET /v1/flows/enabled).
- The flag is checked first, so instances with either setting off make no call.
- Answers are cached for 30 minutes. Failures keep the last good answer for up to a day, otherwise the flow stays off.
- Instances with an offline cloud license skip the call.
- Shipped Self-Managed versions depend on the endpoint path, the
enabled_flowskey and theduo_agent_platformtoken scope.
Backward compatibility
- Only
bl_securitychanges. It is the only flow that setsgitlab_hosted_runner_onlyor listsdedicated_enabled_instances.RunnerValidatorand the removed validation cannot change any other flow. - GitLab.com and Dedicated: unchanged, covered by existing and new regression rows.
AgenticAnalyzer.enabled?consumers (ingestion, MR widget comparison, policy sync): on Dedicated it now passes the top-level group, not:instance. The Dedicated path ignores the actor, so nothing changes.FeatureSetting.allowed_featureson Self-Managed: now matches Dedicated. An enabled instance with the beta setting and thebl_security_analyzerflag on getsbl_securitywithout a separate testing-terms acceptance.- Group selections: a group that selected the flow keeps it when the instance is not enabled, as on Dedicated. The flow just doesn't run.
- Specs: specs default to Self-Managed. Specs that turned
bl_securityon by flag alone now include a new shared context,with bl_security enabled for the instance, which stubs the enabled-flows lookup. This is most of the diff.
Out of scope / follow-ups
- Mythos stays unavailable on Self-Managed. Its model restriction in the AI gateway is untouched.
- Offline and GitLab Duo Self-Hosted instances are not supported. The runner needs
gitlab.comandregistry.gitlab.com, and a customer-run Duo Workflow Service refuses the flow. - Naming:
gitlab_hosted_runner_onlyand:dedicated_enabled_instancesnow also cover Self-Managed. Renaming them is a follow-up. On Self-Managed, refusing IDE and CLI runs follows theduo_hosted_runner_only_refusalflag, which is off by default. - Spec cleanup: some ingestion specs turn off both the ingestion flag and the instance enablement. On Self-Managed the flag alone is enough. Simplifying them is a follow-up.
- ai-assist: the
GATED_FLOWScomment inlib/flow_enablement.pysays only GitLab.com flows belong there. A follow-up there corrects it.
Verification
On a Self-Managed GDK at the current head, with a local Duo Workflow Service (per-instance enforcement on) and the default model:
- Instance enabled, both flags on: BLSA ran on an instance runner and found a cross-customer authorization bug, shown in the MR security widget. After merge, a default-branch scan added it to the Vulnerability Report.
- Instance enabled,
agentic_analyzer_security_ingestionoff: BLSA still runs, but nothing new reaches the MR widget or the Vulnerability Report. Turning the flag on ingests the same findings. - Instance not enabled: the flow is unavailable. Starting it returns 403, with no workflow left behind.
- Specs: about 2,650 examples in the affected spec files pass. Reverting the gate fails 11 examples.
ingestion_spec,agentic_analyzer_policy_visibility_specandagentic_analyzer_mr_widget_e2e_specstill pass with it reverted, because they stub the gate.
Context
Closes #638992 (closed)
- Docs: Business logic scanning
- Epic: GitLab Business Logic Security Analyzer: Produc... (&23435)
- Related: BLSA screens on Self-Managed should check the d... (#635654), BLSA docs: security configuration profiles page... (#634964)