Repository navigation
Conversation
📝 WalkthroughWalkthroughAdds Dependabot configuration, CodeQL scanning, Composer audit checks, pull request workflow concurrency controls, a vulnerability disclosure policy, and changelog entries describing the new security automation. ChangesSecurity maintenance infrastructure
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| @@ -0,0 +1,54 @@ | |||
| # Security Policy | |||
There was a problem hiding this comment.
Remove the SECURITY.md file
There was a problem hiding this comment.
Pull request overview
Establishes a repository security/supply-chain baseline by adding a security policy, automated dependency auditing, CodeQL scanning for GitHub Actions, and Dependabot updates, along with CI run-concurrency controls.
Changes:
- Add
SECURITY.mddocumenting supported versions and private vulnerability reporting. - Add
composer auditto CI plus workflow-levelconcurrencysettings to reduce redundant PR runs. - Add CodeQL workflow and Dependabot configuration for Composer, GitHub Actions, and Docker.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| SECURITY.md | Adds security policy, supported versions table, and reporting process. |
| CHANGELOG.md | Documents the new security baseline work under Unreleased → Security. |
| .github/workflows/continuous-integration.yaml | Adds composer audit job and workflow-level concurrency control. |
| .github/workflows/codeql.yml | Adds CodeQL workflow for GitHub Actions with schedule + concurrency control. |
| .github/dependabot.yml | Adds Dependabot update rules for Composer, Actions, and Docker. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Added a `SECURITY.md` file describing the supported branches and the private vulnerability-disclosure process. | ||
| * Added a `composer audit` job to the CI pipeline so PRs surface known advisories early. | ||
| * Added a CodeQL workflow that runs `security-and-quality` queries on the repository's GitHub Actions on every push, pull request, and weekly on a schedule. | ||
| * Added Dependabot configuration to keep Composer, GitHub Actions, and Docker dependencies up to date. | ||
| * Added a workflow `concurrency` group to cancel in-progress runs when a new commit lands on the same pull request. |
| on: ['push', 'pull_request'] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} |
| - cron: '17 6 * * 1' | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} |
| pull_request: | ||
| branches: ['9.x'] | ||
| schedule: | ||
| # Run weekly to catch newly published advisories. |
| a public GitHub issue**. Instead use one of the following private channels: | ||
|
|
||
| - Open a [GitHub Security Advisory](https://github.com/ruflin/Elastica/security/advisories/new) | ||
| on the repository (preferred). | ||
| - Or email the maintainer directly at `spam@ruflin.com` with the subject | ||
| prefix `[Elastica security]`. | ||
|
|
…bot, concurrency) Establish a supply-chain and security baseline for the repository: - SECURITY.md documents the supported branches and the private vulnerability-disclosure process (GitHub Security Advisories or email). - A new `audit` job in continuous-integration.yaml runs `composer audit` on every push and pull request so known advisories surface early. - A new CodeQL workflow scans the repository's GitHub Actions with the `security-and-quality` query suite on push, pull request, and weekly. PHP support stays out of scope for now (CodeQL PHP analysis is still in beta as of 2026-04). - A `concurrency` group cancels in-progress runs when a new commit lands on the same pull request, reducing CI cost and noise. - A `dependabot.yml` keeps Composer, GitHub Actions, and the Docker base image up to date with grouped weekly Composer updates. No production code changes.
537f282 to
ca20015
Compare
| uses: 'actions/checkout@v4' | ||
|
|
||
| - name: 'Setup PHP' | ||
| uses: 'shivammathur/setup-php@v2' |
| tools: 'composer:v2' | ||
|
|
||
| - name: 'Install dependencies with Composer' | ||
| uses: 'ramsey/composer-install@v3' |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/continuous-integration.yaml:
- Around line 9-11: Update the audit job configuration in
continuous-integration.yaml to declare minimal GITHUB_TOKEN permissions, setting
contents to read and leaving all unlisted permissions disabled.
- Around line 13-24: Update the Checkout, Setup PHP, and Install dependencies
with Composer steps to reference immutable 40-character commit SHAs instead of
mutable version tags, adding human-readable version comments for each pinned
action. Preserve the existing action configuration and keep the repository’s
Dependabot settings configured to update these pinned references.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5966614c-7261-45e2-a56a-d6698eb011b1
📒 Files selected for processing (5)
.github/dependabot.yml.github/workflows/codeql.yml.github/workflows/continuous-integration.yamlCHANGELOG.mdSECURITY.md
🚧 Files skipped from review as they are similar to previous changes (3)
- SECURITY.md
- .github/dependabot.yml
- CHANGELOG.md
| audit: | ||
| runs-on: 'ubuntu-24.04' | ||
| name: 'Composer audit' |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== workflow excerpt =="
if [ -f .github/workflows/continuous-integration.yaml ]; then
nl -ba .github/workflows/continuous-integration.yaml | sed -n '1,140p'
else
echo "missing .github/workflows/continuous-integration.yaml"
fi
echo
echo "== all local workflow permission declarations =="
python3 - <<'PY'
import pathlib, re
for p in sorted(pathlib.Path('.github/workflows').glob('*.ya*ml')):
text=p.read_text()
print(f'--- {p} ---')
# extract workflow-level and job-level permissions blocks conservatively by indentation,
# then print occurrences to keep focused.
lines=text.splitlines()
for i,l in enumerate(lines,1):
if re.match(r'^(\s*)permissions:', l):
indent=len(l)-len(l.lstrip())
block=[l]
j=i
while j < len(lines):
nxt=lines[j]
if re.match(r'^(\s*)\S', nxt) and len(nxt)-len(nxt.lstrip()) <= indent and nxt.strip() != l.strip():
break
j += 1
block.append(lines[j]) if j <= len(lines) else None
for k,line in enumerate(block):
print(f'{i+k}: {line}')
PY
echo
echo "== default permissions in repository config =="
rg -n "permissions:|GITHUB_TOKEN" .github/workflows || true
git ls-files .github/workflows | sortRepository: ruflin/Elastica
Length of output: 216
🌐 Web query:
GitHub Actions workflow syntax permissions contents read job permissions actions set permissions for GITHUB_TOKEN
💡 Result:
In GitHub Actions, you can configure the permissions granted to the GITHUB_TOKEN using the permissions key in your workflow file [1][2]. This allows you to follow the principle of least privilege by granting only the minimum access required for your jobs [2][3]. Permissions can be defined at two levels: 1. Workflow level: If specified at the top level of the YAML file, the permissions apply to all jobs within the workflow [1][4]. 2. Job level: If specified within a specific job, these permissions override any workflow-level settings for that job [1][4]. When you use the permissions key, any permissions not explicitly listed are set to none [1][3]. For example, if you set only contents: read, all other permissions (such as actions, issues, or packages) will have no access [1][4][3]. Example syntax for setting contents: read: jobs: job_id: runs-on: ubuntu-latest permissions: contents: read steps: - uses: actions/checkout@v4 The contents: read setting is commonly used to allow the workflow to clone or fetch the repository code [5][6]. If your workflow requires additional actions, such as pushing changes or creating releases, you must explicitly set the necessary permissions to write [6]. Key points to remember: - write permissions include read permissions [1]. - If you do not define the permissions key, GitHub applies the default permissions for the repository [6]. - Pull requests from public forks are a special case; they receive a read-only token regardless of these settings [3]. For a complete list of available scopes (such as actions, checks, deployments, packages, etc.), refer to the official GitHub Actions workflow syntax documentation [1][3].
Citations:
- 1: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax
- 2: https://docs.github.com/en/actions/tutorials/authenticate-with-github_token
- 3: https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/
- 4: https://www.kenmuse.com/blog/github-actions-workflow-permissions/
- 5: actions/checkout@009b9ae
- 6: https://adhdecode.com/articles/github-actions/github-actions-workflow-permissions/
🏁 Script executed:
#!/bin/sh
set -euo pipefail
echo "== workflow excerpt =="
awk '{printf "%6d %s\n", NR, $0}' .github/workflows/continuous-integration.yaml | sed -n '1,160p'
echo
echo "== all local workflow permission declarations =="
python3 - <<'PY'
import pathlib, re
pdir = pathlib.Path('.github/workflows')
pdir.mkdir(parents=True, exist_ok=True)
for p in sorted(pdir.glob('*.yml')) + sorted(pdir.glob('*.yaml')):
text = p.read_text()
print(f'--- {p} ---')
lines = text.splitlines()
for i, l in enumerate(lines, 1):
if re.match(r'^(\s*)permissions:', l):
indent = len(l) - len(l.lstrip())
block = [l]
j = i
while j < len(lines):
nxt = lines[j]
if re.match(r'^(\s*)\S', nxt) and len(nxt) - len(nxt.lstrip()) <= indent and nxt.strip() != l.strip():
break
j += 1
if j <= len(lines):
block.append(lines[j])
for k, line in enumerate(block):
print(f'{i+k}: {line}')
PY
echo
echo "== GITHUB_TOKEN / permissions occurrences =="
grep -RInE 'permissions:|GITHUB_TOKEN' .github/workflows || true
git ls-files .github/workflows | sortRepository: ruflin/Elastica
Length of output: 7313
Declare minimal permissions for the audit job.
continuous-integration.yaml has no workflow-level permissions, so this job inherits the repository’s default GITHUB_TOKEN permissions while executing external actions. Set contents: read here; unlisted permissions will be none.
🧰 Tools
🪛 zizmor (1.28.0)
[warning] 9-29: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/continuous-integration.yaml around lines 9 - 11, Update
the audit job configuration in continuous-integration.yaml to declare minimal
GITHUB_TOKEN permissions, setting contents to read and leaving all unlisted
permissions disabled.
Source: Linters/SAST tools
| - name: 'Checkout' | ||
| uses: 'actions/checkout@v4' | ||
|
|
||
| - name: 'Setup PHP' | ||
| uses: 'shivammathur/setup-php@v2' | ||
| with: | ||
| php-version: '8.4' | ||
| coverage: 'none' | ||
| tools: 'composer:v2' | ||
|
|
||
| - name: 'Install dependencies with Composer' | ||
| uses: 'ramsey/composer-install@v3' |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
echo "== workflow excerpt =="
sed -n '1,80p' .github/workflows/continuous-integration.yaml 2>/dev/null || true
echo
echo "== all action uses in workflows =="
rg -n "uses:\s*[^#]+" .github/workflows || true
echo
echo "== commit/tag refs in local repo =="
git rev-parse --symbolic-full-name HEAD HEAD^ 2>/dev/null || true
git show-ref --tags 2>/dev/null | head -40 || trueRepository: ruflin/Elastica
Length of output: 4246
🌐 Web query:
GitHub Actions secure use use full commit SHA branch tag mutable action security
💡 Result:
To secure GitHub Actions workflows against supply chain attacks, it is considered a critical best practice to pin all actions to a full-length (40-character) commit SHA [1][2][3][4][5]. Why Commit SHAs are Required for Security: - Immutability: Unlike branch names (e.g., @main, @master) or version tags (e.g., @v4), which are mutable pointers that can be moved or force-pushed to different commits by anyone with write access to the action's repository, a full commit SHA is cryptographically immutable [1][3][6][7]. - Mitigation of "Retargeting" Attacks: Using mutable references leaves your workflows vulnerable to malicious code injection if an action's repository or maintainer account is compromised [8][7][9]. An attacker can update an existing tag to point to malicious code, which would then be automatically executed by your workflows without any changes to your YAML files [2][6][7]. Pinning to a SHA prevents this entirely [2][3][10]. - Organizational Enforcement: GitHub now supports organization-level policies that can enforce full commit SHA pinning [11][2][9]. When enabled, workflows using mutable references will fail, ensuring compliance across an entire organization [11][2]. Best Practices for Implementation: - Pinning Format: Always use the full 40-character commit SHA [1][3]. - Maintain Readability: To maintain clarity and support automated updates, include the human-readable version tag as a trailing comment in your workflow file [2][8][7]. Example: - uses: actions/checkout@b4ffde6 # v4.1.1 - Automate Updates: Use dependency management tools like Renovate or Dependabot to automate the maintenance of these pinned SHAs [2][3][8][7]. These tools can be configured to track the associated tags and open pull requests when new versions are released, allowing you to update your pins intentionally [2][8][10]. - Transitive Security: Be aware that the security policy applies to the entire dependency tree. If you maintain an action that uses other actions internally, ensure those sub-actions are also pinned to full commit SHAs [11][9]. - Adoption Cooldowns: To further reduce risk, some organizations adopt a "cooldown" period (e.g., 7-14 days) before updating to new pinned versions of actions, which helps catch malicious releases that are often detected quickly [9].
Citations:
- 1: https://docs.github.com/en/actions/how-tos/create-and-publish-actions/manage-custom-actions
- 2: https://architecture.lullabot.com/adr/20260505-pin-github-actions-to-hash/
- 3: https://github.com/kubernetes/community/blob/main/github-management/github-actions-policy.md
- 4: https://github.com/github/docs/blob/962a1c8dccb8c0f66548b324e5b921b5e4fbc3d6/content/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions.md
- 5: https://docs.github.com/en/actions/reference/security/secure-use
- 6: https://nefariousplan.com/posts/tj-actions-mutable-tags-were-always-a-lie
- 7: https://starsling.dev/best-practices/github-actions/pin-action-shas
- 8: https://emmer.dev/blog/pin-your-github-actions-to-protect-against-mutability/
- 9: https://www.wiz.io/blog/github-actions-security-guide
- 10: https://nearform.com/insights/why-you-should-pin-your-github-actions-by-commit-hash/
- 11: https://www.romainlespinasse.dev/posts/github-actions-commit-sha-pinning/
🌐 Web query:
docs.github.com actions reference security hard coding commit SHA Actions
💡 Result:
Pinning GitHub Actions to a full-length commit SHA is a primary security best practice recommended by GitHub to ensure the immutability of the code executed in your workflows [1][2]. Key security considerations include: - Why it is required: Using mutable references like tags (e.g., @v1, @v4) or branch names (e.g., @main) allows the underlying code to be changed or updated silently, posing a supply-chain risk if an action's repository is compromised or a tag is moved [1][3][2]. Pinning to a full 40-character commit SHA ensures that the exact code you audited is the code that runs [4][2]. - Policy Enforcement: GitHub allows administrators to enforce SHA pinning at the repository, organization, and enterprise levels [1][5][6]. When this policy is enabled, any workflow attempting to use an action referenced by a mutable tag or branch will fail [7]. This policy applies to the entire action dependency tree, meaning any internal sub-actions referenced by an action must also be pinned to a SHA [7]. - Managing Updates: While SHA pinning provides immutability, it does not prevent you from keeping your actions up to date. The recommended practice is to pin the action to a full-length commit SHA while keeping the human-readable version as a comment (e.g., uses: actions/checkout@a1b2c3d4e5... # v4.2.0) [3][4]. Tools like Dependabot can track these version comments and automatically open pull requests to update the pinned SHA when a new release is available, providing both security and ease of maintenance [3][5][4]. - Warning against short SHAs: You should always use the full-length (40-character) commit SHA [1][4]. Shortened SHAs are insecure because they are vulnerable to collision attacks where a malicious user could craft a commit that matches the short SHA, leading to ambiguous or compromised references [2]. For detailed configuration steps, refer to GitHub's documentation on securing your workflows [1][6].
Citations:
- 1: https://docs.github.com/en/actions/reference/security/secure-use
- 2: https://docs.github.com/en/enterprise-server@2.22/actions/security-guides/security-hardening-for-github-actions
- 3: https://starsling.dev/best-practices/github-actions/pin-action-shas
- 4: https://tomodahinata.com/en/blog/dependabot-github-actions-sha-pinning-supply-chain-security-guide
- 5: https://github.blog/changelog/2025-08-15-github-actions-policy-now-supports-blocking-and-sha-pinning-actions/
- 6: https://github.com/github/docs/blob/main/content/actions/reference/security/secure-use.md
- 7: https://www.romainlespinasse.dev/posts/github-actions-commit-sha-pinning/
Pin the actions to immutable commit SHAs.
.github/workflows/continuous-integration.yaml pins the audit job to mutable tags (actions/checkout@v4, shivammathur/setup-php@v2, and ramsey/composer-install@v3), so the job can run changed code without workflow changes. Use full 40-character commit SHAs with human-readable version comments, and keep Dependabot configured to update those pins.
🧰 Tools
🪛 GitHub Check: CodeQL
[warning] 17-17: Unpinned tag for a non-immutable Action in workflow or composite action
Unpinned 3rd party Action 'Continuous integration' step Uses Step uses 'shivammathur/setup-php' with ref 'v2', not a pinned commit hash
[warning] 24-24: Unpinned tag for a non-immutable Action in workflow or composite action
Unpinned 3rd party Action 'Continuous integration' step Uses Step uses 'ramsey/composer-install' with ref 'v3', not a pinned commit hash
🪛 zizmor (1.28.0)
[warning] 13-14: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/continuous-integration.yaml around lines 13 - 24, Update
the Checkout, Setup PHP, and Install dependencies with Composer steps to
reference immutable 40-character commit SHAs instead of mutable version tags,
adding human-readable version comments for each pinned action. Preserve the
existing action configuration and keep the repository’s Dependabot settings
configured to update these pinned references.
Source: Linters/SAST tools
Summary
Establish a supply-chain and security baseline for the repository:
SECURITY.md— documents supported branches and the privatevulnerability-disclosure process (GitHub Security Advisories preferred,
email fallback).
composer auditjob incontinuous-integration.yamlruns on everypush and pull request so newly published advisories block the build
early.
security-and-qualityquery suite on push, pull request, and weekly(Mondays 06:17 UTC). PHP support is still in beta as of 2026-04, so it
stays out of the matrix for now; the comment in the workflow explains
how to enable it later.
concurrencygroup in CI cancels in-progress runs when a newcommit lands on the same PR, reducing CI cost and noise.
dependabot.ymlkeeps Composer, GitHub Actions, and the Dockerbase image up to date. Composer updates are grouped (static-analysis,
testing) to limit PR churn.
No production code changes.
Identified during a P0/P1 code-review pass.
Test plan
python3 -c \"import yaml; yaml.safe_load(open(...))\"validates each YAML file.auditjob runscomposer auditcleanly on the current lockfile.Summary by CodeRabbit
Documentation
Chores