Skip to content

Ignore Sonar tag-plus-digest Docker warnings#27220

Merged
ErisDS merged 3 commits into
mainfrom
fix/sonar-ignore-docker-tag-digest
Apr 8, 2026
Merged

Ignore Sonar tag-plus-digest Docker warnings#27220
ErisDS merged 3 commits into
mainfrom
fix/sonar-ignore-docker-tag-digest

Conversation

@ErisDS
Copy link
Copy Markdown
Member

@ErisDS ErisDS commented Apr 8, 2026

Summary

  • add a Sonar analysis override for rule docker:S8431
  • suppress that rule for Dockerfiles in this repo
  • stop SonarCloud from blocking Renovate pin-digest PRs on Docker image refs of the form tag@sha256:digest

Why this change

SonarCloud is currently blocking Renovate's pin-dependencies PRs on rule docker:S8431 (Use either the version tag or the digest for the image instead of both). Renovate intentionally preserves the human-readable tag while pinning the immutable digest for Docker updates, so this warning is tooling disagreement rather than a real problem for Ghost.

This change takes the repo-side suppression approach so Renovate's default Docker pinning format can continue to work without repeatedly blocking dependency PRs.

ref #27144
SonarCloud is blocking Renovate's pin-dependencies PRs on rule docker:S8431,
which warns when Docker image references include both a tag and a digest.
Renovate intentionally uses tag@digest for Docker pinning so the image stays
human-readable while still being immutable. Suppress that rule for Dockerfiles
so Renovate's pinned image format no longer blocks dependency PRs.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 66dd3124-33b1-4e5d-b186-ee4442babae7

📥 Commits

Reviewing files that changed from the base of the PR and between 47ce9d1 and 9acb6fa.

📒 Files selected for processing (1)
  • sonar-project.properties
✅ Files skipped from review due to trivial changes (1)
  • sonar-project.properties

Walkthrough

Adds a sonar-project.properties entry that defines a multicriteria ignore named e1 for the SonarCloud rule docker:S8431. The ignore is limited to resources matching **/Dockerfile*, causing Sonar analysis to suppress that specific rule's findings in Dockerfile-related paths. No public APIs or exported entities were changed.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a Sonar configuration to ignore Docker tag-plus-digest warnings, which is the primary purpose of the sonar-project.properties file addition.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale for suppressing the docker:S8431 rule in Dockerfiles and its purpose in preventing SonarCloud from blocking Renovate dependency PRs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sonar-ignore-docker-tag-digest

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
sonar-project.properties (1)

1-3: Consider adding a documentation comment.

To help future maintainers understand why this rule is suppressed, consider adding a comment above the configuration explaining the rationale (Renovate's intentional use of tag@digest format for security).

📝 Suggested documentation comment
+# Suppress docker:S8431 (tag+digest warning) for Renovate's pin-dependencies PRs.
+# Renovate intentionally uses tag@digest format (e.g., node:14@sha256:...) to
+# provide both human-readable tags and immutable digest references.
 sonar.issue.ignore.multicriteria=e1
 sonar.issue.ignore.multicriteria.e1.ruleKey=docker:S8431
 sonar.issue.ignore.multicriteria.e1.resourceKey=**/Dockerfile*
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@sonar-project.properties` around lines 1 - 3, Add a brief documentation
comment above the sonar.ignore block to explain why docker:S8431 is suppressed
for **/Dockerfile* (e.g., Renovate intentionally pins images with tag@digest for
supply-chain security), referencing the sonar keys used
(sonar.issue.ignore.multicriteria,
sonar.issue.ignore.multicriteria.e1.ruleKey=docker:S8431 and
sonar.issue.ignore.multicriteria.e1.resourceKey=**/Dockerfile*) so future
maintainers understand the rationale.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@sonar-project.properties`:
- Around line 1-3: Add a brief documentation comment above the sonar.ignore
block to explain why docker:S8431 is suppressed for **/Dockerfile* (e.g.,
Renovate intentionally pins images with tag@digest for supply-chain security),
referencing the sonar keys used (sonar.issue.ignore.multicriteria,
sonar.issue.ignore.multicriteria.e1.ruleKey=docker:S8431 and
sonar.issue.ignore.multicriteria.e1.resourceKey=**/Dockerfile*) so future
maintainers understand the rationale.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d47d660b-6714-4c6b-bb34-872aefb00f9d

📥 Commits

Reviewing files that changed from the base of the PR and between 54eaf84 and e2446dd.

📒 Files selected for processing (1)
  • sonar-project.properties

ErisDS added 2 commits April 8, 2026 14:57
ref #27220
CodeRabbit asked for a comment explaining why this Sonar ignore exists.
Add a block comment describing the Renovate/SonarCloud conflict and why
we are suppressing docker:S8431 at the repo level rather than stripping
tags from pinned image refs.
Updated comments to clarify the purpose of ignoring SonarCloud warnings for Docker image tags.
@ErisDS ErisDS enabled auto-merge (squash) April 8, 2026 15:57
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 8, 2026

@ErisDS ErisDS disabled auto-merge April 8, 2026 15:57
@ErisDS ErisDS merged commit b0a1d51 into main Apr 8, 2026
21 checks passed
@ErisDS ErisDS deleted the fix/sonar-ignore-docker-tag-digest branch April 8, 2026 15:58
franky19 pushed a commit to franky19/Ghost that referenced this pull request Apr 18, 2026
Preferring renovates default behaviour and squashing the 
maintainability warning from Sonar, as having renovate able
to maintain these updates for us without noise is better/more
maintainable for us in the long run.
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