Skip to content

CI/CD security baseline: CodeQL config, SBOM submission, markdown/changelog gates#61

Merged
Mehdi-Bl merged 5 commits into
mainfrom
feat/cicd-security-baseline
Feb 11, 2026
Merged

CI/CD security baseline: CodeQL config, SBOM submission, markdown/changelog gates#61
Mehdi-Bl merged 5 commits into
mainfrom
feat/cicd-security-baseline

Conversation

@Mehdi-Bl

@Mehdi-Bl Mehdi-Bl commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a shared CodeQL config file and wire it into CodeQL init
  • publish SBOM data to GitHub dependency graph via dependency snapshot submission
  • add markdown style lint and changelog validation to the lint gate
  • add changelog validator implementation + unit tests
  • add docs plan at \
  • refresh core workflow action pins to current release commits

Validation

  • npm run lint
  • npm test -- --runInBand

Summary by Sourcery

Strengthen the CI/CD security and quality baseline by centralizing CodeQL configuration, enforcing documentation and changelog linting in the lint gate, and wiring SBOM generation into GitHub dependency graph submission while refreshing workflow action pins.

New Features:

  • Add a shared CodeQL configuration file and hook it into the CodeQL analysis workflow.
  • Introduce a changelog validation script and integrate it into the main lint command.
  • Add markdown style linting alongside existing markdown link checks.
  • Generate an SPDX SBOM in CI and submit a dependency snapshot to GitHub dependency graph.

Enhancements:

  • Document the CI/CD security baseline and quality layers in a dedicated plan document.
  • Expand the tests catalog to cover changelog validation tests.
  • Update GitHub Actions and third-party workflow pins to current release SHAs.

Build:

  • Add markdownlint CLI as a development dependency and wire new lint scripts into package.json.

Tests:

  • Add unit tests for the changelog validation script to cover valid/invalid formats and date handling.

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added CI/CD security and quality baseline documentation.
  • Chores

    • Updated GitHub Actions workflows to latest versions for improved security and reliability.
    • Added CodeQL configuration for enhanced code analysis.
    • Implemented changelog and markdown validation in the build process.
    • Added Software Bill of Materials (SBOM) generation support.
  • Tests

    • Added changelog validation test coverage.

@sourcery-ai

sourcery-ai Bot commented Feb 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Establishes a CI/CD security baseline by centralizing CodeQL configuration, submitting SBOM-based dependency snapshots to GitHub, tightening markdown/changelog linting in the main lint gate, documenting the plan, and refreshing workflow action pins to current, maintained commits.

Sequence diagram for SBOM generation and dependency snapshot submission

sequenceDiagram
  participant GH as GitHub_Events
  participant SBW as sbom_workflow
  participant Repo as Repository
  participant NPM as npm_CLI
  participant Anchore as anchore_sbom_action
  participant DepGraph as GitHub_Dependency_Graph

  GH->>SBW: Trigger sbom.yml (push / manual)
  SBW->>Repo: Checkout code
  SBW->>NPM: npm ci
  NPM-->>SBW: Dependencies installed

  SBW->>NPM: npm run sbom
  NPM-->>Repo: Write CycloneDX SBOM (dist/security/sbom/sbom.cyclonedx.json)
  SBW->>SBW: Upload CycloneDX SBOM artifact

  SBW->>SBW: Ensure SBOM output directory
  SBW->>Anchore: Run sbom-action (path ., format spdx-json, dependency-snapshot true)
  Anchore->>Repo: Generate SPDX SBOM (dist/security/sbom/sbom.spdx.json)
  Anchore->>DepGraph: Submit dependency snapshot
  DepGraph-->>Anchore: Snapshot accepted
  Anchore-->>SBW: Action completed
Loading

Class diagram for validate-changelog.js module structure

classDiagram
  class ValidateChangelogModule {
    <<module>>
    +string ROOT_DIR
    +string DEFAULT_CHANGELOG_PATH
    +RegExp RELEASE_HEADING_PATTERN
    +RegExp SECTION_HEADING_PATTERN
    +Set ALLOWED_SECTION_HEADINGS
    +Set STANDARD_SECTION_HEADINGS
    +boolean isValidIsoDate(value)
    +ReleaseHeading[] collectReleaseHeadings(lines)
    +SectionHeading[] collectSectionHeadings(lines, startLineIndex, endLineIndex)
    +string[] validateChangelogContent(content)
    +string[] validateChangelogFile(changelogPath)
    +void run()
  }

  class ReleaseHeading {
    +number lineIndex
    +number lineNumber
    +string version
    +string date
  }

  class SectionHeading {
    +number lineIndex
    +number lineNumber
    +string name
  }

  ValidateChangelogModule "*" o-- ReleaseHeading : uses
  ValidateChangelogModule "*" o-- SectionHeading : uses
Loading

File-Level Changes

Change Details Files
Introduce centralized CodeQL configuration and wire it into CodeQL analysis.
  • Add a shared CodeQL configuration file defining ignored build/dist artifacts.
  • Update the CodeQL workflow to use the new config file via the init step and bump CodeQL action pins to a newer commit.
  • Ensure language matrix analysis runs with a consistent, repository-local policy.
.github/workflows/codeql.yml
.github/codeql/codeql-config.yml
Enhance SBOM workflow to push dependency information into GitHub’s dependency graph.
  • Elevate sbom workflow permissions from contents: read to contents: write to allow dependency snapshot submission.
  • Retain existing CycloneDX SBOM generation and artifact upload behavior.
  • Add an SPDX SBOM generation step using anchore/sbom-action with dependency-snapshot enabled and artifact upload disabled, guarded to only run for trusted refs.
  • Ensure SBOM output directory exists before writing SPDX output.
.github/workflows/sbom.yml
Strengthen lint gate with markdown style checks and changelog format validation, plus tests for the validator.
  • Extend the main lint script to run ESLint, markdown lint, and changelog validation as a single gate.
  • Split markdown lint into link/asset validation and markdownlint-based style checks with a repo-level markdownlint configuration.
  • Implement a changelog validator script that enforces a strict heading/date format, allowed section headings, and requirements for the latest release.
  • Add unit tests covering valid/invalid changelog structures and ISO date validation behavior.
  • Update test catalog docs to reference the new changelog validation test file and command.
package.json
package-lock.json
scripts/validate-changelog.js
tests/unit/scripts/validate-changelog.test.js
tests/catalog.md
.markdownlint.json
Document the CI/CD security baseline and how the new checks fit together.
  • Add a CI/CD security baseline document outlining goals, security/quality layers, and how CodeQL, SBOM, lint gates, and QA workflows interact.
  • Include an example CI workflow pattern showing lint and test steps.
  • Capture change-management guidance for CodeQL exclusions, changelog format, and action pin maintenance.
docs/plan/cicd_security.md
Refresh GitHub Actions pins to current commits across workflows.
  • Update actions/checkout, actions/setup-node, actions/upload-artifact, actions/download-artifact, and github/codeql-action pins to newer commit SHAs in relevant workflows.
  • Update the poutine action pin and its SARIF upload step to newer versions.
  • Ensure QA, release, secrets gate, sbom, sonarcloud, and dependency-review workflows all reference maintained action SHAs without altering their logical behavior.
.github/workflows/release.yml
.github/workflows/sbom.yml
.github/workflows/qa-matrix.yml
.github/workflows/poutine.yml
.github/workflows/secrets-gate.yml
.github/workflows/sonarcloud.yml
.github/workflows/dependency-review.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Mehdi-Bl has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR introduces CI/CD security enhancements including CodeQL configuration, GitHub Actions version updates across multiple workflows, markdown and changelog validation tooling, SBOM generation capabilities, and supporting documentation and test coverage for the new validation infrastructure.

Changes

Cohort / File(s) Summary
CodeQL Configuration
.github/codeql/codeql-config.yml, .github/workflows/codeql.yml
Added new CodeQL configuration file with path exclusions for build and bundle artifacts; updated CodeQL workflow to reference the new config file in the init step.
GitHub Actions Version Updates
.github/workflows/dependency-review.yml, .github/workflows/poutine.yml, .github/workflows/qa-matrix.yml, .github/workflows/release.yml, .github/workflows/secrets-gate.yml, .github/workflows/sonarcloud.yml
Updated action versions across multiple workflows (checkout, setup-node, upload-artifact, download-artifact, etc.) to newer pinned commits; no functional logic changes.
SBOM & Security Workflow
.github/workflows/sbom.yml
Added job permissions for contents write, updated action versions, and introduced new Anchore SBOM generation step with conditional execution for non-PR builds.
Markdown & Changelog Validation
.markdownlint.json, package.json, scripts/validate-changelog.js
Added markdownlint configuration with extended line limits and selective rule toggling; introduced changelog validation script with version/date/section format checks; added npm scripts for markdown link/style linting and changelog validation.
Documentation & Tests
docs/plan/cicd_security.md, tests/catalog.md, tests/unit/scripts/validate-changelog.test.js
Added CI/CD security baseline documentation outlining security gates and implemented features; updated test catalog with new changelog validation command; added comprehensive unit tests for changelog validation utilities.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

Poem

🐰 Hops with glee through CI gates,
CodeQL guards the code estates,
Changelogs validated with care,
SBOM tracks all we share!
Security baseline, now in place,
This rabbit cheers at GitHub's grace! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the three main changes in the PR: CodeQL configuration setup, SBOM submission, and new markdown/changelog validation gates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/cicd-security-baseline

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Review Summary by Qodo

CI/CD security baseline: CodeQL config, SBOM submission, changelog validation

✨ Enhancement 🧪 Tests

Grey Divider

Walkthroughs

Description
• Add changelog validator script with comprehensive format checks
• Implement markdown style linting via markdownlint-cli configuration
• Create CodeQL centralized config to exclude generated build artifacts
• Update SBOM workflow to submit dependency snapshot to GitHub security
• Refresh all GitHub Actions pins to current maintained release commits
Diagram
flowchart LR
  A["Changelog Validator"] --> B["Lint Gate"]
  C["Markdown Style Lint"] --> B
  D["CodeQL Config"] --> E["Code Scanning"]
  F["SBOM Generation"] --> G["Dependency Snapshot"]
  G --> H["GitHub Security"]
  I["Action Pins"] --> J["Maintained Versions"]
  B --> K["CI/CD Baseline"]
  E --> K
  H --> K
  J --> K
Loading

Grey Divider

File Changes

1. scripts/validate-changelog.js ✨ Enhancement +189/-0

Changelog format validation script implementation

scripts/validate-changelog.js


2. tests/unit/scripts/validate-changelog.test.js 🧪 Tests +104/-0

Unit tests for changelog validator functionality

tests/unit/scripts/validate-changelog.test.js


3. .github/codeql/codeql-config.yml ⚙️ Configuration changes +10/-0

CodeQL configuration with build artifact exclusions

.github/codeql/codeql-config.yml


View more (12)
4. .github/workflows/codeql.yml ⚙️ Configuration changes +4/-3

Wire CodeQL config file and update action pins

.github/workflows/codeql.yml


5. .github/workflows/dependency-review.yml Dependencies +1/-1

Update checkout action pin to current release

.github/workflows/dependency-review.yml


6. .github/workflows/poutine.yml Dependencies +4/-4

Update action pins for poutine and artifact uploads

.github/workflows/poutine.yml


7. .github/workflows/qa-matrix.yml Dependencies +5/-5

Update checkout, setup-node, and artifact action pins

.github/workflows/qa-matrix.yml


8. .github/workflows/release.yml Dependencies +13/-13

Update checkout, setup-node, and artifact action pins

.github/workflows/release.yml


9. .github/workflows/sbom.yml ✨ Enhancement +17/-4

Add SPDX SBOM generation and dependency snapshot submission

.github/workflows/sbom.yml


10. .github/workflows/secrets-gate.yml Dependencies +2/-2

Update checkout and artifact action pins

.github/workflows/secrets-gate.yml


11. .github/workflows/sonarcloud.yml Dependencies +2/-2

Update checkout and setup-node action pins

.github/workflows/sonarcloud.yml


12. .markdownlint.json ⚙️ Configuration changes +11/-0

Markdown style lint configuration with custom rules

.markdownlint.json


13. docs/plan/cicd_security.md 📝 Documentation +90/-0

CI/CD security baseline documentation and implementation guide

docs/plan/cicd_security.md


14. package.json ⚙️ Configuration changes +6/-2

Add changelog validation and markdown style lint npm scripts

package.json


15. tests/catalog.md 📝 Documentation +20/-18

Document changelog validation test coverage in catalog

tests/catalog.md


Grey Divider

Qodo Logo

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @Mehdi-Bl, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's CI/CD security and quality posture. It establishes a robust security baseline by integrating static code analysis with CodeQL, improving software supply-chain visibility through SBOM submission, and enforcing documentation quality standards with new markdown and changelog validation gates. These changes aim to proactively identify vulnerabilities and maintain high code and documentation quality.

Highlights

  • CodeQL Configuration: Introduced a shared CodeQL configuration file to standardize static analysis and ignore generated build artifacts.
  • SBOM Submission: Enabled publishing of Software Bill of Materials (SBOM) data to the GitHub dependency graph for enhanced supply-chain visibility.
  • Markdown and Changelog Gates: Integrated markdown style linting and changelog format validation into the CI/CD linting process to enforce documentation quality standards.
  • Changelog Validator: Developed a new script and comprehensive unit tests for enforcing changelog formatting rules, including release headings, dates, and section types.
  • CI/CD Security Baseline Documentation: Added a detailed document outlining the project's CI/CD security and quality baseline plan.
  • GitHub Actions Refresh: Refreshed GitHub Actions pins to their latest stable release commits for improved security and reliability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .github/codeql/codeql-config.yml
    • Added a new CodeQL configuration file, specifying paths to ignore during analysis.
  • .markdownlint.json
    • Added a new configuration file for markdown style linting, setting rules like line length and heading requirements.
  • docs/plan/cicd_security.md
    • Added a new document outlining the CI/CD security baseline plan, including goals, security layers, and implemented baselines.
  • package-lock.json
    • Updated numerous package dependencies, primarily adding markdownlint-cli and its related dependencies, along with other minor dependency updates.
  • package.json
    • Modified the lint script to include markdown style linting and changelog validation.
    • Added new lint:md:links, lint:md:style, and changelog:validate scripts.
    • Added markdownlint-cli as a dev dependency.
  • scripts/validate-changelog.js
    • Added a new Node.js script to validate the format and content of the CHANGELOG.md file, checking release headings, dates, and section types.
  • tests/catalog.md
    • Updated the unit tests catalog to include the newly added changelog validation script.
  • tests/unit/scripts/validate-changelog.test.js
    • Added unit tests for the validate-changelog.js script, covering valid and invalid changelog scenarios.
Ignored Files
  • Ignored by pattern: .github/workflows/** (8)
    • .github/workflows/codeql.yml
    • .github/workflows/dependency-review.yml
    • .github/workflows/poutine.yml
    • .github/workflows/qa-matrix.yml
    • .github/workflows/release.yml
    • .github/workflows/sbom.yml
    • .github/workflows/secrets-gate.yml
    • .github/workflows/sonarcloud.yml
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions

github-actions Bot commented Feb 11, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The lint script now always runs changelog:validate, which will fail if CHANGELOG.md is missing; consider either skipping validation when the file is absent or providing a separate CI-only script so local linting remains usable in freshly cloned or experimental branches.
  • The markdownlint invocation targets "**/*.{md,mdx}" while only ignoring node_modules and dist; you may want to extend the ignore set (e.g., coverage, build, generated docs) to avoid enforcing style on generated Markdown artifacts.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `lint` script now always runs `changelog:validate`, which will fail if `CHANGELOG.md` is missing; consider either skipping validation when the file is absent or providing a separate CI-only script so local linting remains usable in freshly cloned or experimental branches.
- The `markdownlint` invocation targets `"**/*.{md,mdx}"` while only ignoring `node_modules` and `dist`; you may want to extend the ignore set (e.g., `coverage`, `build`, generated docs) to avoid enforcing style on generated Markdown artifacts.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a solid baseline for CI/CD security and quality. The addition of a CodeQL configuration, markdown linting, and changelog validation significantly improves the project's maintainability and robustness. The new documentation in docs/plan/cicd_security.md is clear and provides a great overview of the implemented quality gates. I've added a few suggestions to further improve the new changelog validation script and to optimize the execution of the new linting tasks.

Comment thread package.json
Comment on lines +20 to +21
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint src tests --ext .js,.jsx,.ts,.tsx --cache && npm run lint:md && npm run changelog:validate",
"lint:md": "npm run lint:md:links && npm run lint:md:style",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The lint and lint:md scripts run their sub-tasks sequentially using &&. Since these linting tasks (ESLint, markdown links, markdown style, changelog validation) are independent, you could run them in parallel to potentially speed up the overall linting process. You already have concurrently in your devDependencies, which would be perfect for this.

