You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: db/structure.sql
+2
Original file line number
Diff line number
Diff line change
@@ -35754,6 +35754,8 @@ CREATE INDEX index_merge_request_diff_details_on_verification_state ON merge_req
35754
35754
35755
35755
CREATE INDEX index_merge_request_diff_details_pending_verification ON merge_request_diff_details USING btree (verified_at NULLS FIRST) WHERE (verification_state = 0);
35756
35756
35757
+
CREATE INDEX index_merge_request_diff_files_on_project_id ON merge_request_diff_files USING btree (project_id);
35758
+
35757
35759
CREATE INDEX index_merge_request_diffs_by_id_partial ON merge_request_diffs USING btree (id) WHERE ((files_count > 0) AND ((NOT stored_externally) OR (stored_externally IS NULL)));
35758
35760
35759
35761
CREATE INDEX index_merge_request_diffs_on_external_diff ON merge_request_diffs USING btree (external_diff);
Copy file name to clipboardExpand all lines: doc/development/database/database_lab.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,9 @@ You must have `AllFeaturesUser` [`psql` access](#access-database-lab-engine) to
142
142
143
143
To access the database lab instances, you must:
144
144
145
-
- File an [access request](https://handbook.gitlab.com/handbook/it/end-user-services/onboarding-access-requests/access-requests/#individual-or-bulk-access-request).
145
+
- File an [access request](https://handbook.gitlab.com/handbook/it/end-user-services/onboarding-access-requests/access-requests/#individual-or-bulk-access-request), requesting the following:
146
+
-`AllFeaturesUser` role in Postgres.ai
147
+
-`db-lab` role in `chef-repo`
146
148
- Have a user data bag entry in [chef-repo](https://gitlab.com/gitlab-com/gl-infra/chef-repo) with your SSH key and the `db-lab` role.
Copy file name to clipboardExpand all lines: doc/user/application_security/sast/_index.md
+49-21
Original file line number
Diff line number
Diff line change
@@ -513,33 +513,63 @@ For example, to scan a Rust application, you must:
513
513
# include any other file extensions you need to scan from the semgrep-sast template: Jobs/SAST.gitlab-ci.yml
514
514
```
515
515
516
-
### Pre-compilation
516
+
### Using pre-compilation with SpotBugs analyzer
517
517
518
-
Most GitLab SAST analyzers directly scan your source code without compiling it first.
519
-
However, for technical reasons, the SpotBugs-based analyzer scans compiled bytecode.
520
-
521
-
By default, the SpotBugs-based analyzer automatically attempts to fetch dependencies and compile your code so it can be scanned.
518
+
The SpotBugs-based analyzer scans compiled bytecode for `Groovy` projects. By default, it automatically attempts to fetch dependencies and compile your code so it can be scanned.
522
519
Automatic compilation can fail if:
523
520
524
-
- your project requires custom build configurations.
525
-
- you use language versions that aren't built into the analyzer.
521
+
- your project requires custom build configurations
522
+
- you use language versions that aren't built into the analyzer
526
523
527
524
To resolve these issues, you should skip the analyzer's compilation step and directly provide artifacts from an earlier stage in your pipeline instead.
528
525
This strategy is called _pre-compilation_.
529
526
530
-
To use pre-compilation:
527
+
#### Sharing pre-compiled artifacts
528
+
529
+
1. Use a compilation job (typically named `build`) to compile your project and store the compiled output as a `job artifact` using [`artifacts: paths`](../../../ci/yaml/_index.md#artifactspaths).
531
530
532
-
1. Output your project's dependencies to a directory in the project's working directory, then save that directory as an artifact by [setting the `artifacts: paths` configuration](../../../ci/yaml/_index.md#artifactspaths).
533
-
1. Provide the `COMPILE: "false"` CI/CD variable to the analyzer job to disable automatic compilation.
534
-
1. Add your compilation stage as a dependency for the analyzer job.
531
+
- For `Maven` projects, the output folder is usually the `target` directory
532
+
- For `Gradle` projects, it's typically the `build` directory
533
+
- If your project uses a custom output location, set the artifacts path accordingly
535
534
536
-
To allow the analyzer to recognize the compiled artifacts, you must explicitly specify the path to
537
-
the vendored directory.
538
-
This configuration can vary depending on how the project is set up.
539
-
For Maven projects, you can use `MAVEN_REPO_PATH`.
540
-
See [Analyzer settings](#analyzer-settings) for the complete list of available options.
535
+
1. Disable automatic compilation by setting the `COMPILE: "false"` CI/CD variable in the `spotbugs-sast` job.
541
536
542
-
The following example pre-compiles a Maven project and provides it to the SpotBugs-based SAST analyzer:
537
+
1. Ensure the `spotbugs-sast` job depends on the compilation job by setting the `dependencies` keyword. This allows the `spotbugs-sast` job to download and use the artifacts created in the compilation job.
538
+
539
+
The following example pre-compiles a Gradle project and provides the compiled bytecode to the analyzer:
540
+
541
+
```yaml
542
+
stages:
543
+
- build
544
+
- test
545
+
546
+
include:
547
+
- template: Jobs/SAST.gitlab-ci.yml
548
+
549
+
build:
550
+
image: gradle:7.6-jdk8
551
+
stage: build
552
+
script:
553
+
- gradle build
554
+
artifacts:
555
+
paths:
556
+
- build/
557
+
558
+
spotbugs-sast:
559
+
dependencies:
560
+
- build
561
+
variables:
562
+
COMPILE: "false"
563
+
SECURE_LOG_LEVEL: debug
564
+
```
565
+
566
+
#### Specifying dependencies (Maven only)
567
+
568
+
If your project requires external dependencies to be recognized by the analyzer and you're using Maven, you can specify the location of the local repository by using the `MAVEN_REPO_PATH` variable.
569
+
570
+
Specifying dependencies is only supported for Maven-based projects. Other build tools (for example, Gradle) do not have an equivalent mechanism for specifying dependencies. In that case, ensure that your compiled artifacts include all necessary dependencies.
571
+
572
+
The following example pre-compiles a Maven project and provides the compiled bytecode along with the dependencies to the analyzer:
543
573
544
574
```yaml
545
575
stages:
@@ -565,9 +595,7 @@ spotbugs-sast:
565
595
variables:
566
596
MAVEN_REPO_PATH: $CI_PROJECT_DIR/.m2/repository
567
597
COMPILE: "false"
568
-
artifacts:
569
-
reports:
570
-
sast: gl-sast-report.json
598
+
SECURE_LOG_LEVEL: debug
571
599
```
572
600
573
601
### Running jobs in merge request pipelines
@@ -796,7 +824,7 @@ Some analyzers can be customized with CI/CD variables.
796
824
| `FAIL_NEVER` | SpotBugs | Set to `1` to ignore compilation failure. |
797
825
| `SAST_SEMGREP_METRICS` | Semgrep | Set to `"false"` to disable sending anonymized scan metrics to [r2c](https://semgrep.dev). Default: `true`. |
798
826
| `SAST_SCANNER_ALLOWED_CLI_OPTS` | Semgrep | CLI options (arguments with value, or flags) that are passed to the underlying security scanner when running scan operation. Only a limited set of [options](#security-scanner-configuration) are accepted. Separate a CLI option and its value using either a blank space or equals (`=`) character. For example: `name1 value1` or `name1=value1`. Multiple options must be separated by blank spaces. For example: `name1 value1 name2 value2`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/368565) in GitLab 15.3. |
799
-
| `SAST_RULESET_GIT_REFERENCE` | All | Defines a path to a custom ruleset configuration. If a project has a `.gitlab/sast-ruleset.toml` file committed, that local configuration takes precedence and the file from `SAST_RULESET_GIT_REFERENCE` isn’t used. This variable is available for the Ultimate tier only.|
827
+
| `SAST_RULESET_GIT_REFERENCE` | All | Defines a path to a custom ruleset configuration. If a project has a `.gitlab/sast-ruleset.toml` file committed, that local configuration takes precedence and the file from `SAST_RULESET_GIT_REFERENCE` isn't used. This variable is available for the Ultimate tier only.|
800
828
| `SECURE_ENABLE_LOCAL_CONFIGURATION` | All | Enables the option to use custom ruleset configuration. If `SECURE_ENABLE_LOCAL_CONFIGURATION` is set to `false`, the project's custom ruleset configuration file at `.gitlab/sast-ruleset.toml` is ignored and the file from `SAST_RULESET_GIT_REFERENCE` or the default configuration takes precedence. |
Copy file name to clipboardExpand all lines: doc/user/application_security/sast/troubleshooting.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -134,7 +134,7 @@ The SpotBugs-based analyzer is only used for scanning Groovy code, but it may tr
134
134
The solution depends on whether you need to scan Groovy code:
135
135
136
136
- If you don't have any Groovy code, or don't need to scan it, you should [disable the SpotBugs analyzer](analyzers.md#disable-specific-default-analyzers).
137
-
- If you do need to scan Groovy code, you should use [pre-compilation](_index.md#pre-compilation).
137
+
- If you do need to scan Groovy code, you should use [pre-compilation](_index.md#using-pre-compilation-with-spotbugs-analyzer).
138
138
Pre-compilation avoids these failures by scanning an artifact you've already built in your pipeline, rather than trying to compile it in the `spotbugs-sast` job.
0 commit comments