Skip to content

NO-ISSUE: Pin osac-test-infra refs and add SAST/SCA gates - #16

Merged
eliorerz merged 1 commit into
osac-project:mainfrom
eliorerz:fix-security-gates
Jul 31, 2026
Merged

eliorerz merged 1 commit into
osac-project:mainfrom
eliorerz:fix-security-gates

Conversation

@eliorerz

@eliorerz eliorerz commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the 2 pre-existing repo-wide gaps CodeRabbit flagged on #14 (branch split-e2e-workflows-with-schedules), which were deliberately deferred there as out of scope for that PR. Branched off upstream/main, independent of #14.

1. Pin osac-test-infra reusable-workflow references from @main to a commit SHA

e2e-bmaas-full-install.yml and e2e-vmaas-full-install.yml referenced osac-project/osac-test-infra/.github/workflows/e2e-{bmaas,vmaas}-full-install.yml@main. Pinned both to 5347598040856b07c61afed01b5b1e6f428c81d7, verified as osac-test-infra's current main HEAD via gh api repos/osac-project/osac-test-infra/commits/main --jq .sha immediately before pinning. Added a one-line comment above each (# bump this SHA when osac-test-infra reusable workflows change) since the trade-off of pinning is that this repo won't pick up new osac-test-infra fixes/features until someone manually bumps it.

e2e-caas-full-install.yml doesn't exist on main yet -- it only exists on the still-open #14 branch -- so it isn't touched here. It'll get the same pin naturally once #14 merges (or can be pinned directly on that branch if preferred).

2. Add a pinned SAST/SCA gate

Verified there was no SAST or SCA/dependency-scanning workflow anywhere in .github/workflows/ before this change. Added two new pull-request-triggered workflows, both pinned to full commit SHAs:

  • .github/workflows/dependency-review.yml -- actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 (v5.0.0), plus actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 (v7.0.1, matching the SHA already pinned elsewhere in this repo). Fails the PR check when it introduces a new dependency with a known vulnerability -- the SCA gate.
  • .github/workflows/codeql.yml -- github/codeql-action/{init,autobuild,analyze}@f205ea1c3313d32999d8d6a48b4f6530d4437b38 (v4.37.4), matrixed over go (fulfillment-service, osac-operator) and python (fulfillment-service dev tooling).

Judgment call on CodeQL fail-on-findings behavior: the original ask was to "fail the pipeline when findings are detected." I did not implement that literally. CodeQL's standard behavior is to scan and upload results to the repo's Security tab rather than fail the run on findings; hard-failing on any finding count > 0 would make this new workflow immediately red on every future PR until someone triages whatever pre-existing findings already exist in this codebase -- a much larger, noisier policy change than "add a scanning gate," and one this PR shouldn't sneak in as a side effect. I went with standard CodeQL behavior (scan + report to Security tab), with the "gate" being the analyze job itself completing successfully (so build/scan tooling failures still fail the check). A defensible middle ground if stricter enforcement is wanted later: use CodeQL's severity-filtering query options to fail only on error/critical-level findings once the existing backlog (if any) has been triaged -- happy to follow up with that once someone's looked at the Security tab post-merge.

Validation

  • All 4 changed/new YAML files parse cleanly (yaml.safe_load).
  • pre-commit run on the changed files passes (trailing-whitespace, yamllint, etc.).
  • Did not run the dependency-review/CodeQL actions themselves locally (not practical); cross-checked action inputs/structure against each action's README/action.yml on GitHub.

Test plan

  • CI runs dependency-review and codeql on this PR and both complete without tooling errors
  • e2e-bmaas-full-install / e2e-vmaas-full-install still resolve and run correctly against the pinned osac-test-infra SHA

Summary by CodeRabbit

  • Chores
    • Added automated security analysis for Go and Python code during pull requests.
    • Added dependency vulnerability checks for newly introduced dependencies.
    • Improved the reliability and reproducibility of full-install end-to-end testing by locking workflow versions to specific revisions.
    • Enhanced repository safeguards with required permissions and controlled workflow execution.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@eliorerz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 15 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3791a65c-0b7d-4855-b238-9e95e86e6fa2

📥 Commits

Reviewing files that changed from the base of the PR and between 9260f1e and accb2ad.

📒 Files selected for processing (5)
  • .github/workflows/codeql.yml
  • .github/workflows/dependency-review.yml
  • .github/workflows/e2e-bmaas-full-install.yml
  • .github/workflows/e2e-caas-full-install.yml
  • .github/workflows/e2e-vmaas-full-install.yml

Walkthrough

The PR adds CodeQL and dependency-review workflows for pull requests targeting main. It also pins the reusable osac-test-infra workflow in the BMaaS and VMaaS E2E workflows to a fixed commit.

Changes

CI security and workflow control

Layer / File(s) Summary
CodeQL analysis workflow
.github/workflows/codeql.yml
Adds Go and Python CodeQL analysis with conditional Go setup, autobuild, and language-specific result uploads.
Dependency review workflow
.github/workflows/dependency-review.yml
Adds dependency review for pull requests targeting main with pinned actions and read-only repository access.
Pinned E2E workflow references
.github/workflows/e2e-bmaas-full-install.yml, .github/workflows/e2e-vmaas-full-install.yml
Replaces osac-test-infra@main with commit 5347598040856b07c61afed01b5b1e6f428c81d7.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • osac-project/osac#10: Both PRs modify the BMaaS E2E workflow; this PR pins its reusable workflow reference.
🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Ai-Attribution ⚠️ Warning CodeRabbit is mentioned, but the sole PR commit has no Assisted-by or Generated-by trailer. It also has no Co-Authored-By trailer. Amend each PR commit with a valid Red Hat Assisted-by or Generated-by trailer for the AI tool. Do not use Co-Authored-By for AI attribution.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: pinning osac-test-infra workflow references and adding SAST and SCA workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Hardcoded-Secrets ✅ Passed Changed workflows contain only pinned 40-character commit SHAs and normal inputs; scans found no secret assignments, credential URLs, private-key material, or recognizable token formats.
No-Weak-Crypto ✅ Passed The patch changes only four workflow YAML files; added lines contain no MD5, SHA-1, DES, RC4, Blowfish, ECB, custom crypto, or secret comparisons. Hex SHAs are action/workflow pins.
No-Injection-Vectors ✅ Passed The commit changes only four workflow YAML files; added-line scans found no SQL concatenation, shell=True, eval/exec, pickle.loads, unsafe yaml.load, os.system, or dangerouslySetInnerHTML.
Container-Privileges ✅ Passed The PR adds only GitHub Actions workflows and SHA pins; no privileged, host namespace, SYS_ADMIN, root, or allowPrivilegeEscalation settings are present.
No-Sensitive-Data-In-Logs ✅ Passed The patch adds no secret-bearing log commands. E2E logs contain only job results; new CodeQL, dependency-review, and setup-go steps expose no passwords, tokens, API keys, or customer data.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@eliorerz
eliorerz force-pushed the fix-security-gates branch from 62d9077 to 9260f1e Compare July 31, 2026 02:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/e2e-bmaas-full-install.yml:
- Around line 61-62: Make the external osac-test-infra reference immutable
before checkout: update test-infra-ref to a fixed commit or immutable tag in
.github/workflows/e2e-bmaas-full-install.yml:78 and
.github/workflows/e2e-vmaas-full-install.yml:83, and ensure the reusable
workflow invocations at .github/workflows/e2e-bmaas-full-install.yml:61-62 and
.github/workflows/e2e-vmaas-full-install.yml:63-64 use that pinned value rather
than mutable main.
🪄 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: Repository: osac-project/coderabbit/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ecdecede-5781-4c3a-b599-c9a59f24f6bb

📥 Commits

Reviewing files that changed from the base of the PR and between ff6d6e4 and 9260f1e.

📒 Files selected for processing (4)
  • .github/workflows/codeql.yml
  • .github/workflows/dependency-review.yml
  • .github/workflows/e2e-bmaas-full-install.yml
  • .github/workflows/e2e-vmaas-full-install.yml

Comment thread .github/workflows/e2e-bmaas-full-install.yml
@eliorerz

Copy link
Copy Markdown
Contributor Author

Reviewed the diff against a fresh checkout of current main. SHA pins all verified valid (checked each via gh api .../commits/<sha>, and confirmed the osac-test-infra SHA's tree contains both e2e-{bmaas,vmaas}-full-install.yml). No merge conflicts against current main (git merge-tree is clean). Two real findings:

1. codeql.yml's Go autobuild will very likely fail because of the root-level go.work.

This repo's go.work links fulfillment-service, osac-operator, and osac-operator/api as workspace members, with no go.mod at the repo root itself. I reproduced the underlying failure directly from repo root:

$ go build ./...
pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies

(Building from inside fulfillment-service/ directly works fine — it's specifically the root-directory build that go.work rejects.)

CodeQL's Go autobuilder does effectively this from the checkout root when build-mode: autobuild is set with no working-directory scoping, exactly as configured in this PR's analyze job. There's a matching upstream report of the identical failure shape: github/codeql#16469 — go.work at repo root, Go project in a subdirectory, autobuild fails with an unclear error. I'd expect the go leg of this matrix to fail (or silently produce no analysis) once this actually runs in CI.

Suggested fix: don't rely on autobuild for the go language here. Either use build-mode: manual with explicit per-module build steps (cd fulfillment-service && go build ./..., cd osac-operator && go build ./...), or matrix over each Go module directory. This mirrors the same working-directory-scoping problem this PR's own setup-go composite-action comment already correctly identifies for a different step.

2. The PR's stated deferral of e2e-caas-full-install.yml is now stale.

The description says: "e2e-caas-full-install.yml doesn't exist on main yet -- it only exists on the still-open #14 branch -- so it isn't touched here. It'll get the same pin naturally once #14 merges."

#14 has since merged (OSAC-1733: Split e2e-full-install.yml into 3 independently-runnable workflows, merged 2026-07-31T03:14:49Z). .github/workflows/e2e-caas-full-install.yml now exists on main and still references osac-project/osac-test-infra/.github/workflows/e2e-caas-full-install.yml@main — unpinned. This PR's branch doesn't touch it. If merged as-is, the stated goal ("pin osac-test-infra refs") would leave exactly one of the three e2e workflows unpinned. Worth rebasing onto current main and adding the same SHA pin to the caas variant before merging.

Nothing else stood out — the dependency-review and CodeQL workflow structure/permissions otherwise look reasonable, and the judgment call to not hard-fail CodeQL on findings is well-reasoned and clearly flagged.

Pin the osac-test-infra reusable-workflow references in
e2e-bmaas-full-install.yml, e2e-vmaas-full-install.yml, and
e2e-caas-full-install.yml from @main to the current osac-test-infra
main commit SHA (5347598040856b07c61afed01b5b1e6f428c81d7, verified
against osac-test-infra's main HEAD), with a comment noting the SHA
needs to be bumped manually when osac-test-infra changes are needed.

Add two previously-missing security gates, both new pull_request
workflows pinned to full commit SHAs:

- dependency-review.yml: actions/dependency-review-action (SCA),
  which fails the check when a PR introduces a new dependency with
  a known vulnerability.
- codeql.yml: github/codeql-action (SAST) covering this repo's Go
  (fulfillment-service, osac-operator) and Python (fulfillment-service
  dev tooling) code. Scans and uploads findings to the Security tab
  rather than hard-failing on any finding count > 0 -- the gate is the
  analyze step completing successfully; failing on findings outright
  would turn every future PR red until the pre-existing finding
  backlog is triaged, which is a much bigger policy change than adding
  a scanning gate.

The Go leg of codeql.yml failed its own check twice over:

- The runner's preinstalled Go (1.24.13) is older than what root
  go.work requires (>= 1.26.3) for the
  fulfillment-service/osac-operator/osac-operator-api workspace. Fixed
  by running this repo's ./.github/actions/setup-go composite action
  (which installs exactly 1.26.3) before CodeQL's init/build steps on
  the go leg, matching how the rest of this repo's CI sets up Go
  rather than adding a raw actions/setup-go step.
- autobuild runs `go build ./...` from the repo root, which go.work
  rejects ("directory prefix . does not contain modules listed in
  go.work or their selected dependencies") since there's no go.mod at
  root, only the workspace file. Switched the go leg to build-mode:
  manual with explicit per-module build steps (cd into
  fulfillment-service, osac-operator, and osac-operator/api and go
  build ./... in each), the same working-directory-scoping idea as the
  setup-go step.
@eliorerz

Copy link
Copy Markdown
Contributor Author

Both findings confirmed and fixed, pushed as an amended/rebased commit:

  1. Go autobuild failure — reproduced exactly as described: go build ./... from repo root fails with pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies, while building from within each component directory succeeds. Switched the go leg in codeql.yml from build-mode: autobuild to build-mode: manual with explicit per-module build steps (cd fulfillment-service && go build ./..., same for osac-operator and osac-operator/api), matching the working-directory-scoping already used for the setup-go step. Verified all three build cleanly with this approach locally.

  2. Unpinned caas workflow — confirmed OSAC-1733: Split e2e-full-install.yml into 3 independently-runnable workflows #14 merged and e2e-caas-full-install.yml now exists on main with an unpinned @main reference. Rebased onto current main and pinned it to the same verified SHA (5347598040856b07c61afed01b5b1e6f428c81d7, re-checked as still current osac-test-infra main HEAD before use) with the same bump-comment convention as the other two e2e workflows.

Kept this as a single amended commit per this PR's existing convention. Re-validated YAML parsing and pre-commit run on all changed files after the fix.

@eliorerz

Copy link
Copy Markdown
Contributor Author

Final verification pass on the two fixes from the earlier review, plus a drift check now that #28/#32/etc. have landed since. Both fixes confirmed solid.

1. CodeQL Go autobuild fix — confirmed.
codeql.yml's go leg now uses build-mode: manual with an explicit "Build Go modules" step (cd fulfillment-service/osac-operator/osac-operator/api && go build ./... per module), replacing the old autobuild that failed against the root go.work. Checked live CI, not cached: Analyze (go) passes (7m40s, this run), Analyze (python) passes, overall CodeQL check passes. go.work on current main is unchanged (still exactly fulfillment-service, osac-operator, osac-operator/api), so the three hardcoded build steps still match reality.

2. caas SHA pin — confirmed, and checked for drift.
e2e-caas-full-install.yml now pins the same SHA (5347598040856b07c61afed01b5b1e6f428c81d7) as e2e-bmaas-full-install.yml/e2e-vmaas-full-install.yml — all three identical. Checked whether that SHA has gone stale since: osac-test-infra:main has moved 9 commits ahead of it since this fix was pushed (gh api .../compare/<pinned-sha>...main → ahead_by: 9, behind_by: 0, i.e. the pin is a clean ancestor, not a rewritten/force-pushed ref). Read all 9 commit messages and the file list they touch — all infra/CI-monitoring/runner-setup changes (adding osac to a monitoring stack, runner re-run safety, journald/vault hardening); none touch e2e-{bmaas,vmaas,caas}-full-install.yml. So this is exactly the expected, harmless drift the PR's own "bump this SHA when osac-test-infra reusable workflows change" comment anticipates — nothing being missed, nothing to fix now.

Drift/conflict check against recently-landed PRs.
git merge-tree against current main (post #28, #32, etc.) is clean — no conflicts. go.work is unchanged so codeql.yml's per-module build list is still accurate. No duplicate codeql.yml/dependency-review.yml were added elsewhere in the meantime. (Osac-aap, added in #32, has no Go module and isn't a CodeQL Python target change either — its Python code not being covered by the new codeql.yml's python leg is a pre-existing scope gap from before this PR existed, same shape as PR #29's osac-aap gap, not something this PR regressed.)

Confirmed good to merge from my side.

@eliorerz
eliorerz merged commit 08f7a16 into osac-project:main Jul 31, 2026
17 of 20 checks passed
@eliorerz
eliorerz deleted the fix-security-gates branch July 31, 2026 06:47

This branch was previously deployed

1 inactive deployment
e2e-test — accb2ad9 Deployed Jul 31, 2026 by eliorerz via e2e-caas-full-install / e2e #3
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.

2 participants