Skip to content
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

[v0.11 backport] Fix ResolveImageConfig to evaluate source policy #4186

Closed
wants to merge 2 commits into from

Conversation

cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Aug 29, 2023

backport of:

Backport of 330cf7a
This was not clean and so had to be manually backported.

Also brings in a clean cherry-pick of 22d8446

This backport is so we can bring this into moby v24 and have useful source policies.

cpuguy83 and others added 2 commits August 29, 2023 19:18
Backport 330cf7a to 0.11 branch

This is not a clean cherry-pick due to lots of other interspersed
changes (and this change really has to touch code all up and down the
stack).

Original commit message:

Before this change, ResolveImageConfig was unaware of source policies.
This means that:

1. Images for denied sources may be resolved
2. Image configs may get pulled for sources that are later converted to
   a different image

The update makes it so the image resolver first runs a given ref through
the source policy and uses any mutated ref for the actual resolve
(instead of the original ref).
It also returns the mutated ref so it can be used correctly by the
frontend (e.g. don't want to do llb.Image(oldRef@resolvedDigest)).

Signed-off-by: Brian Goff <[email protected]>
The older of rules in policy matters. Eg. in [DENY *, ALLOW ref]
mixing the order would deny all sources so map can't be used
to deduplicate the rules.

Signed-off-by: Tonis Tiigi <[email protected]>
(cherry picked from commit 22d8446)
Signed-off-by: Brian Goff <[email protected]>
@thaJeztah thaJeztah changed the title Fix ResolveImageConfig to evaluate source policy [v0.11] Fix ResolveImageConfig to evaluate source policy Aug 29, 2023
@thaJeztah thaJeztah changed the title [v0.11] Fix ResolveImageConfig to evaluate source policy [v0.11 backport] Fix ResolveImageConfig to evaluate source policy Aug 29, 2023
@thaJeztah
Copy link
Member

Looks like build is failing @cpuguy83 looks like some signatures changed?

@cpuguy83
Copy link
Member Author

Yeah I should have opened as draft, I didn't run through tests locally.

@cpuguy83
Copy link
Member Author

cpuguy83 commented Sep 7, 2023

Going to close this for now, and opened up #4215 to just backport the rule ordering since there's a bunch more work involved in the ResolveImageConfig changes.

@cpuguy83 cpuguy83 closed this Sep 7, 2023
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.

3 participants