Skip to content

Conversation

@tonistiigi
Copy link
Member

Add support for dynamic source policies via client session.

Client session can allow or deny specific source or ask additional metadata information via sourcemetaresolver if that is needed to make the decision.

Still lots of things to complete. Opening draft for early feedback. cc @cpuguy83

@cpuguy83
Copy link
Member

cpuguy83 commented Oct 9, 2025

What use-cases were you look at for this?
What I was thinking was image signature validation.

@tonistiigi
Copy link
Member Author

What use-cases were you look at for this?
What I was thinking was image signature validation.

Yes, that is one of the cases. ResolveSourceMetadata can be updated with more support for other sources and things like resolving image signature. Some related ongoing work https://github.com/docker/github-builder-experimental/tree/build-reusable-workflow moby/moby#51012

@tonistiigi tonistiigi force-pushed the policysession branch 2 times, most recently from 15a9abd to c0565f7 Compare November 5, 2025 06:58
@tonistiigi tonistiigi marked this pull request as ready for review November 5, 2025 06:59
@tonistiigi
Copy link
Member Author

Bringing this out of draft. I think we could mark this experimental for the next release while we test this out with more use cases.

@tonistiigi tonistiigi added this to the v0.26.0 milestone Nov 5, 2025
@tonistiigi tonistiigi requested a review from crazy-max November 5, 2025 16:10
Add support for dynamic source policies via client session.

Client session can allow or deny specific source or
ask additional metadata information via sourcemetaresolver if
that is needed to make the decision.

Signed-off-by: Tonis Tiigi <[email protected]>
Comment on lines +51 to +56
max := 0
for {
max++
if max > 10 { // TODO: better loop detection
return false, errors.Errorf("too many policy requests")
}
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is to avoid badly written policies that could hang builds? I wonder if we could show policy evaluation during image resolution in build logs to make it obvious?

Copy link
Member Author

Choose a reason for hiding this comment

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

The resolve request does go to the build logs. Yes, this can be improved with better detection if things have changed. E.g., when the client sends requests for the same op they already received, then we can just error out right away instead of waiting for a fixed limit.

@tonistiigi tonistiigi merged commit 46de852 into moby:master Nov 5, 2025
198 of 200 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants