Skip to content

fix(ci): restore checks: write on lint job for reviewdog annotations - #2500

Merged
Andriy Knysh (aknysh) merged 4 commits into
mainfrom
osterman/missing-permission-check
May 24, 2026
Merged

Andriy Knysh (aknysh) merged 4 commits into
mainfrom
osterman/missing-permission-check

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented May 24, 2026 •

Copy link
Copy Markdown
Member

what

  • Add a job-scoped permissions: block on the lint ([lint] <demo-folder>) job in .github/workflows/test.yml granting contents: read + checks: write so reviewdog/action-tflint@v1 can post inline tflint findings on PRs via the GitHub Checks API.

Companion to #2499, which restored security-events: write on the docker ([lint] Dockerfile) job. Same root cause, second affected job.

why

  • PR fix(vendor): recover OCI pulls on auth rejection and surface rich errors #2487 introduced the first workflow-level permissions: block on test.yml to grant packages: read for ghcr.io OCI pulls. A workflow-level permissions: block replaces (not extends) the default GITHUB_TOKEN scope for every job in the file, which silently stripped the inherited checks: write that the lint job relied on.
  • Effect on contributors: since fix(vendor): recover OCI pulls on auth rejection and surface rich errors #2487 merged, tflint findings on PRs touching examples/<demo-folder>/components/terraform have stopped appearing as inline check annotations. The job itself still exits with the right code (fail_level: error controls that), but reviewers lost the per-line context. This restores that behavior.
  • Job-scoped (least privilege) over widening the workflow-level block — only this one job uses reviewdog. Matches the convention used in .github/workflows/codeql.yml and the docker-job fix already landed in fix(ci): restore security-events: write for Dockerfile lint SARIF upload #2499.
  • Not adding pull-requests: write: reviewdog's default github-pr-check reporter posts check runs (which need checks: write), not review comments. checks: write alone is sufficient.

references

PR #2487 added the first workflow-level `permissions:` block to
`.github/workflows/test.yml` to grant `packages: read` for ghcr.io
OCI pulls. Before that, the file inherited the repo default
permissions, which include `security-events: write`. Declaring an
explicit `permissions:` block stops GitHub from merging in defaults,
so `security-events: write` was silently stripped from every job —
and the `[lint] Dockerfile` job's `github/codeql-action/upload-sarif@v4`
step started failing with "Resource not accessible by integration".

Add a job-scoped `permissions:` block on `docker` granting `contents:
read` + `security-events: write`. Job-scoped (least privilege) matches
the convention used in `.github/workflows/codeql.yml`, and avoids
giving the rest of the matrix jobs a token that can write code-scanning
alerts.

Failing run: https://github.com/cloudposse/atmos/actions/runs/26348559800/job/77599880970
@atmos-pro

atmos-pro Bot commented May 24, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label May 24, 2026
@github-actions github-actions Bot added the size/xs Extra small size PR label May 24, 2026
@github-actions

github-actions Bot commented May 24, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@mergify

mergify Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label May 24, 2026
`reviewdog/action-tflint@v1` defaults to the `github-pr-check`
reporter, which calls the GitHub Checks API to post inline tflint
findings on the PR. That requires `checks: write` on the job's
GITHUB_TOKEN.

Before PR #2487 the lint job inherited the repo's default scopes
(which include `checks: write`), so reviewdog annotations worked.
Once that PR introduced an explicit workflow-level `permissions:`
block (`contents: read` + `packages: read`), the inherited defaults
were stripped from every job. The lint job did not hard-fail because
reviewdog silently falls back to local-only output, but PR-line
annotations stopped appearing.

Add a job-scoped `permissions:` block on `lint` granting
`contents: read` (checkout) + `checks: write` (reviewdog). Job-scoped
(least privilege) — only this job needs to write checks. Not adding
`pull-requests: write`: the default `github-pr-check` reporter posts
check runs, not review comments, so `checks: write` alone is enough.
@osterman Erik Osterman (Cloud Posse) (osterman) changed the title ci(test): restore security-events: write for hadolint SARIF upload ci(test): restore inherited permissions stripped by explicit permissions block May 24, 2026
@codecov

codecov Bot commented May 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.33%. Comparing base (4ebf458) to head (ad926da).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2500      +/-   ##
==========================================
+ Coverage   78.30%   78.33%   +0.03%     
==========================================
  Files        1119     1119              
  Lines      106684   106684              
==========================================
+ Hits        83539    83572      +33     
+ Misses      18479    18446      -33     
  Partials     4666     4666              
Flag Coverage Δ
unittests 78.33% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify

mergify Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label May 24, 2026
…ission-check

# Conflicts:
#	.github/workflows/test.yml
@osterman Erik Osterman (Cloud Posse) (osterman) changed the title ci(test): restore inherited permissions stripped by explicit permissions block ci(test): grant checks: write to lint job for reviewdog annotations May 24, 2026
@mergify mergify Bot removed the conflict This PR has conflicts label May 24, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added patch A minor, backward compatible change and removed no-release Do not create a new release (wait for additional code changes) labels May 24, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) changed the title ci(test): grant checks: write to lint job for reviewdog annotations fix(ci): restore checks: write on lint job for reviewdog annotations May 24, 2026
@aknysh Andriy Knysh (aknysh) added no-release Do not create a new release (wait for additional code changes) and removed patch A minor, backward compatible change labels May 24, 2026
@aknysh
Andriy Knysh (aknysh) merged commit 4381557 into main May 24, 2026
120 of 123 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the osterman/missing-permission-check branch May 24, 2026 19:05
@atmos-pro

atmos-pro Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label May 24, 2026
@github-actions

Copy link
Copy Markdown

These changes were released in v1.220.0-rc.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/xs Extra small size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants