|
@@ -7,6 +7,7 @@ import (
|
|
|
slsa "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/common"
|
|
|
slsa02 "github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.2"
|
|
|
"github.com/moby/buildkit/util/purl"
|
|
|
+ "github.com/moby/buildkit/util/urlutil"
|
|
|
ocispecs "github.com/opencontainers/image-spec/specs-go/v1"
|
|
|
"github.com/package-url/packageurl-go"
|
|
|
)
|
|
@@ -151,6 +152,7 @@ func NewPredicate(c *Capture) (*ProvenancePredicate, error) {
|
|
|
} else {
|
|
|
inv.ConfigSource.URI = v
|
|
|
}
|
|
|
+ inv.ConfigSource.URI = urlutil.RedactCredentials(inv.ConfigSource.URI)
|
|
|
delete(c.Args, contextKey)
|
|
|
}
|
|
|
|
|
@@ -162,6 +164,9 @@ func NewPredicate(c *Capture) (*ProvenancePredicate, error) {
|
|
|
vcs := make(map[string]string)
|
|
|
for k, v := range c.Args {
|
|
|
if strings.HasPrefix(k, "vcs:") {
|
|
|
+ if k == "vcs:source" {
|
|
|
+ v = urlutil.RedactCredentials(v)
|
|
|
+ }
|
|
|
delete(c.Args, k)
|
|
|
if v != "" {
|
|
|
vcs[strings.TrimPrefix(k, "vcs:")] = v
|
|
@@ -231,6 +236,11 @@ func FilterArgs(m map[string]string) map[string]string {
|
|
|
"platform": {},
|
|
|
"cache-imports": {},
|
|
|
}
|
|
|
+ const defaultContextKey = "context"
|
|
|
+ contextKey := defaultContextKey
|
|
|
+ if v, ok := m["contextkey"]; ok && v != "" {
|
|
|
+ contextKey = v
|
|
|
+ }
|
|
|
out := make(map[string]string)
|
|
|
for k, v := range m {
|
|
|
if _, ok := hostSpecificArgs[k]; ok {
|
|
@@ -239,6 +249,9 @@ func FilterArgs(m map[string]string) map[string]string {
|
|
|
if strings.HasPrefix(k, "attest:") {
|
|
|
continue
|
|
|
}
|
|
|
+ if k == contextKey || strings.HasPrefix(k, defaultContextKey+":") {
|
|
|
+ v = urlutil.RedactCredentials(v)
|
|
|
+ }
|
|
|
out[k] = v
|
|
|
}
|
|
|
return out
|