To do this, you would need to extract the eslint command into its own script (e.g., eslint-main), and then orchestrate the parallel execution as shown in the suggestion.

Suggested change
"lint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint src tests --ext .js,.jsx,.ts,.tsx --cache && npm run lint:md && npm run changelog:validate",
"lint:md": "npm run lint:md:links && npm run lint:md:style",
"lint": "concurrently \"npm:eslint-main\" \"npm:lint:md\" \"npm:changelog:validate\"",
"lint:md": "concurrently \"npm:lint:md:links\" \"npm:lint:md:style\"",

Comment thread scripts/validate-changelog.js Outdated
Comment on lines +8 to +9
const RELEASE_HEADING_PATTERN = /^##\s+\[(v?\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?)\]\s+-\s+(\d{4}-\d{2}-\d{2})\s*$/;
const SECTION_HEADING_PATTERN = /^###\s+(.+?)\s*$/;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For improved readability and maintainability, you could use named capture groups for these regular expressions. This makes the intent of the captured groups explicit and avoids relying on index-based access later in the code.

Suggested change
const RELEASE_HEADING_PATTERN = /^##\s+\[(v?\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?)\]\s+-\s+(\d{4}-\d{2}-\d{2})\s*$/;
const SECTION_HEADING_PATTERN = /^###\s+(.+?)\s*$/;
const RELEASE_HEADING_PATTERN = /^##\s+\[(?<version>v?\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?) \]\s+-\s+(?<date>\d{4}-\d{2}-\d{2})\s*$/;
const SECTION_HEADING_PATTERN = /^###\s+(?<name>.+?)\s*$/;

return false;
}

const [year, month, day] = value.split('-').map((part) => Number(part));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

You can simplify this mapping by passing the Number constructor directly to map.

Suggested change
const [year, month, day] = value.split('-').map((part) => Number(part));
const [year, month, day] = value.split('-').map(Number);

Comment thread scripts/validate-changelog.js Outdated
Comment on lines +52 to +53
version: match[1],
date: match[2],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

With the change to use named capture groups in RELEASE_HEADING_PATTERN, you can now access the captured values by name, which is more readable and less error-prone than using indices.

Suggested change
version: match[1],
date: match[2],
version: match.groups.version,
date: match.groups.date,

Comment thread scripts/validate-changelog.js Outdated
headings.push({
lineIndex: index,
lineNumber: index + 1,
name: match[1],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

With the change to use a named capture group in SECTION_HEADING_PATTERN, you can access the captured value by name for better code clarity.

Suggested change
name: match[1],
name: match.groups.name,

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Feb 11, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. SBOM PR write permission 🐞 Bug ⛨ Security
Description
.github/workflows/sbom.yml now grants contents: write at workflow scope while also running on
pull_request, which is broader than necessary and increases risk if PR code paths are abused. The
dependency snapshot step is guarded, but the write-scoped token still applies to the whole job; this
should be split/scoped to non-PR contexts or a separate job with elevated permissions only when
needed.
Code

.github/workflows/sbom.yml[11]

+  contents: write
Evidence
The SBOM workflow is triggered for PRs and grants write permission to repository contents for the
entire workflow/job, even though only the dependency snapshot submission needs elevated permissions.
While the snapshot-submission step is conditionally gated, the token permissions remain elevated for
earlier steps as well.

.github/workflows/sbom.yml[3-12]
.github/workflows/sbom.yml[29-33]
.github/workflows/sbom.yml[45-47]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`.github/workflows/sbom.yml` grants `contents: write` for all triggers including `pull_request`. Even though the dependency snapshot submission step is gated, the elevated token permission is still present for the whole job.
### Issue Context
Only the dependency snapshot submission needs elevated privileges; CycloneDX SBOM artifact generation and upload do not.
### Fix Focus Areas
- .github/workflows/sbom.yml[1-53]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Release script vs changelog gate 🐞 Bug ✓ Correctness
Description
The new changelog validator requires the *latest* release entry to contain at least one ###
section heading (e.g., Added/Fixed), and npm run lint now enforces it. However, the existing
release automation (scripts/lib/release.js) generates new changelog entries without any ###
sections, so using the release script will produce a CHANGELOG that fails the new lint gate.
Code

scripts/validate-changelog.js[R126-141]

+    if (index === 0) {
+      if (sectionHeadings.length === 0) {
+        errors.push(
+          `Latest release ${release.version} must include at least one section heading (for example: Added, Changed, Improved, Fixed, Security).`
+        );
+        continue;
+      }
+
+      const hasStandardSection = sectionHeadings.some((section) =>
+        STANDARD_SECTION_HEADINGS.has(section.name)
+      );
+      if (!hasStandardSection) {
+        errors.push(
+          `Latest release ${release.version} must include at least one standard section heading: Added, Changed, Improved, Fixed, or Security.`
+        );
+      }
Evidence
The validator enforces section headings for the newest release, and lint now runs this validator.
The release helper writes a newest-release entry as just a ## [...] heading followed by bullets,
which will trigger the validator error for the latest release (no ### headings).

scripts/validate-changelog.js[126-141]
package.json[20-24]
scripts/lib/release.js[83-89]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Changelog validation now requires section headings for the latest release, but the existing release automation writes entries without them. This makes the release script produce a CHANGELOG that fails `npm run lint`.
### Issue Context
- Validator requires at least one `###` section heading for the latest release.
- `npm run lint` now runs `changelog:validate`.
- `scripts/lib/release.js` currently writes only `## [vX.Y.Z] - YYYY-MM-DD` + bullet list.
### Fix Focus Areas
- scripts/lib/release.js[83-89]
- scripts/validate-changelog.js[126-141]
- package.json[20-24]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread .github/workflows/sbom.yml Outdated

permissions:
contents: read
contents: write

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Sbom pr write permission 🐞 Bug ⛨ Security

.github/workflows/sbom.yml now grants contents: write at workflow scope while also running on
pull_request, which is broader than necessary and increases risk if PR code paths are abused. The
dependency snapshot step is guarded, but the write-scoped token still applies to the whole job; this
should be split/scoped to non-PR contexts or a separate job with elevated permissions only when
needed.
Agent Prompt
### Issue description
`.github/workflows/sbom.yml` grants `contents: write` for all triggers including `pull_request`. Even though the dependency snapshot submission step is gated, the elevated token permission is still present for the whole job.

### Issue Context
Only the dependency snapshot submission needs elevated privileges; CycloneDX SBOM artifact generation and upload do not.

### Fix Focus Areas
- .github/workflows/sbom.yml[1-53]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +126 to +141
if (index === 0) {
if (sectionHeadings.length === 0) {
errors.push(
`Latest release ${release.version} must include at least one section heading (for example: Added, Changed, Improved, Fixed, Security).`
);
continue;
}

const hasStandardSection = sectionHeadings.some((section) =>
STANDARD_SECTION_HEADINGS.has(section.name)
);
if (!hasStandardSection) {
errors.push(
`Latest release ${release.version} must include at least one standard section heading: Added, Changed, Improved, Fixed, or Security.`
);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Release script vs changelog gate 🐞 Bug ✓ Correctness

The new changelog validator requires the *latest* release entry to contain at least one ###
section heading (e.g., Added/Fixed), and npm run lint now enforces it. However, the existing
release automation (scripts/lib/release.js) generates new changelog entries without any ###
sections, so using the release script will produce a CHANGELOG that fails the new lint gate.
Agent Prompt
### Issue description
Changelog validation now requires section headings for the latest release, but the existing release automation writes entries without them. This makes the release script produce a CHANGELOG that fails `npm run lint`.

### Issue Context
- Validator requires at least one `###` section heading for the latest release.
- `npm run lint` now runs `changelog:validate`.
- `scripts/lib/release.js` currently writes only `## [vX.Y.Z] - YYYY-MM-DD` + bullet list.

### Fix Focus Areas
- scripts/lib/release.js[83-89]
- scripts/validate-changelog.js[126-141]
- package.json[20-24]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@sonarqubecloud

Copy link
Copy Markdown

@Mehdi-Bl Mehdi-Bl merged commit b1c175d into main Feb 11, 2026
17 checks passed
@Mehdi-Bl Mehdi-Bl deleted the feat/cicd-security-baseline branch February 11, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant