diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 9094384..52b6bda 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -13,7 +13,7 @@ workflows: - 'helm/chart-testing-action@v2.3.1' '.github/workflows/plumber.yml': - 'actions/checkout@v5.0.0' - - 'getplumber/plumber@v0.7.18' + - 'getplumber/plumber@v0.7.23' '.github/workflows/release.yml': - 'actions/checkout@v3.7.0' - 'azure/setup-helm@v3.5' @@ -73,9 +73,9 @@ dependencies: commit: 'sha1-dc3a92680fcc15842eef52e8c4606ea7ce6bd3f3' owner_id: 1588572 repo_id: 300422142 - 'getplumber/plumber@v0.7.18': - ref: 'v0.7.18' - commit: 'sha1-ebc213aa45dccd233ce5c2630f0aafa8e8d650c5' + 'getplumber/plumber@v0.7.23': + ref: 'v0.7.23' + commit: 'sha1-ec8cb3a7edd6a324b33e85109b627b2df6023d94' owner_id: 255179076 repo_id: 1137327132 uses: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c61e12a..a8a66c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: uses: actions/checkout@v3.1.0 with: fetch-depth: 0 + persist-credentials: false - name: Install Helm uses: azure/setup-helm@v3.5 with: @@ -57,6 +58,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3.7.0 + with: + persist-credentials: false - uses: d3adb5/helm-unittest-action@v2.5.0 with: charts: charts/plumber diff --git a/.github/workflows/plumber.yml b/.github/workflows/plumber.yml index 9adbb61..ccfcc14 100644 --- a/.github/workflows/plumber.yml +++ b/.github/workflows/plumber.yml @@ -28,7 +28,7 @@ jobs: with: persist-credentials: false - name: Run Plumber - uses: getplumber/plumber@v0.7.18 + uses: getplumber/plumber@v0.7.23 with: min-points: 90 score-push: true # publish the Plumber Score badge (repo name + score become public) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a17e2a3..009425c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,7 @@ jobs: uses: actions/checkout@v3.7.0 with: fetch-depth: 0 + persist-credentials: false - name: Configure Git run: | git config user.name "$GITHUB_ACTOR" @@ -33,7 +34,12 @@ jobs: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" CR_RELEASE_NAME_TEMPLATE: "v{{ .Version }}" - name: Add CNAME to gh-pages + env: + GH_TOKEN: ${{ github.token }} run: | + # The checkout persists no credential (ISSUE-307): gh wires git's + # credential helper to GH_TOKEN for the push below. + gh auth setup-git if git show-ref --verify --quiet refs/remotes/origin/gh-pages; then git checkout gh-pages if [ ! -f CNAME ]; then diff --git a/.plumber.yaml b/.plumber.yaml index ae7f72b..8df6958 100644 --- a/.plumber.yaml +++ b/.plumber.yaml @@ -1,379 +1,23 @@ -# Plumber Configuration - Trust Policy Manager for GitLab CI/CD -# This file is required for 'plumber analyze' to work. -# Default file name: .plumber.yaml -# Reference: https://github.com/getplumber/plumber/blob/main/.plumber.yaml -# Can be generated with: plumber config generate - +# Plumber policy for this repository: the Plumber default policy plus the +# overrides below, nothing else. Every control the default enables runs here, +# including the ones added after this file was first written. +# plumber config resolve # prints the full effective policy +# plumber config diff # shows these overrides against the default version: "2.0" +extends: plumber:default -# ============================================================================ -# GitHub Actions controls -# ============================================================================ github: controls: - # =========================================== - # Actions must be pinned by commit SHA - # =========================================== - # Flags workflow steps whose `uses:` reference is not a 40-character - # commit SHA. Tag/branch refs (v4, main) are mutable: if the action's - # maintainer is compromised or retags a release, the caller workflow - # silently runs new code with its secrets. This is the vector behind - # the March 2025 tj-actions/changed-files compromise (CVE-2025-30066). - # - # The default trustedOwners list exempts first-party (`actions/*`, - # `github/*`) actions so the initial signal on a fresh repo stays - # focused on the third-party surface. Pair with Dependabot - # (`version-update-strategy: sha-and-version`) to keep pins fresh. - actionsMustBePinnedByCommitSha: - enabled: true - # Action-owner prefixes exempt from the pin-by-SHA requirement. - # Only list owners already inside the workflow's trust boundary. - trustedOwners: - - actions - - github - - # =========================================== - # Container images must not use forbidden tags - # =========================================== - # Same control as GitLab; values are GitHub-side. Pinning by digest - # protects against tag-retag supply-chain attacks. The forbidden tag - # list catches the common cases of mutable references. - containerImageMustNotUseForbiddenTags: - enabled: true - tags: - - latest - - dev - - development - - staging - - main - - master - # When true, ALL images must be pinned by digest (e.g., - # alpine@sha256:...). Takes precedence over the forbidden tags - # list — any image not using an immutable digest reference is - # flagged. - containerImagesMustBePinnedByDigest: true - - # =========================================== - # Pipeline must not use Docker-in-Docker - # =========================================== - # Workflows on GitHub-hosted runners that spin up `docker:dind` - # services have the same privilege-escalation risk as on GitLab. - # detectInsecureDaemon also flags plaintext DOCKER_HOST and empty - # DOCKER_TLS_CERTDIR values. - pipelineMustNotUseDockerInDocker: - enabled: true - detectInsecureDaemon: true - - # =========================================== - # Reusable workflows must not inherit secrets - # =========================================== - # Detects `jobs..secrets: inherit` calls. Inherit forwards - # every secret visible to the caller — repo, organisation, - # environment — to the reusable workflow regardless of what it - # actually needs. Use an explicit secrets map instead. - reusableWorkflowsMustNotInheritSecrets: - enabled: true - - # =========================================== - # Security jobs must not be weakened - # =========================================== - # Jobs matching the security-scanner naming patterns must not be - # neutralised via `continue-on-error: true` (mapped to the same - # IR field as GitLab's allow_failure: true) or manual-dispatch-only - # triggers. The pattern set covers the GitHub-native scanners - # users actually run — `codeql`, `dependency-review`, `trufflehog`, - # `gitleaks`, `osv-scanner`, plus generic fallbacks like - # `*scan*`, `*audit*`, `*security*` so SAST jobs named with - # project-specific prefixes still match. - securityJobsMustNotBeWeakened: - enabled: true - # How patterns are matched - # ──────────────────────── - # Each pattern is a glob (`*` matches any substring) compared - # against the job name plumber builds for every job in your - # workflows. That name is: - # - # / - # - # Examples: - # .github/workflows/codeql-analysis.yml + jobs.analyze - # -> codeql-analysis/analyze - # .github/workflows/ci.yml + jobs.lint - # -> ci/lint - # .github/workflows/workflow.yml + jobs.my-sast - # -> workflow/my-sast - # - # The namespace exists so two workflow files defining a job - # with the same id do not collide. Patterns can target whichever - # part of that name is stable for your repo: - # "**" token anywhere in the name (resilient) - # "/*" every job in one workflow file - # "*/" specific job id, any workflow - # "/" exact match, no wildcard - # - # The defaults below ship wildcard-wrapped because plumber does - # not know your repo's workflow-file convention. If your jobs - # follow a known layout you can drop the wildcards for tighter - # matching. - securityJobPatterns: - - "*codeql*" - - "*dependency-review*" - - "*trufflehog*" - - "*gitleaks*" - - "*osv-scanner*" - - "*-sast" - - "*-sast-*" - - "*-scan" - - "*scan*" - - "*-security" - - "*-security-*" - - "*-audit" - - "*-audit-*" - # Real-world slash-form examples (commented; uncomment / adapt - # to your repo for a tighter match than the wildcards above). - # Format reminder: /. - # - # - codeql-analysis/analyze # GitHub's default CodeQL template - # - dependency-review/dependency-review # GitHub's default Dependency Review template - # - security/gitleaks # gitleaks job in security.yml - # - security/trufflehog # trufflehog job in security.yml - # - security/* # every job in security.yml - # - "*/sast" # any job named "sast", any workflow - # - ci/semgrep-sast # exact match, no wildcard - allowFailureMustBeFalse: - enabled: true - rulesMustNotBeRedefined: - enabled: true - whenMustNotBeManual: - enabled: true - - # =========================================== - # Workflow must not inject user input in scripts - # =========================================== - # Catches the canonical script-injection class: `${{ github.event.* }}` - # / `${{ github.head_ref }}` / `${{ github.actor }}` interpolated - # directly into a `run:` shell. Attacker-controlled values like PR - # title or branch name can break out of the intended string and - # execute arbitrary commands with the job's secrets. Bind through - # `env:` first, then reference the env var from the shell. - workflowMustNotInjectUserInputInScripts: - enabled: true - - # =========================================== - # Workflow must not use dangerous triggers - # =========================================== - # Flags `pull_request_target` and `workflow_run` triggers, which - # run with the base repository's secrets while being influenceable - # by an unprivileged caller. Combined with any user-content - # checkout this becomes a direct exfiltration path (CVE-2025-30066). - # Use the standard `pull_request` trigger unless secrets are - # required. - workflowMustNotUseDangerousTriggers: - enabled: true - - # =========================================== - # Workflows must declare permissions - # =========================================== - # Workflows without an explicit `permissions:` block fall back to - # the repo-wide GITHUB_TOKEN default — often `contents: write` or - # `read-all`. Declaring `permissions: { contents: read }` at the - # workflow level enforces least-privilege regardless of the repo - # default. - workflowsMustDeclarePermissions: - enabled: true - - # =========================================== - # Branch must be protected (project governance) - # =========================================== - # The first project-governance control on the GitHub path. Every - # other shipping rule is pipeline-governance (workflow content); - # this one inspects repository settings via the GitHub branch- - # protection API. Requires a token with `repo` scope (classic - # PAT) or "Administration: read" (fine-grained PAT) — content- - # only read access is NOT enough. Without scope the collector - # returns an empty branch list and the rule emits no findings, - # same degraded contract as missing API auth elsewhere. - branchMustBeProtected: - enabled: true - defaultMustBeProtected: true - namePatterns: - - main - - master - - release/* - - production - - dev - allowForcePush: false - codeOwnerApprovalRequired: false - - # ============================================================================ - # Workflows must include required actions - # ============================================================================ - # Asserts that every workflow file under .github/workflows/ - # collectively references a set of required actions or reusable - # workflows. The GitHub counterpart of - # pipelineMustIncludeComponent / pipelineMustIncludeTemplate on - # the GitLab side. - # - # GitHub has two ways to "include" something external; the - # control treats both the same so you do not have to declare - # which is which: - # - # Step-level action: - # steps: - # - uses: myorg/sast-scan@v2 - # - # Job-level reusable workflow call: - # jobs: - # security: - # uses: myorg/policy/.github/workflows/scan.yml@v2 - # - # Each required entry is an `owner/repo[/path]` string. Matching - # is ref-agnostic so bumping a pinned SHA does not invalidate - # the policy. A slash-guard prevents accidental prefix - # collisions: `myorg/sast-scan` matches - # `myorg/sast-scan@` and - # `myorg/sast-scan/sub@`, but NOT - # `myorg/sast-scan-fork@`. - # - # Two ways to define requirements (use one, not both): - # - # Option 1, Expression syntax ('required'): - # A natural boolean expression using AND, OR, and parentheses. - # AND binds tighter than OR, so "a AND b OR c" means - # "(a AND b) OR c". - # - # required: myorg/sast-scan AND myorg/dependency-review - # required: (myorg/sast-scan AND myorg/secret-scan) OR myorg/full-security-suite - # - # Option 2, Array syntax ('requiredGroups'): - # A list of groups using "OR of ANDs" logic: - # - Each inner array = items that must ALL be present (AND) - # - Outer array = only ONE group needs to be satisfied (OR) - # - # requiredGroups: - # - ["myorg/sast-scan", "myorg/dependency-review"] - # - ["myorg/full-security-suite"] - # - # Disabled by default; opt in once your organization has settled - # on the action set every repo is expected to wire up. + # Third-party actions the chart CI relies on, both pinned through the + # actions lockfile (.github/workflows/actions.lock); listed so the default + # source policy authorizes them. Add an entry here before introducing a + # third-party action that is neither GitHub-official nor from this org. + githubActionMustComeFromAuthorizedSources: + trustedGithubActions: + - d3adb5/helm-unittest-action + - dorny/test-reporter + + # The chart and compose checks must run on the pinned toolchain actions. workflowMustIncludeRequiredActions: enabled: true - required: "actions/checkout AND azure/setup-helm AND actions/setup-python" - requiredGroups: [] - - # =========================================== - # Workflow must not grant write-all permissions - # =========================================== - # Flags workflows and jobs whose effective `permissions:` block is the - # literal `write-all` shortcut. write-all gives GITHUB_TOKEN every - # scope (contents, packages, deployments, id-token, …) at the same - # time, so any compromise in the workflow — a malicious dependency, - # a script-injection bug, a third-party action turning evil — gets - # to do anything the repo allows: push to main, publish releases, - # mint OIDC tokens for cloud accounts, mark deployments succeeded. - # - # Workflow-level `permissions: write-all` is propagated to every - # job by the GitHub Actions runner; the rule reads the per-job - # effective permissions, so a workflow-level grant is caught the - # same way as a job-level one. - # - # Scope: static `permissions:` in committed workflow YAML only. - # Flags the literal string shortcut `write-all` on a job's effective - # permissions (workflow-level `write-all` is propagated to every job). - # - # Does not flag: `permissions: { contents: write, … }` maps, `read-all`, - # or missing `permissions:` (see `workflowsMustDeclarePermissions` / - # ISSUE-304). Does not evaluate `${{ }}` expressions or permissions - # inside callee reusable-workflow files Plumber did not fetch. - # - # Pair with `workflowsMustDeclarePermissions` for the full story. - workflowMustNotGrantPermissionsWriteAll: - enabled: true - - # =========================================== - # Actions must not reference archived repositories - # =========================================== - # Flags `uses: owner/repo@ref` references whose upstream repository - # is archived on GitHub. Archived repos no longer receive - # maintenance: open vulnerabilities stay open, dependency bumps - # stop, runtime compatibility regressions accumulate. Pinning by - # SHA does not save the caller — the last maintainer (or someone - # who later acquires the namespace) can still push new code under - # the original repository name. - # - # Scope: committed `.github/workflows/*.{yml,yaml}` only; step-level - # `uses: owner/repo@ref` (not reusable-workflow `jobs.*.uses`, not - # local `./.github/actions/*`). Requires GitHub API auth; without it - # the rule abstains (no finding). - # - # How it works: `GET /repos/{owner}/{repo}` → `archived` flag, one - # cached lookup per `owner/repo` (all refs share the same result). - # - # Does not see: callee reusable-workflow files, deleted/private repos - # (lookup may fail silently → abstain). - actionsMustNotBeArchived: - enabled: true - - # =========================================== - # Actions must not carry known CVEs - # =========================================== - # Cross-references every `uses: owner/repo@ref` against the GitHub - # Advisory Database under the `actions` ecosystem. A positive hit - # means at least one published advisory targets the action's - # repository. This is the rule that catches the published-CVE - # supply-chain class — tj-actions/changed-files (CVE-2025-30066), - # reviewdog/action-setup (March 2025), unpatched versions of - # `actions/artifact`. - # - # Scope: committed `.github/workflows/*.{yml,yaml}` only; step-level - # `uses: owner/repo@ref` (not reusable-workflow `jobs.*.uses`, not - # `./.github/actions/*`, not `docker://`). Requires GitHub API auth - # (`gh` / GH_TOKEN); without it the rule abstains (no finding). - # - # How it works: one Advisory Database query per `owner/repo` - # (`ecosystem=actions`), cached. When the pinned ref resolves to a - # semver tag, Plumber filters advisories by `vulnerable_version_range`. - # When the ref is an unresolvable commit SHA, any advisory for that - # repo may match (conservative). Upgrade past the fixed-in version and - # re-pin the SHA to clear the finding. - # - # Does not see: org/repo Variables, runtime `$GITHUB_ENV` writes, or - # actions nested inside composite actions you do not call directly. - actionsMustNotCarryKnownCVEs: - enabled: true - - # =========================================== - # Pipeline must not enable debug trace - # =========================================== - # GitHub-side parallel of the GitLab `pipelineMustNotEnableDebugTrace` - # control. Flags workflows or jobs that set the GitHub Actions - # debug-trace toggles to a truthy value (`true`, `1`, `yes`). - # - # When `ACTIONS_STEP_DEBUG=true` or `ACTIONS_RUNNER_DEBUG=true`, - # the runner prints every environment variable (including masked - # secrets) and every internal action SDK call into the job log. - # The masking layer is bypassed for the dump itself, so any - # secret consumed by the workflow lands in plaintext in the run - # log and is then visible to anyone with `actions: read` on the - # repository, plus indefinitely on log artefacts. - # - # Scope: static `env:` in committed `.github/workflows/*.{yml,yaml}`. - # The collector merges workflow-, job-, and step-level `env:` into - # each job (step > job > workflow precedence on name collisions). - # - # Truthy values: `true`, `1`, `yes` (case-insensitive, trimmed). - # Variable names: case-insensitive match against `forbiddenVariables`. - # - # Also flags: `${{ }}` values on forbidden names in static `env:` - # (cannot verify off statically), and `run:` lines that write a - # forbidden name to `$GITHUB_ENV`. All ISSUE-203 findings are critical. - # - # Does not see: org/repo/environment Variables with no YAML reference, - # env inside callee reusable workflows Plumber did not fetch, or GitHub - # UI "Re-run with debug logging" (not in YAML). - pipelineMustNotEnableDebugTrace: - enabled: true - forbiddenVariables: - - ACTIONS_STEP_DEBUG - - ACTIONS_RUNNER_DEBUG - + required: actions/checkout AND azure/setup-helm AND actions/setup-python