diff --git a/data/deprecations/15-9-required-pipeline-configuration.yml b/data/deprecations/15-9-required-pipeline-configuration.yml index c5335fef08b9a1893c225899414901110ee13e4c..396381e3e3226097938cddb6ea3ff6f1c4118c20 100644 --- a/data/deprecations/15-9-required-pipeline-configuration.yml +++ b/data/deprecations/15-9-required-pipeline-configuration.yml @@ -13,7 +13,7 @@ You should replace required pipeline configuration with either: - - [Security policies scoped to compliance frameworks](https://docs.gitlab.com/ee/user/application_security/policies/scan-execution-policies.html#security-policy-scopes), which are experimental. + - [Security policies scoped to compliance frameworks](https://docs.gitlab.com/ee/user/application_security/policies/scan_execution_policies.html#security-policy-scopes), which are experimental. - [Compliance pipelines](https://docs.gitlab.com/ee/user/group/compliance_pipelines.html), which are available now. We recommend these alternative solutions because they provides greater flexibility, allowing required pipelines to be assigned to specific diff --git a/data/whats_new/202207220001_15_2.yml b/data/whats_new/202207220001_15_2.yml index 7563a9ffbe984c87d2974aef5ef3e08e678b0fdb..e85e91ca230f1ce1408eeb04aca673eccd74eddf 100644 --- a/data/whats_new/202207220001_15_2.yml +++ b/data/whats_new/202207220001_15_2.yml @@ -70,7 +70,7 @@ self-managed: true gitlab-com: true available_in: [Ultimate] - documentation_link: https://docs.gitlab.com/ee/user/application_security/policies/scan-execution-policies.html' + documentation_link: https://docs.gitlab.com/ee/user/application_security/policies/scan_execution_policies.html' image_url: https://about.gitlab.com/images/15_2/protect_group_policies.png published_at: 2022-07-22 release: 15.2 diff --git a/data/whats_new/202210220001_15_5.yml b/data/whats_new/202210220001_15_5.yml index 817dff2b1927b08c21321c7bbb1aff54521b1f18..9b61fdfcd49caef3b1bdabdb4cfbc83b35ffc909 100644 --- a/data/whats_new/202210220001_15_5.yml +++ b/data/whats_new/202210220001_15_5.yml @@ -27,7 +27,7 @@ self-managed: true gitlab-com: true available_in: [Ultimate] - documentation_link: 'https://docs.gitlab.com/ee/user/application_security/policies/scan-execution-policies.html' + documentation_link: 'https://docs.gitlab.com/ee/user/application_security/policies/scan_execution_policies.html' image_url: 'https://about.gitlab.com/images/15_5/govern-scan-execution-policy-rule-mode.png' published_at: 2022-10-22 release: 15.5 @@ -68,7 +68,7 @@ release: 15.5 - name: "Operational container scanning" description: | - GitLab now officially supports vulnerability scanning of container images in operational or production Kubernetes environments. You can set up scanning either through the [configuration file](https://docs.gitlab.com/ee/user/clusters/agent/vulnerabilities.html#enable-operational-container-scanning) for your GitLab Agent for Kubernetes or by creating a [scan execution policy](https://docs.gitlab.com/ee/user/application_security/policies/scan-execution-policies.html) to require scans to run on a regular cadence. + GitLab now officially supports vulnerability scanning of container images in operational or production Kubernetes environments. You can set up scanning either through the [configuration file](https://docs.gitlab.com/ee/user/clusters/agent/vulnerabilities.html#enable-operational-container-scanning) for your GitLab Agent for Kubernetes or by creating a [scan execution policy](https://docs.gitlab.com/ee/user/application_security/policies/scan_execution_policies.html) to require scans to run on a regular cadence. stage: Secure self-managed: true gitlab-com: true diff --git a/data/whats_new/202404160001_16_11.yml b/data/whats_new/202404160001_16_11.yml index 69129bcf6fd55b3f32f06bfc60496cc88aa422e1..f66433615e51a09ef81fa83b7a1883d562f6a6e7 100644 --- a/data/whats_new/202404160001_16_11.yml +++ b/data/whats_new/202404160001_16_11.yml @@ -39,7 +39,7 @@ self-managed: true gitlab-com: true available_in: [Ultimate] - documentation_link: https://docs.gitlab.com/ee/user/application_security/policies/scan-execution-policies.html#security-policy-scopes + documentation_link: https://docs.gitlab.com/ee/user/application_security/policies/scan_execution_policies.html#security-policy-scopes image_url: https://about.gitlab.com/images/16_11/policy-scoping-release-post-image-optimized.png published_at: 2024-04-18 release: 16.11 diff --git a/doc/administration/settings/import_and_export_settings.md b/doc/administration/settings/import_and_export_settings.md index 7fdb1a5c54b924ffa1ce641b91d747746a31abd4..a949c97434c9d856dabd001c1701384c6a4ef955 100644 --- a/doc/administration/settings/import_and_export_settings.md +++ b/doc/administration/settings/import_and_export_settings.md @@ -45,7 +45,7 @@ DETAILS: > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/383268) in GitLab 15.8. WARNING: -In GitLab 16.1 and earlier, you should **not** use direct transfer with [scheduled scan execution policies](../../user/application_security/policies/scan-execution-policies.md). If using direct transfer, first upgrade to GitLab 16.2 and ensure security policy bots are enabled in the projects you are enforcing. +In GitLab 16.1 and earlier, you should **not** use direct transfer with [scheduled scan execution policies](../../user/application_security/policies/scan_execution_policies.md). If using direct transfer, first upgrade to GitLab 16.2 and ensure security policy bots are enabled in the projects you are enforcing. WARNING: This feature is in [beta](../../policy/experiment-beta-support.md#beta) and subject to change without notice. diff --git a/doc/ci/variables/index.md b/doc/ci/variables/index.md index abdc445933d757bff525860db74ad73cce7c722d..6c4ea8ee3e84e2fcb98ce5e16523bd7ce180257a 100644 --- a/doc/ci/variables/index.md +++ b/doc/ci/variables/index.md @@ -709,7 +709,7 @@ which variables take precedence. The order of precedence for variables is (from highest to lowest): -1. [Scan Execution Policies variables](../../user/application_security/policies/scan-execution-policies.md). +1. [Scan Execution Policies variables](../../user/application_security/policies/scan_execution_policies.md). 1. Pipeline variables. These variables all have the same precedence: - [Variables passed to downstream pipelines](../pipelines/downstream_pipelines.md#pass-cicd-variables-to-a-downstream-pipeline). - [Trigger variables](../triggers/index.md#pass-cicd-variables-in-the-api-call). diff --git a/doc/tutorials/scan_execution_policy/index.md b/doc/tutorials/scan_execution_policy/index.md index 7064a2c56470b1bf964b9998dcd48d01531d946a..0fb5aec04bc91ef0f11118cce538374791cb1225 100644 --- a/doc/tutorials/scan_execution_policy/index.md +++ b/doc/tutorials/scan_execution_policy/index.md @@ -11,7 +11,7 @@ DETAILS: **Offering:** GitLab.com, Self-managed, GitLab Dedicated This tutorial shows you how to create and apply a -[scan execution policy](../../user/application_security/policies/scan-execution-policies.md). +[scan execution policy](../../user/application_security/policies/scan_execution_policies.md). These policies enforce application security tools as part of the CI/CD pipeline. In this tutorial, you create a policy to enforce secret detection in the CI/CD pipeline of two projects. diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md index 0a293a54fa3dc5af0e285305579c7a88e82e1206..7c4be3fbfc4292637cd315c055029de2f796e2ff 100644 --- a/doc/update/deprecations.md +++ b/doc/update/deprecations.md @@ -2178,7 +2178,7 @@ Required pipeline configuration will be removed in GitLab 17.0. This impacts sel You should replace required pipeline configuration with either: -- [Security policies scoped to compliance frameworks](https://docs.gitlab.com/ee/user/application_security/policies/scan-execution-policies.html#security-policy-scopes), which are experimental. +- [Security policies scoped to compliance frameworks](https://docs.gitlab.com/ee/user/application_security/policies/scan_execution_policies.html#security-policy-scopes), which are experimental. - [Compliance pipelines](https://docs.gitlab.com/ee/user/group/compliance_pipelines.html), which are available now. We recommend these alternative solutions because they provides greater flexibility, allowing required pipelines to be assigned to specific diff --git a/doc/user/application_security/container_scanning/index.md b/doc/user/application_security/container_scanning/index.md index 9137f6f10abd31bae787f4820d95162533f97936..a624261dc4dc75b272de2bd99566d2cc2856c83e 100644 --- a/doc/user/application_security/container_scanning/index.md +++ b/doc/user/application_security/container_scanning/index.md @@ -95,7 +95,7 @@ To enable the analyzer, either: - Enable Auto DevOps, which includes dependency scanning. - Use a preconfigured merge request. -- Create a [scan execution policy](../policies/scan-execution-policies.md) that enforces container +- Create a [scan execution policy](../policies/scan_execution_policies.md) that enforces container scanning. - Edit the `.gitlab-ci.yml` file manually. diff --git a/doc/user/application_security/dast/on-demand_scan.md b/doc/user/application_security/dast/on-demand_scan.md index 95f98e6ea026dfe91b87427c38171c2ec37053dd..33f641f45c1ef0d905b70eafacd5e11f0c60955f 100644 --- a/doc/user/application_security/dast/on-demand_scan.md +++ b/doc/user/application_security/dast/on-demand_scan.md @@ -195,7 +195,7 @@ The site profile is saved, for use in an on-demand scan. NOTE: If a site profile is linked to a security policy, you cannot edit the profile from this page. See -[Scan execution policies](../policies/scan-execution-policies.md) for more information. +[Scan execution policies](../policies/scan_execution_policies.md) for more information. NOTE: If a site profile's Target URL or Authenticated URL is updated, the request headers and password fields associated with that profile are cleared. @@ -216,7 +216,7 @@ To edit a site profile: NOTE: If a site profile is linked to a security policy, a user cannot delete the profile from this page. -See [Scan execution policies](../policies/scan-execution-policies.md) for more information. +See [Scan execution policies](../policies/scan_execution_policies.md) for more information. To delete a site profile: @@ -369,7 +369,7 @@ To create a scanner profile: NOTE: If a scanner profile is linked to a security policy, you cannot edit the profile from this page. -For more information, see [Scan execution policies](../policies/scan-execution-policies.md). +For more information, see [Scan execution policies](../policies/scan_execution_policies.md). To edit a scanner profile: @@ -385,7 +385,7 @@ To edit a scanner profile: NOTE: If a scanner profile is linked to a security policy, a user cannot delete the profile from this -page. For more information, see [Scan execution policies](../policies/scan-execution-policies.md). +page. For more information, see [Scan execution policies](../policies/scan_execution_policies.md). To delete a scanner profile: diff --git a/doc/user/application_security/dependency_scanning/index.md b/doc/user/application_security/dependency_scanning/index.md index 9bd8aa952e167c7fba5b725378e54f2c218c7b2a..eb3fdb9e78c2b2505090193e5bbdd91795e57772 100644 --- a/doc/user/application_security/dependency_scanning/index.md +++ b/doc/user/application_security/dependency_scanning/index.md @@ -692,7 +692,7 @@ To enable the analyzer, either: - Enable [Auto DevOps](../../../topics/autodevops/index.md), which includes dependency scanning. - Use a preconfigured merge request. -- Create a [scan execution policy](../policies/scan-execution-policies.md) that enforces dependency +- Create a [scan execution policy](../policies/scan_execution_policies.md) that enforces dependency scanning. - Edit the `.gitlab-ci.yml` file manually. - [Use CI/CD components](#use-cicd-components) (Android projects only) diff --git a/doc/user/application_security/get-started-security.md b/doc/user/application_security/get-started-security.md index cd6e8308a69cdc5dc41f5ff03abeafaa517a3917..28bef76841c526bfab1e66ba9062ad32e09e6030 100644 --- a/doc/user/application_security/get-started-security.md +++ b/doc/user/application_security/get-started-security.md @@ -107,7 +107,7 @@ low development activity and where pipeline scans are infrequent. For more information, see: -- [Scan execution policy](policies/scan-execution-policies.md) +- [Scan execution policy](policies/scan_execution_policies.md) - [Container scans](container_scanning/index.md) - [Operational container scanning](../../user/clusters/agent/vulnerabilities.md) @@ -126,7 +126,7 @@ After you've gotten familiar with how scanning works, you can then choose to: For more information, see: -- [Scan Execution Policies](policies/scan-execution-policies.md) +- [Scan Execution Policies](policies/scan_execution_policies.md) - [Merge request approval policy](policies/index.md) ## Step 7: Continue scanning for new vulnerabilities diff --git a/doc/user/application_security/index.md b/doc/user/application_security/index.md index 98af9a62fc3c0cbe7a5d79e06a3055787439d0b4..c4a382d1b6d55ef77260bf884fc29454be8e4c3a 100644 --- a/doc/user/application_security/index.md +++ b/doc/user/application_security/index.md @@ -582,7 +582,7 @@ GitLab provides two methods of accomplishing this, each with advantages and disa - Scan execution enforcement is required for scanners external to GitLab. - Scan execution enforcement is required for custom jobs other than security scans. -- [Scan execution policies](policies/scan-execution-policies.md) +- [Scan execution policies](policies/scan_execution_policies.md) are recommended when: - Scan execution enforcement is required for DAST which uses a DAST site or scan profile. diff --git a/doc/user/application_security/policies/index.md b/doc/user/application_security/policies/index.md index c1073124fcf2ee3c213f132c826d7c506c077522..a5a8f452ab4c0a35615e78a99d679b115ddbc894 100644 --- a/doc/user/application_security/policies/index.md +++ b/doc/user/application_security/policies/index.md @@ -27,7 +27,7 @@ Compliance teams can: The following policy types are available: -- [Scan execution policy](scan-execution-policies.md). Enforce security scans, either as part of the +- [Scan execution policy](scan_execution_policies.md). Enforce security scans, either as part of the pipeline or on a specified schedule. - [Merge request approval policy](scan-result-policies.md). Enforce project-level settings and approval rules based on scan results. @@ -346,7 +346,7 @@ The workaround is to amend your group or instance push rules to allow branches f - Merge request approval policies created at the group or subgroup level can take some time to apply to all the merge requests in the group. - Scheduled scan execution policies run with a minimum 15 minute cadence. Learn more - [about the schedule rule type](../policies/scan-execution-policies.md#schedule-rule-type). + [about the schedule rule type](../policies/scan_execution_policies.md#schedule-rule-type). - When scheduling pipelines, keep in mind that CRON scheduling is based on UTC on GitLab SaaS and is based on your server time for self managed instances. When testing new policies, it may appear pipelines are not running properly when in fact they are scheduled in your server's time zone. diff --git a/doc/user/application_security/policies/scan-execution-policies.md b/doc/user/application_security/policies/scan-execution-policies.md index 8730afdcf180f77f01c28ecdab5bfa747a413491..e255332eaac97929cdd7d67314d988978ff741bf 100644 --- a/doc/user/application_security/policies/scan-execution-policies.md +++ b/doc/user/application_security/policies/scan-execution-policies.md @@ -1,446 +1,11 @@ --- -stage: Govern -group: Security Policies -info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments +redirect_to: 'scan_execution_policies.md' +remove_date: '2024-10-25' --- -# Scan execution policies +This document was moved to [another location](scan_execution_policies.md). -DETAILS: -**Tier:** Ultimate -**Offering:** GitLab.com, Self-managed, GitLab Dedicated - -> - Group-level security policies [introduced](https://gitlab.com/groups/gitlab-org/-/epics/4425) in GitLab 15.2. -> - Group-level security policies [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/356258) in GitLab 15.4. -> - Operational container scanning [introduced](https://gitlab.com/groups/gitlab-org/-/epics/3410) in GitLab 15.5 -> - Support for custom CI variables in the Scan Execution Policies editor [introduced](https://gitlab.com/groups/gitlab-org/-/epics/9566) in GitLab 16.2. -> - Enforcement of scan execution policies on projects with an existing GitLab CI/CD configuration [introduced](https://gitlab.com/groups/gitlab-org/-/epics/6880) in GitLab 16.2 [with a flag](../../../administration/feature_flags.md) named `scan_execution_policy_pipelines`. Feature flag `scan_execution_policy_pipelines` removed in GitLab 16.5. -> - Overriding predefined variables in scan execution policies [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/440855) in GitLab 16.10 [with a flag](../../../administration/feature_flags.md) named `allow_restricted_variables_at_policy_level`. Enabled by default. - -Use scan execution policies to enforce security scans, either as part of the pipeline or on a -specified schedule. The security scans run with multiple project pipelines if you define the policy -at a group or subgroup level. - -Scan execution policies are enforced for all applicable projects. For projects without a -`.gitlab-ci.yml` file, or where AutoDevOps is disabled, security policies create the -`.gitlab-ci.yml` file implicitly. This ensures policies enabling execution of secret detection, -static analysis, or other scanners that do not require a build in the project, are still able to -run and be enforced. - -This feature has some overlap with [compliance framework pipelines](../../group/compliance_pipelines.md), -as we have not [unified the user experience for these two features](https://gitlab.com/groups/gitlab-org/-/epics/7312). -For details on the similarities and differences between these features, see -[Enforce scan execution](../index.md#enforce-scan-execution). - -- <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For a video walkthrough, see [How to set up Security Scan Policies in GitLab](https://youtu.be/ZBcqGmEwORA?si=aeT4EXtmHjosgjBY). -- <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For an overview, see [Enforcing scan execution policies on projects with no GitLab CI/CD configuration](https://www.youtube.com/watch?v=sUfwQQ4-qHs). - -## Jobs - -Policy jobs for scans, other than DAST scans, are created in the `test` stage of the pipeline. If -you remove the `test` stage from the default pipeline, jobs run in the `scan-policies` stage -instead. This stage is injected into the CI/CD pipeline at evaluation time if it doesn't exist. If -the `build` stage exists, it is injected just after the `build` stage, otherwise it is injected at -the beginning of the pipeline. DAST scans always run in the `dast` stage. If this stage does not -exist, then a `dast` stage is injected at the end of the pipeline. - -To avoid job name conflicts, a hyphen and a number is appended to the job name. The number is unique -per policy action. - -## Scan execution policy editor - -Use the scan execution policy editor to create or edit a scan execution policy. - -Prerequisites: - -- Only group, subgroup, or project Owners have the [permissions](../../permissions.md#project-members-permissions) - to select Security Policy Project. -- The maximum number of scan execution policies is five per security policy project. - -Once your policy is complete, save it by selecting **Configure with a merge request** -at the bottom of the editor. You are redirected to the merge request on the project's -configured security policy project. If one does not link to your project, a security -policy project is automatically created. Existing policies can also be -removed from the editor interface by selecting **Delete policy** -at the bottom of the editor. - -Most policy changes take effect as soon as the merge request is merged. Any changes that -do not go through a merge request and are committed directly to the default branch may require up to 10 minutes -before the policy changes take effect. - - - -NOTE: -Selection of site and scanner profiles using the rule mode editor for DAST execution policies differs based on -whether the policy is being created at the project or group level. For project-level policies the rule mode editor -presents a list of profiles to choose from that are already defined in the project. For group-level policies -you are required to type in the names of the profiles to use, and to prevent pipeline errors, profiles with -matching names must exist in all of the group's projects. - -## Scan execution policies schema - -The YAML file with scan execution policies consists of an array of objects matching scan execution -policy schema nested under the `scan_execution_policy` key. You can configure a maximum of 5 -policies under the `scan_execution_policy` key. Any other policies configured after -the first 5 are not applied. - -When you save a new policy, GitLab validates its contents against [this JSON schema](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/validators/json_schemas/security_orchestration_policy.json). -If you're not familiar with how to read [JSON schemas](https://json-schema.org/), -the following sections and tables provide an alternative. - -| Field | Type | Required | Possible values | Description | -|-------|------|----------|-----------------|-------------| -| `scan_execution_policy` | `array` of scan execution policy | true | | List of scan execution policies (maximum 5) | - -## Scan execution policy schema - -| Field | Type | Required | Possible values | Description | -|-------|------|----------|-----------------|-------------| -| `name` | `string` | true | | Name of the policy. Maximum of 255 characters.| -| `description` (optional) | `string` | true | | Description of the policy. | -| `enabled` | `boolean` | true | `true`, `false` | Flag to enable (`true`) or disable (`false`) the policy. | -| `rules` | `array` of rules | true | | List of rules that the policy applies. | -| `actions` | `array` of actions | true | | List of actions that the policy enforces. | - -## `pipeline` rule type - -> - The `branch_type` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/404774) in GitLab 16.1 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_type`. Generally available in GitLab 16.2. Feature flag removed. -> - The `branch_exceptions` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/418741) in GitLab 16.3 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. Generally available in GitLab 16.5. Feature flag removed. - -FLAG: -On self-managed GitLab, by default the `branch_exceptions` field is available. To hide the feature, an administrator can [disable the feature flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. -On GitLab.com and GitLab Dedicated, this feature is available. - -This rule enforces the defined actions whenever the pipeline runs for a selected branch. - -| Field | Type | Required | Possible values | Description | -|-------|------|----------|-----------------|-------------| -| `type` | `string` | true | `pipeline` | The rule's type. | -| `branches` <sup>1</sup> | `array` of `string` | true if `branch_type` field does not exist | `*` or the branch's name | The branch the given policy applies to (supports wildcard). | -| `branch_type` <sup>1</sup> | `string` | true if `branches` field does not exist | `default`, `protected` or `all` | The types of branches the given policy applies to. | -| `branch_exceptions` | `array` of `string` | false | Names of branches | Branches to exclude from this rule. | - -1. You must specify only one of `branches` or `branch_type`. - -## `schedule` rule type - -> - The `branch_type` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/404774) in GitLab 16.1 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_type`. Generally available in GitLab 16.2. Feature flag removed. -> - The `branch_exceptions` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/418741) in GitLab 16.3 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. Generally available in GitLab 16.5. Feature flag removed. - -WARNING: -In GitLab 16.1 and earlier, you should **not** use [direct transfer](../../../administration/settings/import_and_export_settings.md#enable-migration-of-groups-and-projects-by-direct-transfer) with scheduled scan execution policies. If using direct transfer, first upgrade to GitLab 16.2 and ensure security policy bots are enabled in the projects you are enforcing. - -FLAG: -On self-managed GitLab, by default the `branch_exceptions` field is available. To hide the feature, an administrator can [disable the feature flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. -On GitLab.com and GitLab Dedicated, this feature is available. - -This rule schedules a scan pipeline, enforcing the defined actions on the schedule defined in the `cadence` field. A scheduled pipeline does not run other jobs defined in the project's `.gitlab-ci.yml` file. When a project is linked to a security policy project, a security policy bot is created in the project and will become the author of any scheduled pipelines. - -| Field | Type | Required | Possible values | Description | -|------------|------|----------|-----------------|-------------| -| `type` | `string` | true | `schedule` | The rule's type. | -| `branches` <sup>1</sup> | `array` of `string` | true if either `branch_type` or `agents` fields does not exist | `*` or the branch's name | The branch the given policy applies to (supports wildcard). | -| `branch_type` <sup>1</sup> | `string` | true if either `branches` or `agents` fields does not exist | `default`, `protected` or `all` | The types of branches the given policy applies to. | -| `branch_exceptions` | `array` of `string` | false | Names of branches | Branches to exclude from this rule. | -| `cadence` | `string` | true | CRON expression (for example, `0 0 * * *`) | A whitespace-separated string containing five fields that represents the scheduled time. | -| `timezone` | `string` | false | Time zone identifier (for example, `America/New_York`) | Time zone to apply to the cadence. Value must be an IANA Time Zone Database identifier. | -| `agents` <sup>1</sup> | `object` | true if either `branch_type` or `branches` fields do not exists | | The name of the [GitLab agents](../../clusters/agent/index.md) where [Operational Container Scanning](../../clusters/agent/vulnerabilities.md) runs. The object key is the name of the Kubernetes agent configured for your project in GitLab. | - -1. You must specify only one of `branches`, `branch_type`, or `agents`. - -Scheduled scan pipelines are triggered by a security policy bot user that is a guest member of the project with elevated permissions for users of type `security_policy_bot` so it may carry out this task. Security policy bot users are automatically created when the security policy project is linked, and removed when the security policy project is unlinked. - -If the project does not have a security policy bot user, the bot will be automatically created, and the following scheduled scan pipeline will use it. - -GitLab supports the following types of CRON syntax for the `cadence` field: - -- A daily cadence of once per hour around specified time, for example: `0 18 * * *` -- A weekly cadence of once per week on a specified day and around specified time, for example: `0 13 * * 0` - -NOTE: -Other elements of the [CRON syntax](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm) may work in the cadence field if supported by the [cron](https://github.com/robfig/cron) we are using in our implementation, however, GitLab does not officially test or support them. -The comma (,), hyphens (-), or step operators (/) are not supported for minutes and hours. -An error is displayed if the cadence is invalid when creating or editing a policy. -The scheduled pipelines for a previously created policy using comma (,), hyphen(-), or step operator (/) in minutes or hours fields is skipped. -The pipelines that have been scheduled will use the `cadence` value to create a new pipeline around the time mentioned in the policy. The pipeline will be executed after a specified time when the resources become available to create it. - -When using the `schedule` rule type in conjunction with the `agents` field, note the following: - -- The GitLab agent for Kubernetes checks every 30 seconds to see if there is an applicable policy. When a policy is found, the scans are executed according to the `cadence` defined. -- The CRON expression is evaluated using the system-time of the Kubernetes-agent pod. - -When using the `schedule` rule type in conjunction with the `branches` field, note the following: - -- The cron worker runs on 15 minute intervals and starts any pipelines that were scheduled to run during the previous 15 minutes. -- Based on your rule, you might expect scheduled pipelines to run with an offset of up to 15 minutes. -- If a policy is enforced on a large number of projects or branches, it will be processed in batches, and it may take some time to create all pipelines. -- The CRON expression is evaluated in standard [UTC](https://www.timeanddate.com/worldclock/timezone/utc) time from GitLab.com. If you have a self-managed GitLab instance and have [changed the server time zone](../../../administration/timezone.md), the CRON expression is evaluated with the new time zone. - - - -### `agent` schema - -Use this schema to define `agents` objects in the [`schedule` rule type](#schedule-rule-type). - -| Field | Type | Required | Description | -|--------------|---------------------|----------|-------------| -| `namespaces` | `array` of `string` | true | The namespace that is scanned. If empty, all namespaces are scanned. | - -#### Policy example - -```yaml -- name: Enforce Container Scanning in cluster connected through my-gitlab-agent for default and kube-system namespaces - enabled: true - rules: - - type: schedule - cadence: '0 10 * * *' - agents: - <agent-name>: - namespaces: - - 'default' - - 'kube-system' - actions: - - scan: container_scanning -``` - -The keys for a schedule rule are: - -- `cadence` (required): a [CRON expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm) for when the scans are run -- `agents:<agent-name>` (required): The name of the agent to use for scanning -- `agents:<agent-name>:namespaces` (optional): The Kubernetes namespaces to scan. If omitted, all namespaces are scanned. - -## `scan` action type - -> - Scan Execution Policies variable precedence was [changed](https://gitlab.com/gitlab-org/gitlab/-/issues/424028) in GitLab 16.7 [with a flag](../../../administration/feature_flags.md) named `security_policies_variables_precedence`. Enabled by default. [Feature flag removed in GitLab 16.8](https://gitlab.com/gitlab-org/gitlab/-/issues/435727). -> - Selection of security templates for given action (for projects) was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/415427) in GitLab 17.1 [with feature flag](../../../administration/feature_flags.md) named `scan_execution_policies_with_latest_templates`. Disabled by default. -> - Selection of security templates for given action (for groups) was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/468981) in GitLab 17.2 [with feature flag](../../../administration/feature_flags.md) named `scan_execution_policies_with_latest_templates_group`. Disabled by default. -> - Selection of security templates for given action (for projects and groups) was enabled on self-managed, and GitLab Dedicated ([1](https://gitlab.com/gitlab-org/gitlab/-/issues/461474), [2](https://gitlab.com/gitlab-org/gitlab/-/issues/468981)) in GitLab 17.2. -> - Selection of security templates for given action (for projects and groups) was generally available in GitLab 17.3. Feature flags `scan_execution_policies_with_latest_templates` and `scan_execution_policies_with_latest_templates_group` removed. - -This action executes the selected `scan` with additional parameters when conditions for at least one -rule in the defined policy are met. - -| Field | Type | Possible values | Description | -|-------|------|-----------------|-------------| -| `scan` | `string` | `sast`, `sast_iac`, `dast`, `secret_detection`, `container_scanning`, `dependency_scanning` | The action's type. | -| `site_profile` | `string` | Name of the selected [DAST site profile](../dast/on-demand_scan.md#site-profile). | The DAST site profile to execute the DAST scan. This field should only be set if `scan` type is `dast`. | -| `scanner_profile` | `string` or `null` | Name of the selected [DAST scanner profile](../dast/on-demand_scan.md#scanner-profile). | The DAST scanner profile to execute the DAST scan. This field should only be set if `scan` type is `dast`.| -| `variables` | `object` | | A set of CI variables, supplied as an array of `key: value` pairs, to apply and enforce for the selected scan. The `key` is the variable name, with its `value` provided as a string. This parameter supports any variable that the GitLab CI job supports for the specified scan. | -| `tags` | `array` of `string` | | A list of runner tags for the policy. The policy jobs are run by runner with the specified tags. | -| `template` | `string` | `default`, `latest` | CI/CD template edition to be enforced. The [`latest`](../../../development/cicd/templates.md#latest-version) edition may introduce breaking changes. | - -NOTE: -If you have Merge Request Pipelines enabled for your project, you must select `template: latest` in your policy for each enforced scan. Using the latest template is crucial for compatibility with Merge Request Pipelines and allows you to take full advantage of GitLab security features. For more information on using security scanning tools with Merge Request Pipelines, please refer to our [security scanning documentation](../../application_security/index.md#use-security-scanning-tools-with-merge-request-pipelines). - -### Scan field details - -There are additional requirements for some of the `scan` action fields. -Some scanners also behave differently in a `scan` action than they do in a regular CI/CD pipeline-based scan. - -#### Profiles - -- You must create the [site profile](../dast/on-demand_scan.md#site-profile) and [scanner profile](../dast/on-demand_scan.md#scanner-profile) - with selected names for each project that is assigned to the selected Security Policy Project. - Otherwise, the policy is not applied and a job with an error message is created instead. -- Once you associate the site profile and scanner profile by name in the policy, it is not possible - to modify or delete them. If you want to modify them, you must first disable the policy by setting - the `active` flag to `false`. -- When configuring policies with a scheduled DAST scan, the author of the commit in the security - policy project's repository must have access to the scanner and site profiles. Otherwise, the scan - is not scheduled successfully. - -#### Scanner behavior - -- For Secret Detection: - - Only rules with the default ruleset are supported. [Custom rulesets](../secret_detection/pipeline/index.md#customize-analyzer-rulesets) are not supported. Alternatively, you may configure a [remote configuration file](../secret_detection/pipeline/index.md#with-a-remote-ruleset) and set the `SECRET_DETECTION_RULESET_GIT_REFERENCE` variable. - - By default, for `scheduled` scan execution policies, secret detection scans configured without any CI variables defined run first in `historic` mode (`SECRET_DETECTION_HISTORIC_SCAN` = `true`). All subsequent scheduled scans run in default mode with `SECRET_DETECTION_LOG_OPTIONS` set to the commit range between last run and current SHA. CI variables provided in the scan execution policy can override this behavior. Learn more about [historic mode](../secret_detection/pipeline/index.md#full-history-pipeline-secret-detection). - - For `triggered` scan execution policies, secret detection works just like regular scan [configured manually in the `.gitlab-ci.yml`](../secret_detection/pipeline/index.md#edit-the-gitlab-ciyml-file-manually). -- A Container Scanning scan that is configured for the `pipeline` rule type ignores the agent defined in the `agents` object. The `agents` object is only considered for `schedule` rule types. - An agent with a name provided in the `agents` object must be created and configured for the project. - -#### CI/CD variables - -Variables defined in a Scan Execution Policy follow the standard [CI/CD variable precedence](../../../ci/variables/index.md#cicd-variable-precedence). - -Preconfigured values are used for the following CI/CD variables in any project on which a scan -execution policy is enforced. Their values can be overridden, but **only** if they are declared in -a policy. They **cannot** be overridden by group or project CI/CD variables: - -```plaintext -DS_EXCLUDED_PATHS: spec, test, tests, tmp -SAST_EXCLUDED_PATHS: spec, test, tests, tmp -SECRET_DETECTION_EXCLUDED_PATHS: '' -SECRET_DETECTION_HISTORIC_SCAN: false -SAST_EXCLUDED_ANALYZERS: '' -DS_EXCLUDED_ANALYZERS: '' -``` - -In GitLab 16.9 and earlier: - -- If the CI/CD variables suffixed `_EXCLUDED_PATHS` were declared in a policy, their values _could_ - be overridden by group or project CI/CD variables. -- If the CI/CD variables suffixed `_EXCLUDED_ANALYZERS` were declared in a policy, their values were - ignored, regardless of where they were defined: policy, group, or project. - -## Security policy scopes - -> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135398) in GitLab 16.7 [with a flag](../../../administration/feature_flags.md) named `security_policies_policy_scope`. Enabled by default. -> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/443594) in GitLab 16.11. Feature flag `security_policies_policy_scope` removed. - -Security policy enforcement depends first on establishing a link between the group, subgroup, or -project on which you want to enforce policies, and the security policy project that contains the -policies. For example, if you are linking policies to a group, a group owner must create the link to -the security policy project. Then, all policies in the security policy project are inherited by all -projects in the group. - -You can refine a security policy's scope to: - -- _Include_ only projects containing a compliance framework label. -- _Include_ or _exclude_ selected projects from enforcement. - -### Policy scope schema - -| Field | Type | Required | Possible values | Description | -|-------|------|----------|-----------------|-------------| -| `policy_scope` | `object` | false | `compliance_frameworks`, `projects` | Scopes the policy based on compliance framework labels or projects you define. | - -#### `policy_scope` scope type - -| Field | Type | Possible values | Description | -|-------|------|-----------------|-------------| -| `compliance_frameworks` | `array` | | List of IDs of the compliance frameworks in scope of enforcement, in an array of objects with key `id`. | -| `projects` | `object` | `including`, `excluding` | Use `excluding:` or `including:` then list the IDs of the projects you wish to include or exclude, in an array of objects with key `id`. | - -#### Example `policy.yml` with security policy scopes - -```yaml ---- -scan_execution_policy: -- name: Enforce DAST in every release pipeline - description: This policy enforces pipeline configuration to have a job with DAST scan for release branches - enabled: true - rules: - - type: pipeline - branches: - - release/* - actions: - - scan: dast - scanner_profile: Scanner Profile A - site_profile: Site Profile B - policy_scope: - compliance_frameworks: - - id: 2 - - id: 11 -- name: Enforce Secret Detection and Container Scanning in every default branch pipeline - description: This policy enforces pipeline configuration to have a job with Secret Detection and Container Scanning scans for the default branch - enabled: true - rules: - - type: pipeline - branches: - - main - actions: - - scan: secret_detection - - scan: sast - variables: - SAST_EXCLUDED_ANALYZERS: brakeman - policy_scope: - projects: - excluding: - - id: 24 - - id: 27 -``` - -## Example security policies project - -You can use this example in a `.gitlab/security-policies/policy.yml` file stored in a -[security policy project](index.md#security-policy-project): - -```yaml ---- -scan_execution_policy: -- name: Enforce DAST in every release pipeline - description: This policy enforces pipeline configuration to have a job with DAST scan for release branches - enabled: true - rules: - - type: pipeline - branches: - - release/* - actions: - - scan: dast - scanner_profile: Scanner Profile A - site_profile: Site Profile B -- name: Enforce DAST and secret detection scans every 10 minutes - description: This policy enforces DAST and secret detection scans to run every 10 minutes - enabled: true - rules: - - type: schedule - branches: - - main - cadence: "*/10 * * * *" - actions: - - scan: dast - scanner_profile: Scanner Profile C - site_profile: Site Profile D - - scan: secret_detection -- name: Enforce Secret Detection and Container Scanning in every default branch pipeline - description: This policy enforces pipeline configuration to have a job with Secret Detection and Container Scanning scans for the default branch - enabled: true - rules: - - type: pipeline - branches: - - main - actions: - - scan: secret_detection - - scan: sast - variables: - SAST_EXCLUDED_ANALYZERS: brakeman - - scan: container_scanning -``` - -In this example: - -- For every pipeline executed on branches that match the `release/*` wildcard (for example, branch - `release/v1.2.1`) - - DAST scans run with `Scanner Profile A` and `Site Profile B`. -- DAST and secret detection scans run every 10 minutes. The DAST scan runs with `Scanner Profile C` - and `Site Profile D`. -- Secret detection, container scanning, and SAST scans run for every pipeline executed on the `main` - branch. The SAST scan runs with the `SAST_EXCLUDED_ANALYZER` variable set to `"brakeman"`. - -## Example for scan execution policy editor - -You can use this example in the YAML mode of the [scan execution policy editor](#scan-execution-policy-editor). -It corresponds to a single object from the previous example. - -```yaml -name: Enforce Secret Detection and Container Scanning in every default branch pipeline -description: This policy enforces pipeline configuration to have a job with Secret Detection and Container Scanning scans for the default branch -enabled: true -rules: - - type: pipeline - branches: - - main -actions: - - scan: secret_detection - - scan: container_scanning -``` - -## Avoiding duplicate scans - -Scan execution policies can cause the same type of scanner to run more than once if developers include scan jobs in the project's -`.gitlab-ci.yml` file. This behavior is intentional as scanners can run more than once with different variables and settings. For example, a -developer may want to try running a SAST scan with different variables than the one enforced by the security and compliance team. In -this case, two SAST jobs run in the pipeline, one with the developer's variables and one with the security and compliance team's variables. - -If you want to avoid running duplicate scans, you can either remove the scans from the project's `.gitlab-ci.yml` file or disable your -local jobs by setting `SAST_DISABLED: "true"`. Disabling jobs this way does not prevent the security jobs defined by scan execution -policies from running. - -## Experimental features - -DETAILS: -**Status:** Experiment has ended - -This experiment has concluded and will not continue. After receiving feedback within this experiment, we will be focusing our efforts on a new policy type for enforcement of custom CI. The experiment will be removed in 17.3. - -Learn more about the [pipeline execution policy](pipeline_execution_policies.md). +<!-- This redirect file can be deleted after <2024-10-25>. --> +<!-- Redirects that point to other docs in the same project expire in three months. --> +<!-- Redirects that point to docs in a different project or site (link is not relative and starts with `https:`) expire in one year. --> +<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/redirects.html --> diff --git a/doc/user/application_security/policies/scan_execution_policies.md b/doc/user/application_security/policies/scan_execution_policies.md new file mode 100644 index 0000000000000000000000000000000000000000..8730afdcf180f77f01c28ecdab5bfa747a413491 --- /dev/null +++ b/doc/user/application_security/policies/scan_execution_policies.md @@ -0,0 +1,446 @@ +--- +stage: Govern +group: Security Policies +info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments +--- + +# Scan execution policies + +DETAILS: +**Tier:** Ultimate +**Offering:** GitLab.com, Self-managed, GitLab Dedicated + +> - Group-level security policies [introduced](https://gitlab.com/groups/gitlab-org/-/epics/4425) in GitLab 15.2. +> - Group-level security policies [enabled on GitLab.com](https://gitlab.com/gitlab-org/gitlab/-/issues/356258) in GitLab 15.4. +> - Operational container scanning [introduced](https://gitlab.com/groups/gitlab-org/-/epics/3410) in GitLab 15.5 +> - Support for custom CI variables in the Scan Execution Policies editor [introduced](https://gitlab.com/groups/gitlab-org/-/epics/9566) in GitLab 16.2. +> - Enforcement of scan execution policies on projects with an existing GitLab CI/CD configuration [introduced](https://gitlab.com/groups/gitlab-org/-/epics/6880) in GitLab 16.2 [with a flag](../../../administration/feature_flags.md) named `scan_execution_policy_pipelines`. Feature flag `scan_execution_policy_pipelines` removed in GitLab 16.5. +> - Overriding predefined variables in scan execution policies [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/440855) in GitLab 16.10 [with a flag](../../../administration/feature_flags.md) named `allow_restricted_variables_at_policy_level`. Enabled by default. + +Use scan execution policies to enforce security scans, either as part of the pipeline or on a +specified schedule. The security scans run with multiple project pipelines if you define the policy +at a group or subgroup level. + +Scan execution policies are enforced for all applicable projects. For projects without a +`.gitlab-ci.yml` file, or where AutoDevOps is disabled, security policies create the +`.gitlab-ci.yml` file implicitly. This ensures policies enabling execution of secret detection, +static analysis, or other scanners that do not require a build in the project, are still able to +run and be enforced. + +This feature has some overlap with [compliance framework pipelines](../../group/compliance_pipelines.md), +as we have not [unified the user experience for these two features](https://gitlab.com/groups/gitlab-org/-/epics/7312). +For details on the similarities and differences between these features, see +[Enforce scan execution](../index.md#enforce-scan-execution). + +- <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For a video walkthrough, see [How to set up Security Scan Policies in GitLab](https://youtu.be/ZBcqGmEwORA?si=aeT4EXtmHjosgjBY). +- <i class="fa fa-youtube-play youtube" aria-hidden="true"></i> For an overview, see [Enforcing scan execution policies on projects with no GitLab CI/CD configuration](https://www.youtube.com/watch?v=sUfwQQ4-qHs). + +## Jobs + +Policy jobs for scans, other than DAST scans, are created in the `test` stage of the pipeline. If +you remove the `test` stage from the default pipeline, jobs run in the `scan-policies` stage +instead. This stage is injected into the CI/CD pipeline at evaluation time if it doesn't exist. If +the `build` stage exists, it is injected just after the `build` stage, otherwise it is injected at +the beginning of the pipeline. DAST scans always run in the `dast` stage. If this stage does not +exist, then a `dast` stage is injected at the end of the pipeline. + +To avoid job name conflicts, a hyphen and a number is appended to the job name. The number is unique +per policy action. + +## Scan execution policy editor + +Use the scan execution policy editor to create or edit a scan execution policy. + +Prerequisites: + +- Only group, subgroup, or project Owners have the [permissions](../../permissions.md#project-members-permissions) + to select Security Policy Project. +- The maximum number of scan execution policies is five per security policy project. + +Once your policy is complete, save it by selecting **Configure with a merge request** +at the bottom of the editor. You are redirected to the merge request on the project's +configured security policy project. If one does not link to your project, a security +policy project is automatically created. Existing policies can also be +removed from the editor interface by selecting **Delete policy** +at the bottom of the editor. + +Most policy changes take effect as soon as the merge request is merged. Any changes that +do not go through a merge request and are committed directly to the default branch may require up to 10 minutes +before the policy changes take effect. + + + +NOTE: +Selection of site and scanner profiles using the rule mode editor for DAST execution policies differs based on +whether the policy is being created at the project or group level. For project-level policies the rule mode editor +presents a list of profiles to choose from that are already defined in the project. For group-level policies +you are required to type in the names of the profiles to use, and to prevent pipeline errors, profiles with +matching names must exist in all of the group's projects. + +## Scan execution policies schema + +The YAML file with scan execution policies consists of an array of objects matching scan execution +policy schema nested under the `scan_execution_policy` key. You can configure a maximum of 5 +policies under the `scan_execution_policy` key. Any other policies configured after +the first 5 are not applied. + +When you save a new policy, GitLab validates its contents against [this JSON schema](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/validators/json_schemas/security_orchestration_policy.json). +If you're not familiar with how to read [JSON schemas](https://json-schema.org/), +the following sections and tables provide an alternative. + +| Field | Type | Required | Possible values | Description | +|-------|------|----------|-----------------|-------------| +| `scan_execution_policy` | `array` of scan execution policy | true | | List of scan execution policies (maximum 5) | + +## Scan execution policy schema + +| Field | Type | Required | Possible values | Description | +|-------|------|----------|-----------------|-------------| +| `name` | `string` | true | | Name of the policy. Maximum of 255 characters.| +| `description` (optional) | `string` | true | | Description of the policy. | +| `enabled` | `boolean` | true | `true`, `false` | Flag to enable (`true`) or disable (`false`) the policy. | +| `rules` | `array` of rules | true | | List of rules that the policy applies. | +| `actions` | `array` of actions | true | | List of actions that the policy enforces. | + +## `pipeline` rule type + +> - The `branch_type` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/404774) in GitLab 16.1 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_type`. Generally available in GitLab 16.2. Feature flag removed. +> - The `branch_exceptions` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/418741) in GitLab 16.3 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. Generally available in GitLab 16.5. Feature flag removed. + +FLAG: +On self-managed GitLab, by default the `branch_exceptions` field is available. To hide the feature, an administrator can [disable the feature flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. +On GitLab.com and GitLab Dedicated, this feature is available. + +This rule enforces the defined actions whenever the pipeline runs for a selected branch. + +| Field | Type | Required | Possible values | Description | +|-------|------|----------|-----------------|-------------| +| `type` | `string` | true | `pipeline` | The rule's type. | +| `branches` <sup>1</sup> | `array` of `string` | true if `branch_type` field does not exist | `*` or the branch's name | The branch the given policy applies to (supports wildcard). | +| `branch_type` <sup>1</sup> | `string` | true if `branches` field does not exist | `default`, `protected` or `all` | The types of branches the given policy applies to. | +| `branch_exceptions` | `array` of `string` | false | Names of branches | Branches to exclude from this rule. | + +1. You must specify only one of `branches` or `branch_type`. + +## `schedule` rule type + +> - The `branch_type` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/404774) in GitLab 16.1 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_type`. Generally available in GitLab 16.2. Feature flag removed. +> - The `branch_exceptions` field was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/418741) in GitLab 16.3 [with a flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. Generally available in GitLab 16.5. Feature flag removed. + +WARNING: +In GitLab 16.1 and earlier, you should **not** use [direct transfer](../../../administration/settings/import_and_export_settings.md#enable-migration-of-groups-and-projects-by-direct-transfer) with scheduled scan execution policies. If using direct transfer, first upgrade to GitLab 16.2 and ensure security policy bots are enabled in the projects you are enforcing. + +FLAG: +On self-managed GitLab, by default the `branch_exceptions` field is available. To hide the feature, an administrator can [disable the feature flag](../../../administration/feature_flags.md) named `security_policies_branch_exceptions`. +On GitLab.com and GitLab Dedicated, this feature is available. + +This rule schedules a scan pipeline, enforcing the defined actions on the schedule defined in the `cadence` field. A scheduled pipeline does not run other jobs defined in the project's `.gitlab-ci.yml` file. When a project is linked to a security policy project, a security policy bot is created in the project and will become the author of any scheduled pipelines. + +| Field | Type | Required | Possible values | Description | +|------------|------|----------|-----------------|-------------| +| `type` | `string` | true | `schedule` | The rule's type. | +| `branches` <sup>1</sup> | `array` of `string` | true if either `branch_type` or `agents` fields does not exist | `*` or the branch's name | The branch the given policy applies to (supports wildcard). | +| `branch_type` <sup>1</sup> | `string` | true if either `branches` or `agents` fields does not exist | `default`, `protected` or `all` | The types of branches the given policy applies to. | +| `branch_exceptions` | `array` of `string` | false | Names of branches | Branches to exclude from this rule. | +| `cadence` | `string` | true | CRON expression (for example, `0 0 * * *`) | A whitespace-separated string containing five fields that represents the scheduled time. | +| `timezone` | `string` | false | Time zone identifier (for example, `America/New_York`) | Time zone to apply to the cadence. Value must be an IANA Time Zone Database identifier. | +| `agents` <sup>1</sup> | `object` | true if either `branch_type` or `branches` fields do not exists | | The name of the [GitLab agents](../../clusters/agent/index.md) where [Operational Container Scanning](../../clusters/agent/vulnerabilities.md) runs. The object key is the name of the Kubernetes agent configured for your project in GitLab. | + +1. You must specify only one of `branches`, `branch_type`, or `agents`. + +Scheduled scan pipelines are triggered by a security policy bot user that is a guest member of the project with elevated permissions for users of type `security_policy_bot` so it may carry out this task. Security policy bot users are automatically created when the security policy project is linked, and removed when the security policy project is unlinked. + +If the project does not have a security policy bot user, the bot will be automatically created, and the following scheduled scan pipeline will use it. + +GitLab supports the following types of CRON syntax for the `cadence` field: + +- A daily cadence of once per hour around specified time, for example: `0 18 * * *` +- A weekly cadence of once per week on a specified day and around specified time, for example: `0 13 * * 0` + +NOTE: +Other elements of the [CRON syntax](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm) may work in the cadence field if supported by the [cron](https://github.com/robfig/cron) we are using in our implementation, however, GitLab does not officially test or support them. +The comma (,), hyphens (-), or step operators (/) are not supported for minutes and hours. +An error is displayed if the cadence is invalid when creating or editing a policy. +The scheduled pipelines for a previously created policy using comma (,), hyphen(-), or step operator (/) in minutes or hours fields is skipped. +The pipelines that have been scheduled will use the `cadence` value to create a new pipeline around the time mentioned in the policy. The pipeline will be executed after a specified time when the resources become available to create it. + +When using the `schedule` rule type in conjunction with the `agents` field, note the following: + +- The GitLab agent for Kubernetes checks every 30 seconds to see if there is an applicable policy. When a policy is found, the scans are executed according to the `cadence` defined. +- The CRON expression is evaluated using the system-time of the Kubernetes-agent pod. + +When using the `schedule` rule type in conjunction with the `branches` field, note the following: + +- The cron worker runs on 15 minute intervals and starts any pipelines that were scheduled to run during the previous 15 minutes. +- Based on your rule, you might expect scheduled pipelines to run with an offset of up to 15 minutes. +- If a policy is enforced on a large number of projects or branches, it will be processed in batches, and it may take some time to create all pipelines. +- The CRON expression is evaluated in standard [UTC](https://www.timeanddate.com/worldclock/timezone/utc) time from GitLab.com. If you have a self-managed GitLab instance and have [changed the server time zone](../../../administration/timezone.md), the CRON expression is evaluated with the new time zone. + + + +### `agent` schema + +Use this schema to define `agents` objects in the [`schedule` rule type](#schedule-rule-type). + +| Field | Type | Required | Description | +|--------------|---------------------|----------|-------------| +| `namespaces` | `array` of `string` | true | The namespace that is scanned. If empty, all namespaces are scanned. | + +#### Policy example + +```yaml +- name: Enforce Container Scanning in cluster connected through my-gitlab-agent for default and kube-system namespaces + enabled: true + rules: + - type: schedule + cadence: '0 10 * * *' + agents: + <agent-name>: + namespaces: + - 'default' + - 'kube-system' + actions: + - scan: container_scanning +``` + +The keys for a schedule rule are: + +- `cadence` (required): a [CRON expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm) for when the scans are run +- `agents:<agent-name>` (required): The name of the agent to use for scanning +- `agents:<agent-name>:namespaces` (optional): The Kubernetes namespaces to scan. If omitted, all namespaces are scanned. + +## `scan` action type + +> - Scan Execution Policies variable precedence was [changed](https://gitlab.com/gitlab-org/gitlab/-/issues/424028) in GitLab 16.7 [with a flag](../../../administration/feature_flags.md) named `security_policies_variables_precedence`. Enabled by default. [Feature flag removed in GitLab 16.8](https://gitlab.com/gitlab-org/gitlab/-/issues/435727). +> - Selection of security templates for given action (for projects) was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/415427) in GitLab 17.1 [with feature flag](../../../administration/feature_flags.md) named `scan_execution_policies_with_latest_templates`. Disabled by default. +> - Selection of security templates for given action (for groups) was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/468981) in GitLab 17.2 [with feature flag](../../../administration/feature_flags.md) named `scan_execution_policies_with_latest_templates_group`. Disabled by default. +> - Selection of security templates for given action (for projects and groups) was enabled on self-managed, and GitLab Dedicated ([1](https://gitlab.com/gitlab-org/gitlab/-/issues/461474), [2](https://gitlab.com/gitlab-org/gitlab/-/issues/468981)) in GitLab 17.2. +> - Selection of security templates for given action (for projects and groups) was generally available in GitLab 17.3. Feature flags `scan_execution_policies_with_latest_templates` and `scan_execution_policies_with_latest_templates_group` removed. + +This action executes the selected `scan` with additional parameters when conditions for at least one +rule in the defined policy are met. + +| Field | Type | Possible values | Description | +|-------|------|-----------------|-------------| +| `scan` | `string` | `sast`, `sast_iac`, `dast`, `secret_detection`, `container_scanning`, `dependency_scanning` | The action's type. | +| `site_profile` | `string` | Name of the selected [DAST site profile](../dast/on-demand_scan.md#site-profile). | The DAST site profile to execute the DAST scan. This field should only be set if `scan` type is `dast`. | +| `scanner_profile` | `string` or `null` | Name of the selected [DAST scanner profile](../dast/on-demand_scan.md#scanner-profile). | The DAST scanner profile to execute the DAST scan. This field should only be set if `scan` type is `dast`.| +| `variables` | `object` | | A set of CI variables, supplied as an array of `key: value` pairs, to apply and enforce for the selected scan. The `key` is the variable name, with its `value` provided as a string. This parameter supports any variable that the GitLab CI job supports for the specified scan. | +| `tags` | `array` of `string` | | A list of runner tags for the policy. The policy jobs are run by runner with the specified tags. | +| `template` | `string` | `default`, `latest` | CI/CD template edition to be enforced. The [`latest`](../../../development/cicd/templates.md#latest-version) edition may introduce breaking changes. | + +NOTE: +If you have Merge Request Pipelines enabled for your project, you must select `template: latest` in your policy for each enforced scan. Using the latest template is crucial for compatibility with Merge Request Pipelines and allows you to take full advantage of GitLab security features. For more information on using security scanning tools with Merge Request Pipelines, please refer to our [security scanning documentation](../../application_security/index.md#use-security-scanning-tools-with-merge-request-pipelines). + +### Scan field details + +There are additional requirements for some of the `scan` action fields. +Some scanners also behave differently in a `scan` action than they do in a regular CI/CD pipeline-based scan. + +#### Profiles + +- You must create the [site profile](../dast/on-demand_scan.md#site-profile) and [scanner profile](../dast/on-demand_scan.md#scanner-profile) + with selected names for each project that is assigned to the selected Security Policy Project. + Otherwise, the policy is not applied and a job with an error message is created instead. +- Once you associate the site profile and scanner profile by name in the policy, it is not possible + to modify or delete them. If you want to modify them, you must first disable the policy by setting + the `active` flag to `false`. +- When configuring policies with a scheduled DAST scan, the author of the commit in the security + policy project's repository must have access to the scanner and site profiles. Otherwise, the scan + is not scheduled successfully. + +#### Scanner behavior + +- For Secret Detection: + - Only rules with the default ruleset are supported. [Custom rulesets](../secret_detection/pipeline/index.md#customize-analyzer-rulesets) are not supported. Alternatively, you may configure a [remote configuration file](../secret_detection/pipeline/index.md#with-a-remote-ruleset) and set the `SECRET_DETECTION_RULESET_GIT_REFERENCE` variable. + - By default, for `scheduled` scan execution policies, secret detection scans configured without any CI variables defined run first in `historic` mode (`SECRET_DETECTION_HISTORIC_SCAN` = `true`). All subsequent scheduled scans run in default mode with `SECRET_DETECTION_LOG_OPTIONS` set to the commit range between last run and current SHA. CI variables provided in the scan execution policy can override this behavior. Learn more about [historic mode](../secret_detection/pipeline/index.md#full-history-pipeline-secret-detection). + - For `triggered` scan execution policies, secret detection works just like regular scan [configured manually in the `.gitlab-ci.yml`](../secret_detection/pipeline/index.md#edit-the-gitlab-ciyml-file-manually). +- A Container Scanning scan that is configured for the `pipeline` rule type ignores the agent defined in the `agents` object. The `agents` object is only considered for `schedule` rule types. + An agent with a name provided in the `agents` object must be created and configured for the project. + +#### CI/CD variables + +Variables defined in a Scan Execution Policy follow the standard [CI/CD variable precedence](../../../ci/variables/index.md#cicd-variable-precedence). + +Preconfigured values are used for the following CI/CD variables in any project on which a scan +execution policy is enforced. Their values can be overridden, but **only** if they are declared in +a policy. They **cannot** be overridden by group or project CI/CD variables: + +```plaintext +DS_EXCLUDED_PATHS: spec, test, tests, tmp +SAST_EXCLUDED_PATHS: spec, test, tests, tmp +SECRET_DETECTION_EXCLUDED_PATHS: '' +SECRET_DETECTION_HISTORIC_SCAN: false +SAST_EXCLUDED_ANALYZERS: '' +DS_EXCLUDED_ANALYZERS: '' +``` + +In GitLab 16.9 and earlier: + +- If the CI/CD variables suffixed `_EXCLUDED_PATHS` were declared in a policy, their values _could_ + be overridden by group or project CI/CD variables. +- If the CI/CD variables suffixed `_EXCLUDED_ANALYZERS` were declared in a policy, their values were + ignored, regardless of where they were defined: policy, group, or project. + +## Security policy scopes + +> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135398) in GitLab 16.7 [with a flag](../../../administration/feature_flags.md) named `security_policies_policy_scope`. Enabled by default. +> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/443594) in GitLab 16.11. Feature flag `security_policies_policy_scope` removed. + +Security policy enforcement depends first on establishing a link between the group, subgroup, or +project on which you want to enforce policies, and the security policy project that contains the +policies. For example, if you are linking policies to a group, a group owner must create the link to +the security policy project. Then, all policies in the security policy project are inherited by all +projects in the group. + +You can refine a security policy's scope to: + +- _Include_ only projects containing a compliance framework label. +- _Include_ or _exclude_ selected projects from enforcement. + +### Policy scope schema + +| Field | Type | Required | Possible values | Description | +|-------|------|----------|-----------------|-------------| +| `policy_scope` | `object` | false | `compliance_frameworks`, `projects` | Scopes the policy based on compliance framework labels or projects you define. | + +#### `policy_scope` scope type + +| Field | Type | Possible values | Description | +|-------|------|-----------------|-------------| +| `compliance_frameworks` | `array` | | List of IDs of the compliance frameworks in scope of enforcement, in an array of objects with key `id`. | +| `projects` | `object` | `including`, `excluding` | Use `excluding:` or `including:` then list the IDs of the projects you wish to include or exclude, in an array of objects with key `id`. | + +#### Example `policy.yml` with security policy scopes + +```yaml +--- +scan_execution_policy: +- name: Enforce DAST in every release pipeline + description: This policy enforces pipeline configuration to have a job with DAST scan for release branches + enabled: true + rules: + - type: pipeline + branches: + - release/* + actions: + - scan: dast + scanner_profile: Scanner Profile A + site_profile: Site Profile B + policy_scope: + compliance_frameworks: + - id: 2 + - id: 11 +- name: Enforce Secret Detection and Container Scanning in every default branch pipeline + description: This policy enforces pipeline configuration to have a job with Secret Detection and Container Scanning scans for the default branch + enabled: true + rules: + - type: pipeline + branches: + - main + actions: + - scan: secret_detection + - scan: sast + variables: + SAST_EXCLUDED_ANALYZERS: brakeman + policy_scope: + projects: + excluding: + - id: 24 + - id: 27 +``` + +## Example security policies project + +You can use this example in a `.gitlab/security-policies/policy.yml` file stored in a +[security policy project](index.md#security-policy-project): + +```yaml +--- +scan_execution_policy: +- name: Enforce DAST in every release pipeline + description: This policy enforces pipeline configuration to have a job with DAST scan for release branches + enabled: true + rules: + - type: pipeline + branches: + - release/* + actions: + - scan: dast + scanner_profile: Scanner Profile A + site_profile: Site Profile B +- name: Enforce DAST and secret detection scans every 10 minutes + description: This policy enforces DAST and secret detection scans to run every 10 minutes + enabled: true + rules: + - type: schedule + branches: + - main + cadence: "*/10 * * * *" + actions: + - scan: dast + scanner_profile: Scanner Profile C + site_profile: Site Profile D + - scan: secret_detection +- name: Enforce Secret Detection and Container Scanning in every default branch pipeline + description: This policy enforces pipeline configuration to have a job with Secret Detection and Container Scanning scans for the default branch + enabled: true + rules: + - type: pipeline + branches: + - main + actions: + - scan: secret_detection + - scan: sast + variables: + SAST_EXCLUDED_ANALYZERS: brakeman + - scan: container_scanning +``` + +In this example: + +- For every pipeline executed on branches that match the `release/*` wildcard (for example, branch + `release/v1.2.1`) + - DAST scans run with `Scanner Profile A` and `Site Profile B`. +- DAST and secret detection scans run every 10 minutes. The DAST scan runs with `Scanner Profile C` + and `Site Profile D`. +- Secret detection, container scanning, and SAST scans run for every pipeline executed on the `main` + branch. The SAST scan runs with the `SAST_EXCLUDED_ANALYZER` variable set to `"brakeman"`. + +## Example for scan execution policy editor + +You can use this example in the YAML mode of the [scan execution policy editor](#scan-execution-policy-editor). +It corresponds to a single object from the previous example. + +```yaml +name: Enforce Secret Detection and Container Scanning in every default branch pipeline +description: This policy enforces pipeline configuration to have a job with Secret Detection and Container Scanning scans for the default branch +enabled: true +rules: + - type: pipeline + branches: + - main +actions: + - scan: secret_detection + - scan: container_scanning +``` + +## Avoiding duplicate scans + +Scan execution policies can cause the same type of scanner to run more than once if developers include scan jobs in the project's +`.gitlab-ci.yml` file. This behavior is intentional as scanners can run more than once with different variables and settings. For example, a +developer may want to try running a SAST scan with different variables than the one enforced by the security and compliance team. In +this case, two SAST jobs run in the pipeline, one with the developer's variables and one with the security and compliance team's variables. + +If you want to avoid running duplicate scans, you can either remove the scans from the project's `.gitlab-ci.yml` file or disable your +local jobs by setting `SAST_DISABLED: "true"`. Disabling jobs this way does not prevent the security jobs defined by scan execution +policies from running. + +## Experimental features + +DETAILS: +**Status:** Experiment has ended + +This experiment has concluded and will not continue. After receiving feedback within this experiment, we will be focusing our efforts on a new policy type for enforcement of custom CI. The experiment will be removed in 17.3. + +Learn more about the [pipeline execution policy](pipeline_execution_policies.md). diff --git a/doc/user/application_security/sast/rules.md b/doc/user/application_security/sast/rules.md index 38140cc659f24044889235e23cfb6653e02464bc..7e3cbdc527d2c78610e43e2dc7652d87425d8f50 100644 --- a/doc/user/application_security/sast/rules.md +++ b/doc/user/application_security/sast/rules.md @@ -78,7 +78,7 @@ To control the rollout of rule changes, you can [pin SAST analyzers to a specifi If you want to make these changes at the same time across multiple projects, consider setting the variables in: - [Group-level CI/CD variables](../../../ci/variables/index.md#for-a-group). -- Custom CI/CD variables in a [Scan Execution Policy](../policies/scan-execution-policies.md). +- Custom CI/CD variables in a [Scan Execution Policy](../policies/scan_execution_policies.md). ## Report a problem with a GitLab SAST rule <!-- This title is intended to match common search queries users might make. --> diff --git a/doc/user/clusters/agent/vulnerabilities.md b/doc/user/clusters/agent/vulnerabilities.md index d92bd154883d81f460e2a93bfe5fa962092441a2..b920d6bd54036b82640c08880dcda765e2c7101c 100644 --- a/doc/user/clusters/agent/vulnerabilities.md +++ b/doc/user/clusters/agent/vulnerabilities.md @@ -75,7 +75,7 @@ For every target namespace, all images in the following workload resources are s ### Enable via scan execution policies To enable scanning of all images within your Kubernetes cluster via scan execution policies, we can use the -[scan execution policy editor](../../application_security/policies/scan-execution-policies.md#scan-execution-policy-editor) +[scan execution policy editor](../../application_security/policies/scan_execution_policies.md#scan-execution-policy-editor) To create a new schedule rule. NOTE: @@ -113,7 +113,7 @@ Other elements of the [CRON syntax](https://docs.oracle.com/cd/E12058_01/doc/doc NOTE: The CRON expression is evaluated in [UTC](https://www.timeanddate.com/worldclock/timezone/utc) using the system-time of the Kubernetes-agent pod. -You can view the complete schema within the [scan execution policy documentation](../../application_security/policies/scan-execution-policies.md#scan-execution-policies-schema). +You can view the complete schema within the [scan execution policy documentation](../../application_security/policies/scan_execution_policies.md#scan-execution-policies-schema). ## Configure scanner resource requirements diff --git a/doc/user/compliance/license_approval_policies.md b/doc/user/compliance/license_approval_policies.md index 342c94f5a9cf051227b50de86da9b8fb9f33b11e..fb752684483fb060cdff257d726f0d71d3d031e0 100644 --- a/doc/user/compliance/license_approval_policies.md +++ b/doc/user/compliance/license_approval_policies.md @@ -33,7 +33,7 @@ License approval policies rely on the output of a dependency scanning job to ver To ensure enforcement of your policies, you should enable dependency scanning on your target development projects. You can achieve this a few different ways: -- Create a global [scan execution policy](../application_security/policies/scan-execution-policies.md) that enforces Dependency Scanning to run in all target development projects. +- Create a global [scan execution policy](../application_security/policies/scan_execution_policies.md) that enforces Dependency Scanning to run in all target development projects. - Use a [Compliance Pipeline](../../user/group/compliance_frameworks.md#compliance-frameworks) to define a Dependency Scanning job that is enforced on projects enforced by a given Compliance Framework. - Work with development teams to configure [Dependency Scanning](../../user/application_security/dependency_scanning/index.md) in each of their project's `.gitlab-ci.yml` files or enable by using the [Security Configuration panel](../application_security/configuration/index.md). diff --git a/doc/user/group/compliance_frameworks.md b/doc/user/group/compliance_frameworks.md index a020743131ec2620e911136c65dacb6bbefb849e..ec7b47392fd4b263dd3515b313a98639ae2e6820 100644 --- a/doc/user/group/compliance_frameworks.md +++ b/doc/user/group/compliance_frameworks.md @@ -14,7 +14,7 @@ You can create a compliance framework that is a label to identify that your proj requirements or needs additional oversight. In the Ultimate tier, the compliance framework can optionally enforce -[compliance pipeline configuration](compliance_pipelines.md) and [security policies](../application_security/policies/scan-execution-policies.md#security-policy-scopes) to the projects on which it is applied. +[compliance pipeline configuration](compliance_pipelines.md) and [security policies](../application_security/policies/scan_execution_policies.md#security-policy-scopes) to the projects on which it is applied. Compliance frameworks are created on top-level groups. If a project is moved outside of its existing top-level group, its frameworks are removed. diff --git a/doc/user/group/compliance_pipelines.md b/doc/user/group/compliance_pipelines.md index df59afe19e90eeebbd3e00448ccd2e72304f4ddb..cdb60b03b51b8086fc40cc41086979606618d7ea 100644 --- a/doc/user/group/compliance_pipelines.md +++ b/doc/user/group/compliance_pipelines.md @@ -69,7 +69,7 @@ framework label, the compliance pipeline configuration is run instead of the lab The user running the pipeline in the labeled project must at least have the Reporter role on the compliance project. When used to enforce scan execution, this feature has some overlap with -[scan execution policies](../application_security/policies/scan-execution-policies.md). We have not +[scan execution policies](../application_security/policies/scan_execution_policies.md). We have not [unified the user experience for these two features](https://gitlab.com/groups/gitlab-org/-/epics/7312). For details on the similarities and differences between these features, see [Enforce scan execution](../application_security/index.md#enforce-scan-execution). diff --git a/doc/user/group/import/index.md b/doc/user/group/import/index.md index c45fd65efbfe56262b4be03fe3bcebcd74dccea4..8cc0de8b124ce4910c70d45ca4c19b16c044371a 100644 --- a/doc/user/group/import/index.md +++ b/doc/user/group/import/index.md @@ -68,7 +68,7 @@ transfer, you must use the [API](../../../api/bulk_imports.md#start-a-new-group- - Because of [issue 406685](https://gitlab.com/gitlab-org/gitlab/-/issues/406685), files with a filename longer than 255 characters are not migrated. - In GitLab 16.1 and earlier, you should **not** use direct transfer with - [scheduled scan execution policies](../../../user/application_security/policies/scan-execution-policies.md). + [scheduled scan execution policies](../../../user/application_security/policies/scan_execution_policies.md). - For a list of other known issues, see [epic 6629](https://gitlab.com/groups/gitlab-org/-/epics/6629). - In GitLab 16.9 and earlier, because of [issue 438422](https://gitlab.com/gitlab-org/gitlab/-/issues/438422), you might see the `DiffNote::NoteDiffFileCreationError` error. When this error occurs, the diff of a note on a merge request's diff diff --git a/ee/app/assets/javascripts/security_orchestration/components/policies/banners/experiment_features_banner.vue b/ee/app/assets/javascripts/security_orchestration/components/policies/banners/experiment_features_banner.vue index d023c9fa485b30796ee7ff5d49dff6b9b117f71b..6e79643afa824b4a3af8976e9ef58bb98cc531e5 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policies/banners/experiment_features_banner.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policies/banners/experiment_features_banner.vue @@ -7,7 +7,7 @@ import { s__ } from '~/locale'; export default { EXPERIMENTAL_FEATURES_PATH: helpPagePath( - 'user/application_security/policies/scan-execution-policies', + 'user/application_security/policies/scan_execution_policies', { anchor: 'experimental-features', }, diff --git a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue index 2c75965f68e681dedb74b761c97938d05c2dc50e..2ea19ddbce6723c017769db1c87070e357f0d373 100644 --- a/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue +++ b/ee/app/assets/javascripts/security_orchestration/components/policy_editor/scan_execution/action/code_block_action.vue @@ -28,7 +28,7 @@ import CodeBlockFilePath from './code_block_file_path.vue'; import CodeBlockImport from './code_block_import.vue'; export default { - SCAN_EXECUTION_PATH: helpPagePath('user/application_security/policies/scan-execution-policies', { + SCAN_EXECUTION_PATH: helpPagePath('user/application_security/policies/scan_execution_policies', { anchor: 'scan-action-type', }), ACTION_AND_LABEL, diff --git a/ee/app/services/security/security_orchestration_policies/project_create_service.rb b/ee/app/services/security/security_orchestration_policies/project_create_service.rb index cc0a5caaf8955b199a3df9db33e4c31714f825a9..cb48762faddd187dbda0dae141fa1b2e13d62f7a 100644 --- a/ee/app/services/security/security_orchestration_policies/project_create_service.rb +++ b/ee/app/services/security/security_orchestration_policies/project_create_service.rb @@ -98,7 +98,7 @@ def url_helpers end def scan_execution_policies_docs_link - url_helpers.help_page_url('user/application_security/policies/scan-execution-policies', + url_helpers.help_page_url('user/application_security/policies/scan_execution_policies', anchor: 'scan-execution-policy-schema') end diff --git a/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md b/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md index 60daec3b5cc7cad8efad89d9d34ac4f7808887b5..c0fb5df1d2898d999cb2b6dfd6d3239c390c1281 100644 --- a/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md +++ b/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md @@ -31,7 +31,7 @@ scan_execution_policy: site_profile: Site Profile D ``` -You can read more about the format and policies schema in the [documentation](http://localhost/help/user/application_security/policies/scan-execution-policies#scan-execution-policy-schema). +You can read more about the format and policies schema in the [documentation](http://localhost/help/user/application_security/policies/scan_execution_policies#scan-execution-policy-schema). ## Default branch protection settings diff --git a/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md b/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md index 9dc587ce8c466aecf8025c656484f99006255403..7a90a62c84fc55580e56720acf5a8fcbb5cb3f4d 100644 --- a/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md +++ b/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md @@ -31,7 +31,7 @@ scan_execution_policy: site_profile: Site Profile D ``` -You can read more about the format and policies schema in the [documentation](http://localhost/help/user/application_security/policies/scan-execution-policies#scan-execution-policy-schema). +You can read more about the format and policies schema in the [documentation](http://localhost/help/user/application_security/policies/scan_execution_policies#scan-execution-policy-schema). ## Default branch protection settings diff --git a/ee/spec/frontend/security_orchestration/components/policies/banners/experiment_features_banner_spec.js b/ee/spec/frontend/security_orchestration/components/policies/banners/experiment_features_banner_spec.js index 6d4f7013b8da95ec2d86e7842cc17b7a108e90df..7bc1d0d15ec3e2087f2501145380f82fec75f322 100644 --- a/ee/spec/frontend/security_orchestration/components/policies/banners/experiment_features_banner_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policies/banners/experiment_features_banner_spec.js @@ -34,7 +34,7 @@ describe('ExperimentFeaturesBanner', () => { 'https://gitlab.com/gitlab-org/gitlab/-/issues/434425', ); expect(findLink().attributes('href')).toBe( - '/help/user/application_security/policies/scan-execution-policies#experimental-features', + '/help/user/application_security/policies/scan_execution_policies#experimental-features', ); });