Skip to content

🐛 do not include asName when creating digest of FROM name as asName #4683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AdamKorcz
Copy link
Contributor

What kind of change does this PR introduce?

(Is it a bug fix, feature, docs update, something else?)

bug fix

What is the current behavior?

When calculating the digest in remediation, Scorecard would do that from python:3.7:build when the line was FROM python:3.7 as build. This would lead to issues such as #2906.

We are creating the digest on the following lines:

name, ok := dockerImageName(dep)
if !ok {
return nil
}
hash, err := digester.Digest(name)
if err != nil {
return nil
}

From the PR, it should be clear that d.PinnedAt is assigned the wrong value; it gets assigned asPointer(asName) which is the root cause of the bug. digester.Digest(name) throws an error like: parsing reference "python:3.7:build": could not parse reference: python:3.7:build because of this.

What is the new behavior (if this is a feature change)?**

With this change, we create the digest from python:3.7 in the same line as above.

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

Fixes #2906

Special notes for your reviewer

Does this PR introduce a user-facing change?

NONE

Ignore as-name with creating digest.

Signed-off-by: Adam Korczynski <adam@adalogics.com>
@AdamKorcz AdamKorcz requested a review from a team as a code owner June 27, 2025 20:10
@AdamKorcz AdamKorcz requested review from justaugustus and raghavkaul and removed request for a team June 27, 2025 20:10
@AdamKorcz AdamKorcz temporarily deployed to integration-test June 27, 2025 20:11 — with GitHub Actions Inactive
Copy link

codecov bot commented Jun 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.30%. Comparing base (353ed60) to head (a554b83).
Report is 193 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4683      +/-   ##
==========================================
+ Coverage   66.80%   68.30%   +1.49%     
==========================================
  Files         230      249      +19     
  Lines       16602    18890    +2288     
==========================================
+ Hits        11091    12902    +1811     
- Misses       4808     5129     +321     
- Partials      703      859     +156     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

github-actions bot commented Jul 8, 2025

This pull request has been marked stale because it has been open for 10 days with no activity

@github-actions github-actions bot added the Stale label Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

BUG: Dockerfile named build stages with incomplete remediation report
1 participant