gitlab: scan CI/CD YAML in gl scan and add gl cicd scan command - #700
Merged
Conversation
frjcomp
commented
Aug 27, 2026
Collaborator
- gl scan now also fetches each project's merged .gitlab-ci.yml via the CI lint API and scans it for secrets, in addition to job logs/artifacts
- add new gl cicd scan subcommand that only scans CI/CD YAML (no job logs/artifacts), reusing the existing scan/queue infrastructure via a CICDYamlOnly mode
- add unit and e2e test coverage for both changes
- gl scan now also fetches each project's merged .gitlab-ci.yml via the CI lint API and scans it for secrets, in addition to job logs/artifacts - add new gl cicd scan subcommand that only scans CI/CD YAML (no job logs/artifacts), reusing the existing scan/queue infrastructure via a CICDYamlOnly mode - add unit and e2e test coverage for both changes
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends Pipeleek’s GitLab scanning capabilities by adding CI/CD YAML scanning (via the GitLab CI Lint merged YAML output) to the existing gl scan flow, and introducing a dedicated gl cicd scan command that scans only the merged .gitlab-ci.yml (no job logs/artifacts), reusing the existing scan queue infrastructure.
Changes:
- Enqueue and scan each project’s merged CI/CD YAML during GitLab scans (new queue item type + analyzer).
- Add new
gl cicd scansubcommand that runs in “CI/CD YAML only” mode. - Add unit + e2e coverage for both the enhanced
gl scanbehavior and the new command.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/e2e/gitlab/scan/scan_test.go | Adds e2e coverage that gl scan hits ci/lint and detects a secret in merged YAML. |
| tests/e2e/gitlab/cicd/scan/scan_test.go | New e2e tests for gl cicd scan behavior (YAML-only, repo flag, required flags). |
| pkg/gitlab/scan/queue.go | Adds QueueItemCICDYaml handling and analysis pipeline for merged CI/CD YAML. |
| pkg/gitlab/scan/pipeline.go | Adds CICDYamlOnly option and enqueues CI/CD YAML scan items per project. |
| internal/cmd/gitlab/cicd/scan/scan.go | New Cobra command implementation for gl cicd scan. |
| internal/cmd/gitlab/cicd/scan/scan_test.go | New unit tests verifying flags/bindings and handler wiring for gl cicd scan. |
| internal/cmd/gitlab/cicd/cicd.go | Registers the new scan subcommand under gl cicd. |
Suppressed comments (1)
pkg/gitlab/scan/queue.go:237
- Log message uses
YML; consider standardizing toYAMLfor consistency with the rest of the code/docs.
if err != nil {
log.Debug().Err(err).Int("project", item.Meta.ProjectId).Msg("Failed detecting secrets in CI/CD YML")
return
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- fix duplicate package declaration in cicd/scan/scan_test.go - tighten e2e path assertion to catch job-listing regressions - read common.hit_timeout from config so file/env overrides take effect - remove package-level mutable options var; use a local options struct per run - standardize CI/CD YAML log wording (YML -> YAML)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.