-
Notifications
You must be signed in to change notification settings - Fork 292
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
Security review: validate application names #2223
Comments
--pull-policy=always
or --publish=true
I have made a first attempt at this in buildpacks/pack-private@230c76b (yes, I forked off github.com/buildpacks/pack, not pack-private :( ) I've not yet validated against "any run image associated with a trusted builder". |
We can inspect every trusted builder. However, it's common for developers to trust our default set of builders and to add their own additional images. Then in a CI environment this leads to accessible internal builders and inaccessible external builders. The inaccessibility of external builders is reasonable as they're never used. However, if we now iterate over all trusted builders, we will see builderInfo, err := inspector.InspectBuilder(trustedBuilder, false)
if err != nil {
return fmt.Errorf("failed to retrieve trusted builder metadata")
}
for _, runner := range builderInfo.RunImages {
runImage, err := name.ParseReference(runner.Image)
if err != nil {
return fmt.Errorf("run image %s for trusted builder %s is invalid", runner, builder)
}
if inputImage.Context().RepositoryStr() == runImage.Context().RepositoryStr() {
return fmt.Errorf("name must not match run image name for trusted builder %s", builder)
}
} |
@AidanDelaney you are my literal hero. Thank you 🙏🏼 |
This makes sense to me.
I think we should only do this check if the export target is the daemon. If the export target is the registry, then registry write permissions should protect trusted build inputs. |
Work in buildpacks/pack-private#43 caches the run image names from a builder when we add a builder as a trusted builder. This adds a number of new failure modes to I'm going to take this in a different direction:
|
I now think that buildpacks/pack-private#47 is "good enough". We perform the following list of checks. However, we do not check that someone is "overriding" a buildpack name that is required by a builder (it would be hard to create a valid poisoned buildpack using a. disallow publishing as well-known lifecycle names (we can't stop people overwriting company.com/mirror/lifecycle) |
Caching trusted builder run images when we add a new trusted builder does not gain us much. Trusted builders are generally referenced using mutable tags (i.e. In addition,
We cannot forbid every possible future run image name. |
Many thanks for the updates @AidanDelaney 🙏🏼 I'll take a look soon. |
Description
In the security review, this is
HIGH-1: Host compromise by overwriting trusted container images
. The action plan asks us to ensure thatProposed solution
Before executing a build, pack should read trusted builder information (
pack config trusted-builders
) and fail if the application name is equal to any of:io.buildpacks.builder.metadata
label and inspecting the stack key asrun.images
is currently not spec'd)We should omit the tag portion of the reference when doing the string comparison.
Describe alternatives you've considered
Related issue: #2222.
Additional context
The text was updated successfully, but these errors were encountered: