diff --git a/.circleci/config.yml b/.circleci/config.yml
index 4b43026f17..943334a0c7 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -219,10 +219,7 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- #;< CI_GITLEAKS
- *step_setup_remote_docker
- #;> CI_GITLEAKS
#;< VORTEX_DEV
#; Vortex does not track 'composer.lock', so resolve dependencies to give
@@ -261,9 +258,21 @@ jobs:
npx --yes audit-ci@7.1.0 --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
#;> DRUPAL_THEME
- #;< CI_GITLEAKS
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:1.185.0 semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
+ #;< CI_GITLEAKS
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml
index 913cbf6d71..c1efb0e5d7 100644
--- a/.github/workflows/audit.yml
+++ b/.github/workflows/audit.yml
@@ -187,6 +187,24 @@ jobs:
category: npm-audit-theme
#;> DRUPAL_THEME
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
+ # Semgrep's ignore rules, so test directories are excluded here.
+ - name: Scan PHP code for vulnerabilities with Semgrep
+ if: ${{ !cancelled() }}
+ run: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ docker run --rm --volumes-from "${HOSTNAME}" -w "${PWD}" semgrep/semgrep:1.185.0 semgrep scan --config p/php --metrics=off --error --sarif-output=.logs/audit/semgrep.sarif --scan-unknown-extensions . "${files[@]}"
+ continue-on-error: ${{ vars.VORTEX_CI_SEMGREP_IGNORE_FAILURE == '1' }}
+
+ - name: Upload Semgrep findings to code scanning
+ if: ${{ !cancelled() && hashFiles('.logs/audit/semgrep.sarif') != '' }}
+ uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d # v4
+ continue-on-error: true
+ with:
+ sarif_file: .logs/audit/semgrep.sarif
+ category: semgrep
+
#;< CI_GITLEAKS
- name: Scan for committed secrets with Gitleaks
if: ${{ !cancelled() }}
@@ -210,3 +228,39 @@ jobs:
path: .logs/audit
include-hidden-files: true
if-no-files-found: ignore
+
+ # The CodeQL action runs on the runner itself rather than in the CI runner
+ # container. CodeQL on a private repository requires a GitHub Code Security
+ # license.
+ codeql:
+ runs-on: ubuntu-latest
+ if: ${{ vars.VORTEX_CI_CODEQL_SKIP != '1' }}
+
+ permissions:
+ # The code scanning upload reads the workflow run in a private repository.
+ actions: read
+ contents: read
+ security-events: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4
+ with:
+ languages: actions,javascript-typescript
+ build-mode: none
+ #;< VORTEX_DEV
+ config: |
+ paths-ignore:
+ - .vortex/installer/tests/Fixtures
+ #;> VORTEX_DEV
+
+ - name: Scan code for vulnerabilities with CodeQL
+ uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4
+ # CodeQL reports its findings only to code scanning, and the upload fails
+ # without a code scanning entitlement and on fork pull requests.
+ continue-on-error: true
diff --git a/.vortex/docs/.utils/serve-router.php b/.vortex/docs/.utils/serve-router.php
index 288b1f5a8a..15c85bea4c 100644
--- a/.vortex/docs/.utils/serve-router.php
+++ b/.vortex/docs/.utils/serve-router.php
@@ -15,27 +15,27 @@
declare(strict_types=1);
-$doc_root = $_SERVER['DOCUMENT_ROOT'];
+$doc_root = realpath($_SERVER['DOCUMENT_ROOT']);
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$path = is_string($path) ? rawurldecode($path) : '/';
-// Reject traversal outside the build directory before touching the filesystem.
-if (str_contains($path, '..')) {
+$target = realpath($doc_root . $path);
+
+// Reject a path that resolves outside the build directory.
+if ($target !== FALSE && $target !== $doc_root && !str_starts_with($target, $doc_root . DIRECTORY_SEPARATOR)) {
http_response_code(400);
return TRUE;
}
-$target = $doc_root . $path;
-
// Serve an existing file as-is and let the server set the content type.
-if (is_file($target)) {
+if ($target !== FALSE && is_file($target)) {
return FALSE;
}
-$index = rtrim($target, '/') . '/index.html';
+$index = $target === FALSE ? FALSE : realpath($target . '/index.html');
-if (is_file($index)) {
+if ($index !== FALSE && str_starts_with($index, $doc_root . DIRECTORY_SEPARATOR) && is_file($index)) {
header('Content-Type: text/html; charset=UTF-8');
readfile($index);
diff --git a/.vortex/docs/.utils/variables/extra/ci.variables.sh b/.vortex/docs/.utils/variables/extra/ci.variables.sh
index 1ef8a3fdd4..92777ed8ec 100755
--- a/.vortex/docs/.utils/variables/extra/ci.variables.sh
+++ b/.vortex/docs/.utils/variables/extra/ci.variables.sh
@@ -45,6 +45,12 @@ VORTEX_CI_COMPOSER_AUDIT_IGNORE_FAILURE=0
# Ignore `npm audit` failures.
VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE=0
+# Ignore Semgrep failures.
+VORTEX_CI_SEMGREP_IGNORE_FAILURE=0
+
+# Skip the CodeQL scan.
+VORTEX_CI_CODEQL_SKIP=0
+
# Ignore PHPCS failures.
VORTEX_CI_PHPCS_IGNORE_FAILURE=0
diff --git a/.vortex/docs/.vale/config/vocabularies/Vortex/accept.txt b/.vortex/docs/.vale/config/vocabularies/Vortex/accept.txt
index b277af614c..c65b7b99c5 100644
--- a/.vortex/docs/.vale/config/vocabularies/Vortex/accept.txt
+++ b/.vortex/docs/.vale/config/vocabularies/Vortex/accept.txt
@@ -4,6 +4,7 @@ Behat
CircleCI
ClamAV
Codecov
+CodeQL
CodeRabbit
Composer
DCLint
@@ -30,6 +31,7 @@ Prompty
Pygmy
Rector
Renovate
+Semgrep
Solr
Storybook
Stylelint
diff --git a/.vortex/docs/content/continuous-integration/README.mdx b/.vortex/docs/content/continuous-integration/README.mdx
index 20ded51063..c41c3e3350 100644
--- a/.vortex/docs/content/continuous-integration/README.mdx
+++ b/.vortex/docs/content/continuous-integration/README.mdx
@@ -138,8 +138,8 @@ provider defines the workflow in its own file:
| GitHub Actions | The `Security audit` workflow in `.github/workflows/audit.yml` |
| CircleCI | The `audit` workflow in `.circleci/config.yml` |
-The workflow runs the same 4 checks on both providers. The checks read only
-the codebase and its lock files, so the audit never waits for a build:
+The workflow runs the following checks. They read only the codebase and its
+lock files, so the audit never waits for a build:
- `composer audit --locked` checks the packages pinned in `composer.lock`
against published security advisories.
@@ -152,11 +152,19 @@ the codebase and its lock files, so the audit never waits for a build:
`package-lock.json`, with the theme's own `package-audit.jsonc`.
- [Gitleaks](../development/security/secret-scanning.mdx) scans the codebase
for committed secrets.
+- [Semgrep](../development/security/code-scanning.mdx) scans the PHP code
+ for vulnerabilities.
+- [CodeQL](../development/security/code-scanning.mdx) scans the GitHub
+ Actions workflows and the JavaScript code for vulnerabilities. It runs on
+ GitHub Actions only.
-Only the Composer check is always present. The root npm check ships when
-your project keeps ESLint, Stylelint or Jest. The theme check ships with a
-custom theme. The Gitleaks check ships when you turn on secret scanning at
-install time.
+On GitHub Actions, CodeQL runs in a separate `codeql` job of the same
+workflow. The other checks run in the `audit` job.
+
+The Composer, Semgrep and CodeQL checks are always present. The root npm
+check ships when your project keeps ESLint, Stylelint or Jest. The theme
+check ships with a custom theme. The Gitleaks check ships when you turn on
+secret scanning at install time.
Every check runs even if an earlier check failed, so a single run reports
all the findings. The workflow fails if any check failed, unless that
@@ -189,13 +197,17 @@ repository's **Security > Code scanning** tab, each under its own category:
| `npm-audit` | `npm audit` advisories for the root `package-lock.json` |
| `npm-audit-theme` | `npm audit` advisories for the custom theme's `package-lock.json` |
| `gitleaks` | Committed secrets |
+| `semgrep` | Semgrep vulnerabilities in the PHP code |
+| `/language:actions` | CodeQL vulnerabilities in the GitHub Actions workflows |
+| `/language:javascript-typescript` | CodeQL vulnerabilities in the JavaScript and TypeScript code |
Code scanning keeps a history of every finding and tracks whether it's open
or fixed. When you dismiss a false positive, the alert stores the reason,
so the repository needs no ignore entry for it.
-Gitleaks writes SARIF itself. `composer audit` and `npm audit` have no
-SARIF formatter, so each of those checks runs once in JSON format. It pipes
+Gitleaks, Semgrep and CodeQL write SARIF themselves. `composer audit` and
+`npm audit` have no SARIF formatter, so each of those checks runs once in
+JSON format. It pipes
its output through `tee`, which feeds the job log and a report file in
`.logs/audit/` from the same run. The npm checks pass
`--output-format json --report-type full` to `audit-ci`, so `audit-ci`
@@ -222,17 +234,20 @@ it, and private repositories need a GitHub Code Security license.
Without code scanning, and on pull requests from forks where the workflow
token is read-only, the upload step fails and the workflow carries on. The
checks still report their findings in the job log and still fail the
-workflow. Every report is also attached to the run as the
+workflow. CodeQL is the exception: its findings appear only in code
+scanning. Every other report is also attached to the run as the
`security-findings` artifact.
-CircleCI has no code scanning destination. On CircleCI, the same checks run
-and fail the `audit` workflow, and their findings appear only in the job
-log.
+CircleCI has no code scanning destination. On CircleCI, every check except
+CodeQL runs and fails the `audit` workflow, and the findings appear only in
+the job log.
➡️ See [Dependency audit > Dismissing a
-finding](../development/security/dependency-audit.mdx#dismiss-a-finding)
-and [Secret scanning > Dismissing a
+finding](../development/security/dependency-audit.mdx#dismiss-a-finding),
+[Secret scanning > Dismissing a
finding](../development/security/secret-scanning.mdx#dismiss-a-finding)
+and [Code vulnerability scanning > Dismissing a
+finding](../development/security/code-scanning.mdx#dismiss-a-finding)
for what dismissing a finding does and doesn't change.
## Working tree check
@@ -847,6 +862,7 @@ The following table lists the variable for each tool:
| [PHPStan](../development/code-quality/phpstan.mdx) | Analyze PHP code statically | `VORTEX_CI_PHPSTAN_IGNORE_FAILURE` |
| [PHPUnit](../development/testing/phpunit.mdx) | Run unit, kernel and functional tests | `VORTEX_CI_PHPUNIT_IGNORE_FAILURE` |
| [Rector](../development/code-quality/rector.mdx) | Check for automated refactoring rules | `VORTEX_CI_RECTOR_IGNORE_FAILURE` |
+| [Semgrep](../development/security/code-scanning.mdx) | Scan PHP code for vulnerabilities | `VORTEX_CI_SEMGREP_IGNORE_FAILURE` |
| [SDC Devel](../development/code-quality/sdc-devel.mdx) | Validate Single Directory Components | `VORTEX_CI_SDC_DEVEL_IGNORE_FAILURE` |
| [Twig CS Fixer](../development/code-quality/twig-cs-fixer.mdx) | Lint Twig templates | `VORTEX_CI_TWIG_CS_FIXER_IGNORE_FAILURE` |
| [Working tree check](#working-tree-check) | Check for files left behind by the build | `VORTEX_CI_WORKTREE_CHANGES_IGNORE_FAILURE` |
diff --git a/.vortex/docs/content/development/dependency-updates.mdx b/.vortex/docs/content/development/dependency-updates.mdx
index e77aff2c34..20851cb684 100644
--- a/.vortex/docs/content/development/dependency-updates.mdx
+++ b/.vortex/docs/content/development/dependency-updates.mdx
@@ -36,7 +36,7 @@ of each:
| **Drupal core** | `drupal/core-recommended`, `drupal/core-composer-scaffold`, `drupal/core-project-message` and `drupal/core-dev` | Minor, patch | Daily before 2 AM UTC | None |
| **Drupal contrib and PHP packages (non-core)** | All Drupal contrib modules and non-Drupal Packagist packages | Minor, patch | Weekly, Sunday before 2 AM UTC | 14 days for Packagist packages |
| **JS packages** | All npm packages (root `package.json` only) | Minor, patch | Weekly, Sunday before 2 AM UTC | 14 days |
-| **Container images** | Images in `.docker/` and `docker-compose.yml`, and the images CI starts with `docker run` | Major, minor, patch | Daily before 3 AM UTC | 14 days for Docker Hub images |
+| **Container images** | Images in `.docker/` and `docker-compose.yml`, and the images CI starts with `docker run` or `docker create` | Major, minor, patch | Daily before 3 AM UTC | 14 days for Docker Hub images |
| **CI tools** | npm packages that CI runs at a pinned version through `npx` | Major, minor, patch | Daily before 3 AM UTC | 14 days |
| **Renovate version** | The `renovate/renovate` image in `.circleci/update-dependencies.yml`, and the `renovate-version` and `validator_version` inputs in `.github/workflows/` | Major, minor, patch | Weekly, Sunday before 3 AM UTC | 14 days |
| **GitHub Actions** | All actions, and the container images that the jobs in `.github/workflows/` run in, all pinned to digests | Major, minor, patch | Daily before 3 AM UTC | 14 days |
@@ -440,8 +440,9 @@ Renovate reads only the files that the managers in `enabledManagers` cover:
- `docker-compose` for `docker-compose.yml`
- `github-actions` for the workflows in `.github/workflows/`
- `custom.regex` for 5 custom managers: the `IMAGE` build argument in
- `docker-compose.yml`, the `docker run` and `npx --yes` lines in
- `.circleci/config.yml` and `.github/workflows/`, the `renovate/renovate`
+ `docker-compose.yml`, the `docker run`, `docker create` and `npx --yes`
+ lines in `.circleci/config.yml` and `.github/workflows/`, the
+ `renovate/renovate`
image in `.circleci/update-dependencies.yml`, and the `renovate-version`
and `validator_version` inputs in `.github/workflows/`
diff --git a/.vortex/docs/content/development/security/README.mdx b/.vortex/docs/content/development/security/README.mdx
index 60dd58d04f..53ad0d516d 100644
--- a/.vortex/docs/content/development/security/README.mdx
+++ b/.vortex/docs/content/development/security/README.mdx
@@ -6,13 +6,16 @@ sidebar_position: 1
# Security
This overview is for developers and leads on a project built from
-**Vortex**. It shows which check or setting covers each of 3 common risks,
+**Vortex**. It shows which check or setting covers each of 4 common risks,
and where it runs:
- [Secret scanning](secret-scanning.mdx) catches an API token committed to
Git.
- The [dependency audit](dependency-audit.mdx) reports a dependency with a
published vulnerability.
+- [Code vulnerability scanning](code-scanning.mdx) reports a vulnerability
+ in the code your team writes, such as a file path built from request
+ input.
- Shield puts a password prompt in front of a development site on a public
URL. The following section describes it.
@@ -52,7 +55,8 @@ on Lagoon. On Acquia, the platform's own PHP settings apply.
## Continuous integration
-Secret scanning and the dependency audit run in the [security audit
+Secret scanning, the dependency audit and code vulnerability scanning run in
+the [security audit
workflow](../../continuous-integration/README.mdx#security-audit), separate
from the build pipeline. A failing audit therefore shows up separately from
a failing linter, and you can re-run the audit on its own.
@@ -61,7 +65,7 @@ The `deploy` job doesn't depend on the audit, so a failing audit doesn't
stop a deployment. To block merges on the audit, add its check to the
repository's branch protection rules as a required status check.
-In GitHub Actions, both checks also upload their findings to the
+In GitHub Actions, every check also uploads its findings to the
repository's **Security > Code scanning** tab, which keeps an inventory of
the open findings. The GitHub Actions workflow also attaches every report
to the run as the `security-findings` artifact. CircleCI has no code
diff --git a/.vortex/docs/content/development/security/code-scanning.mdx b/.vortex/docs/content/development/security/code-scanning.mdx
new file mode 100644
index 0000000000..69575aebee
--- /dev/null
+++ b/.vortex/docs/content/development/security/code-scanning.mdx
@@ -0,0 +1,116 @@
+---
+sidebar_label: Code vulnerability scanning
+sidebar_position: 4
+---
+
+# Code vulnerability scanning
+
+Code your team writes can carry a vulnerability that no linter flags, such
+as a file path built from request input. This page is for developers and
+leads on a project built from **Vortex**. It shows what the vulnerability
+scanners check, how to run Semgrep locally, how to ignore a false positive
+and where the findings appear in continuous integration (CI).
+
+2 static analysis tools read the code without running it:
+
+| Tool | Code it scans | Providers |
+|------|---------------|-----------|
+| [CodeQL](https://codeql.github.com/) | GitHub Actions workflows, JavaScript and TypeScript | GitHub Actions |
+| [Semgrep](https://semgrep.dev/) | PHP, with the [`p/php`](https://semgrep.dev/p/php) rule set | GitHub Actions and CircleCI |
+
+CodeQL has no PHP analyzer, so Semgrep covers the PHP code.
+
+## Usage
+
+**Vortex** doesn't install Semgrep locally. Run it from its Docker image in
+the project root, with the same version and flags as CI:
+
+```shell
+docker run --rm -v "${PWD}:/src" -w /src semgrep/semgrep:1.185.0 semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . $(git ls-files --cached --others --exclude-standard '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+```
+
+Semgrep scans the files tracked by Git and the untracked files that
+`.gitignore` doesn't exclude. It skips test directories, dependency
+directories and the other paths in its [default ignore
+list](https://semgrep.dev/docs/ignoring-files-folders-code#understand-semgrep-defaults).
+
+Semgrep detects PHP by the `.php` extension only. The `git ls-files` list
+passes the Drupal PHP files with other extensions, such as `.module` and
+`.theme`, and `--scan-unknown-extensions` makes Semgrep scan them as PHP.
+The list includes untracked files and leaves out `tests/` and `test/`
+directories.
+`--error` makes the command exit with `1` when it finds a vulnerability. On
+a clean codebase, the scan ends with `0 findings`.
+
+CodeQL runs only in GitHub Actions.
+
+## Ignore findings
+
+To ignore a Semgrep finding on a line you've assessed, add a `nosemgrep`
+comment with the rule ID from the finding to that line:
+
+```php
+phpinfo(); // nosemgrep: php.lang.security.phpinfo-use.phpinfo-use
+```
+
+To skip a path, list it in a `.semgrepignore` file at the project root.
+That file replaces Semgrep's default ignore list, so also add the default
+paths you still want skipped, such as `tests/`.
+
+Semgrep scans every file passed by name, even when `.semgrepignore` lists
+it. The Drupal files in the `git ls-files` list are passed by name, so
+ignore their findings with `nosemgrep` comments.
+
+CodeQL findings have no in-code exception. Dismiss them in code scanning,
+as described in [Dismiss a finding](#dismiss-a-finding).
+
+## Continuous integration
+
+The scanners run in the [security audit
+workflow](../../continuous-integration/README.mdx#security-audit). Semgrep
+runs in the workflow's `audit` job on both providers. In GitHub Actions,
+CodeQL runs in its own `codeql` job.
+
+A Semgrep finding fails the workflow. CodeQL reports its findings to code
+scanning only, so a CodeQL finding leaves the workflow passing.
+
+### Ignore failures
+
+Set `VORTEX_CI_SEMGREP_IGNORE_FAILURE` to `1` to let the workflow pass
+despite Semgrep findings. In GitHub Actions, set it as a repository
+variable. In CircleCI, set it as an environment variable. Semgrep still
+runs and prints every finding in the job log.
+
+➡️ See [Ignore tool
+failures](../../continuous-integration/README.mdx#ignore-tool-failures).
+
+### Skip CodeQL
+
+CodeQL on a private repository requires a GitHub Code Security license. To
+turn CodeQL off, set the `VORTEX_CI_CODEQL_SKIP` repository variable to `1`.
+The `codeql` job then shows as skipped, and Semgrep keeps running.
+
+### Where findings appear
+
+In GitHub Actions, the findings reach the repository's
+**Security > Code scanning** tab:
+
+- CodeQL uploads its findings under 1 category per language,
+ `/language:actions` and `/language:javascript-typescript`.
+- Semgrep findings go under the `semgrep` category.
+
+The Semgrep report is also attached to the run in the `security-findings`
+artifact. In CircleCI, the findings appear only in the job log.
+
+➡️ See [Code
+scanning](../../continuous-integration/README.mdx#code-scanning).
+
+### Dismiss a finding
+
+Dismissing an alert in the **Security > Code scanning** tab records a reason
+against that finding and removes it from the open list. For a CodeQL
+finding, dismissing is the way to record a false positive.
+
+A dismissed Semgrep alert still fails the workflow. To stop the failure,
+add a `nosemgrep` comment as described in
+[Ignore findings](#ignore-findings).
diff --git a/.vortex/docs/content/development/variables.mdx b/.vortex/docs/content/development/variables.mdx
index be78299b73..c224e96eee 100644
--- a/.vortex/docs/content/development/variables.mdx
+++ b/.vortex/docs/content/development/variables.mdx
@@ -227,6 +227,7 @@ The list below is automatically generated with [Shellvar](https://github.com/ale
| `VORTEX_CI_ARTIFACTS` | Directory to store test artifacts in CI. | `/tmp/artifacts` | `CI config` |
| `VORTEX_CI_BEHAT_IGNORE_FAILURE` | Ignore Behat test failures. | `UNDEFINED` | `CI config` |
| `VORTEX_CI_BEHAT_PROFILE` | Test Behat profile to use in CI. If not set, the `default` profile will be used. | `UNDEFINED` | `CI config` |
+| `VORTEX_CI_CODEQL_SKIP` | Skip the CodeQL scan. | `UNDEFINED` | `CI config` |
| `VORTEX_CI_CODE_COVERAGE_PR_COMMENT_SKIP` | Skip posting code coverage report as a PR comment. | `UNDEFINED` | `CI config` |
| `VORTEX_CI_CODE_COVERAGE_THRESHOLD` | Code coverage threshold percentage. Build fails if coverage is below this value. | `90` | `CI config` |
| `VORTEX_CI_COMPOSER_AUDIT_IGNORE_FAILURE` | Ignore `composer audit` failures. | `UNDEFINED` | `CI config` |
@@ -245,6 +246,7 @@ The list below is automatically generated with [Shellvar](https://github.com/ale
| `VORTEX_CI_PHPSTAN_IGNORE_FAILURE` | Ignore PHPStan failures. | `UNDEFINED` | `CI config` |
| `VORTEX_CI_PHPUNIT_IGNORE_FAILURE` | Ignore PHPUnit test failures. | `UNDEFINED` | `CI config` |
| `VORTEX_CI_RECTOR_IGNORE_FAILURE` | Ignore Rector failures. | `UNDEFINED` | `CI config` |
+| `VORTEX_CI_SEMGREP_IGNORE_FAILURE` | Ignore Semgrep failures. | `UNDEFINED` | `CI config` |
| `VORTEX_CI_TEST_RESULTS` | Directory to store test results in CI. | `/tmp/tests` | `CI config` |
| `VORTEX_CI_TWIG_CS_FIXER_IGNORE_FAILURE` | Ignore Twig CS Fixer failures. | `UNDEFINED` | `CI config` |
| `VORTEX_CI_WORKTREE_CHANGES_IGNORE_FAILURE` | Ignore working tree check failures. | `UNDEFINED` | `CI config` |
diff --git a/.vortex/docs/content/features.mdx b/.vortex/docs/content/features.mdx
index 70df8ab568..f1c2a0e499 100644
--- a/.vortex/docs/content/features.mdx
+++ b/.vortex/docs/content/features.mdx
@@ -188,6 +188,8 @@ import {
- Dependency audit with
[`composer audit`](https://getcomposer.org/doc/03-cli.md#audit) and
[`npm audit`](https://docs.npmjs.com/cli/commands/npm-audit)
+ - Code vulnerability scanning with [CodeQL](https://codeql.github.com/)
+ and [Semgrep](https://semgrep.dev/)
- Findings uploaded to
[GitHub code scanning](https://docs.github.com/en/code-security/code-scanning)
diff --git a/.vortex/docs/cspell.json b/.vortex/docs/cspell.json
index 6b66040eb6..0b3ab87c98 100644
--- a/.vortex/docs/cspell.json
+++ b/.vortex/docs/cspell.json
@@ -35,6 +35,7 @@
"checkstyle",
"clamav",
"cobertura",
+ "codeql",
"coderabbit",
"commandfiles",
"containerisation",
@@ -77,6 +78,7 @@
"minimised",
"minimumReleaseAgeBehaviour",
"multisite",
+ "nosemgrep",
"novnc",
"oomphinc",
"palantirnet",
@@ -99,8 +101,11 @@
"runsheet",
"runsheets",
"sarif",
+ "sast",
"sdc",
"seckit",
+ "semgrep",
+ "semgrepignore",
"shellvar",
"shortlink",
"simpletest",
diff --git a/.vortex/installer/tests/Fixtures/handler_process/_baseline/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/_baseline/.github/workflows/audit.yml
index 5cf0fac15e..b40c85a27b 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/_baseline/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/_baseline/.github/workflows/audit.yml
@@ -160,6 +160,24 @@ jobs:
sarif_file: .logs/audit/npm-audit-theme.sarif
category: npm-audit-theme
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
+ # Semgrep's ignore rules, so test directories are excluded here.
+ - name: Scan PHP code for vulnerabilities with Semgrep
+ if: ${{ !cancelled() }}
+ run: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ docker run --rm --volumes-from "${HOSTNAME}" -w "${PWD}" semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --sarif-output=.logs/audit/semgrep.sarif --scan-unknown-extensions . "${files[@]}"
+ continue-on-error: ${{ vars.VORTEX_CI_SEMGREP_IGNORE_FAILURE == '1' }}
+
+ - name: Upload Semgrep findings to code scanning
+ if: ${{ !cancelled() && hashFiles('.logs/audit/semgrep.sarif') != '' }}
+ uses: github/codeql-action/upload-sarif@__HASH__ # __VERSION__
+ continue-on-error: true
+ with:
+ sarif_file: .logs/audit/semgrep.sarif
+ category: semgrep
+
- name: Scan for committed secrets with Gitleaks
if: ${{ !cancelled() }}
run: docker run --rm --volumes-from "${HOSTNAME}" -w "${PWD}" ghcr.io/gitleaks/gitleaks:__VERSION__ dir . --no-banner --report-format sarif --report-path .logs/audit/gitleaks.sarif
@@ -181,3 +199,34 @@ jobs:
path: .logs/audit
include-hidden-files: true
if-no-files-found: ignore
+
+ # The CodeQL action runs on the runner itself rather than in the CI runner
+ # container. CodeQL on a private repository requires a GitHub Code Security
+ # license.
+ codeql:
+ runs-on: ubuntu-latest
+ if: ${{ vars.VORTEX_CI_CODEQL_SKIP != '1' }}
+
+ permissions:
+ # The code scanning upload reads the workflow run in a private repository.
+ actions: read
+ contents: read
+ security-events: write
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@__HASH__ # __VERSION__
+ with:
+ persist-credentials: false
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@__HASH__ # __VERSION__
+ with:
+ languages: actions,javascript-typescript
+ build-mode: none
+
+ - name: Scan code for vulnerabilities with CodeQL
+ uses: github/codeql-action/analyze@__HASH__ # __VERSION__
+ # CodeQL reports its findings only to code scanning, and the upload fails
+ # without a code scanning entitlement and on fork pull requests.
+ continue-on-error: true
diff --git a/.vortex/installer/tests/Fixtures/handler_process/_baseline/renovate.json b/.vortex/installer/tests/Fixtures/handler_process/_baseline/renovate.json
index 344886a033..6ba6b34b62 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/_baseline/renovate.json
+++ b/.vortex/installer/tests/Fixtures/handler_process/_baseline/renovate.json
@@ -282,7 +282,7 @@
"/^\\.github/workflows/.+\\.yml$/"
],
"matchStrings": [
- "docker run[^\\n]*?\\s(?[a-z0-9][a-z0-9._\\-]*(?:/[a-z0-9._\\-]+)+):(?v?[0-9][\\w.\\-]*)"
+ "docker (?:run|create)[^\\n]*?\\s(?[a-z0-9][a-z0-9._\\-]*(?:/[a-z0-9._\\-]+)+):(?v?[0-9][\\w.\\-]*)"
],
"datasourceTemplate": "docker",
"versioningTemplate": "docker"
diff --git a/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/ciprovider_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml
index 095f6fc249..606617866d 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/code_coverage_provider_codecov_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/code_provider_other/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/code_provider_other/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/code_provider_other/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/code_provider_other/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_all_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml
index 70ccf44837..8fa7556622 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/deploy_types_none_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/deps_updates_provider_ci_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/gitleaks_disabled/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/gitleaks_disabled/.github/workflows/audit.yml
index 4790adba94..90dba5e6dd 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/gitleaks_disabled/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/gitleaks_disabled/.github/workflows/audit.yml
@@ -1,6 +1,6 @@
-@@ -160,19 +160,6 @@
- sarif_file: .logs/audit/npm-audit-theme.sarif
- category: npm-audit-theme
+@@ -178,19 +178,6 @@
+ sarif_file: .logs/audit/semgrep.sarif
+ category: semgrep
- - name: Scan for committed secrets with Gitleaks
- if: ${{ !cancelled() }}
diff --git a/.vortex/installer/tests/Fixtures/handler_process/lighthouse_enabled_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/lighthouse_enabled_circleci/.circleci/config.yml
index 57684e83a9..b23c065637 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/lighthouse_enabled_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/lighthouse_enabled_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/migration_disabled_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml
index 69a8a20830..81e48d2aa2 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/migration_enabled_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/theme_claro/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/theme_claro/.github/workflows/audit.yml
index 3f167425e3..5b712b7c78 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/theme_claro/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/theme_claro/.github/workflows/audit.yml
@@ -32,5 +32,5 @@
- sarif_file: .logs/audit/npm-audit-theme.sarif
- category: npm-audit-theme
- - name: Scan for committed secrets with Gitleaks
- if: ${{ !cancelled() }}
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
diff --git a/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/.github/workflows/audit.yml
index 3f167425e3..5b712b7c78 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/theme_olivero/.github/workflows/audit.yml
@@ -32,5 +32,5 @@
- sarif_file: .logs/audit/npm-audit-theme.sarif
- category: npm-audit-theme
- - name: Scan for committed secrets with Gitleaks
- if: ${{ !cancelled() }}
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
diff --git a/.vortex/installer/tests/Fixtures/handler_process/theme_stark/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/theme_stark/.github/workflows/audit.yml
index 3f167425e3..5b712b7c78 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/theme_stark/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/theme_stark/.github/workflows/audit.yml
@@ -32,5 +32,5 @@
- sarif_file: .logs/audit/npm-audit-theme.sarif
- category: npm-audit-theme
- - name: Scan for committed secrets with Gitleaks
- if: ${{ !cancelled() }}
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
diff --git a/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/timezone_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.circleci/config.yml
index 962162638f..72008711b2 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_lint_circleci/.circleci/config.yml
@@ -176,7 +176,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -204,7 +203,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.circleci/config.yml
index 0b83288c75..47469b644e 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_be_tests_circleci/.circleci/config.yml
@@ -184,7 +184,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -212,7 +211,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.circleci/config.yml
index 0d5dd2cae9..215c773a59 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_circleci/.circleci/config.yml
@@ -177,7 +177,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -195,7 +194,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/.github/workflows/audit.yml
index 0dc5262aec..e8fbe3ae4d 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme/.github/workflows/audit.yml
@@ -55,5 +55,5 @@
- sarif_file: .logs/audit/npm-audit-theme.sarif
- category: npm-audit-theme
- - name: Scan for committed secrets with Gitleaks
- if: ${{ !cancelled() }}
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.circleci/config.yml
index 87d8397465..45a3d0397e 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_groups_no_fe_lint_no_theme_circleci/.circleci/config.yml
@@ -177,7 +177,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -186,7 +185,19 @@ jobs:
command: composer audit --locked || [ "${VORTEX_CI_COMPOSER_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.circleci/config.yml
index 194ac3218b..52d2cbd28c 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_behat_circleci/.circleci/config.yml
@@ -184,7 +184,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -212,7 +211,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.circleci/config.yml
index 3cf240711d..9b9e6a1940 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_dclint_circleci/.circleci/config.yml
@@ -179,7 +179,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -207,7 +206,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.circleci/config.yml
index 64bcd3e9ab..7eb4d5d399 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_docker_linters_circleci/.circleci/config.yml
@@ -172,7 +172,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -200,7 +199,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/.github/workflows/audit.yml
index 3f167425e3..5b712b7c78 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_eslint_no_theme/.github/workflows/audit.yml
@@ -32,5 +32,5 @@
- sarif_file: .logs/audit/npm-audit-theme.sarif
- category: npm-audit-theme
- - name: Scan for committed secrets with Gitleaks
- if: ${{ !cancelled() }}
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.circleci/config.yml
index 37281e8ff5..266736fad2 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_hadolint_circleci/.circleci/config.yml
@@ -181,7 +181,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -209,7 +208,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.circleci/config.yml
index 52fdedfed1..44fd17395a 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_jest_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.circleci/config.yml
index f2aacd0e81..5e5136940e 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpcs_circleci/.circleci/config.yml
@@ -184,7 +184,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -212,7 +211,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.circleci/config.yml
index bf65b2a0ba..5a56d2391d 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpstan_circleci/.circleci/config.yml
@@ -184,7 +184,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -212,7 +211,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.circleci/config.yml
index affec2423a..81991e774a 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_phpunit_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.circleci/config.yml
index 65af74315e..765d138c2a 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_rector_circleci/.circleci/config.yml
@@ -184,7 +184,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -212,7 +211,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.circleci/config.yml
index f56bdf626c..158e9aef29 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_circleci/.circleci/config.yml
@@ -188,7 +188,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -216,7 +215,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/.github/workflows/audit.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/.github/workflows/audit.yml
index 3f167425e3..5b712b7c78 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/.github/workflows/audit.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_stylelint_no_theme/.github/workflows/audit.yml
@@ -32,5 +32,5 @@
- sarif_file: .logs/audit/npm-audit-theme.sarif
- category: npm-audit-theme
- - name: Scan for committed secrets with Gitleaks
- if: ${{ !cancelled() }}
+ # Semgrep detects PHP by the '.php' extension only, so Drupal PHP files
+ # with other extensions are passed explicitly. Explicit targets skip
diff --git a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.circleci/config.yml b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.circleci/config.yml
index 5001ef54a4..a2716701e4 100644
--- a/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.circleci/config.yml
+++ b/.vortex/installer/tests/Fixtures/handler_process/tools_no_twig_circleci/.circleci/config.yml
@@ -184,7 +184,6 @@ jobs:
steps:
- checkout
- *load_variables_from_dotenv
-
- *step_setup_remote_docker
- run:
@@ -212,7 +211,19 @@ jobs:
npx --yes audit-ci@__VERSION__ --high --extra-args=--package-lock-only --directory "${dir}" "${config[@]}" || [ "${VORTEX_CI_NPM_AUDIT_IGNORE_FAILURE:-0}" -eq 1 ]
# The remote Docker engine has no access to the checkout, so the files
- # are copied into the container.
+ # are copied into the container. Semgrep detects PHP by the '.php'
+ # extension only, so Drupal PHP files with other extensions are passed
+ # explicitly. Explicit targets skip Semgrep's ignore rules, so test
+ # directories are excluded here.
+ - run:
+ name: Scan PHP code for vulnerabilities with Semgrep
+ when: always
+ command: |
+ mapfile -t files < <(git ls-files '*.module' '*.install' '*.theme' '*.inc' '*.profile' '*.engine' ':(exclude,glob)**/tests/**' ':(exclude,glob)**/test/**')
+ container="$(docker create --rm -w /src semgrep/semgrep:__VERSION__ semgrep scan --config p/php --metrics=off --error --scan-unknown-extensions . "${files[@]}")"
+ docker cp ./. "${container}:/src"
+ docker start --attach "${container}" || [ "${VORTEX_CI_SEMGREP_IGNORE_FAILURE:-0}" -eq 1 ]
+
- run:
name: Scan for committed secrets with Gitleaks
when: always
diff --git a/.vortex/skills/prepare-vortex-release/SKILL.md b/.vortex/skills/prepare-vortex-release/SKILL.md
index 27a9d23ab0..e1f83ab10c 100644
--- a/.vortex/skills/prepare-vortex-release/SKILL.md
+++ b/.vortex/skills/prepare-vortex-release/SKILL.md
@@ -67,9 +67,10 @@ Work through each checklist item from the release process doc:
unchecked.
2. **Container images** - Check current versions in CI configs, verify if
latest.
- - **CI tool images** - `hadolint`, `dclint`, `gitleaks` and `actionlint`
- are invoked as `docker run :` inside `.github/workflows/**`
- and `.circleci/config.yml`. The `customManagers` regex in
+ - **CI tool images** - `hadolint`, `dclint`, `gitleaks`, `semgrep` and
+ `actionlint` are invoked as `docker run :` or
+ `docker create :` inside `.github/workflows/**` and
+ `.circleci/config.yml`. The `customManagers` regex in
`renovate.json` tracks them, so this is a verification step, not a
manual bump: confirm no open Renovate PR is bumping them and that both
CI providers carry the same tag for the same tool. Bump by hand only
diff --git a/renovate.json b/renovate.json
index c758ec2731..3ffef2dc7e 100644
--- a/renovate.json
+++ b/renovate.json
@@ -285,7 +285,7 @@
"/^\\.github/workflows/.+\\.yml$/"
],
"matchStrings": [
- "docker run[^\\n]*?\\s(?[a-z0-9][a-z0-9._\\-]*(?:/[a-z0-9._\\-]+)+):(?v?[0-9][\\w.\\-]*)"
+ "docker (?:run|create)[^\\n]*?\\s(?[a-z0-9][a-z0-9._\\-]*(?:/[a-z0-9._\\-]+)+):(?v?[0-9][\\w.\\-]*)"
],
"datasourceTemplate": "docker",
"versioningTemplate": "docker"