mirror of
https://github.com/containers/skopeo.git
synced 2025-08-01 23:07:51 +00:00
Adds --insecure-policy flag
This patch adds a new flag --insecure-policy. Closes #181, we can now directly use the tool with the above mentioned flag wihout using a policy file Signed-off-by: Kushal Das <mail@kushaldas.in>
This commit is contained in:
parent
e052488674
commit
4043ecf922
@ -41,6 +41,10 @@ func createApp() *cli.App {
|
||||
Value: "",
|
||||
Usage: "Path to a trust policy file",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "insecure-policy",
|
||||
Usage: "run the tool without any policy check",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "registries.d",
|
||||
Value: "",
|
||||
@ -84,7 +88,9 @@ func getPolicyContext(c *cli.Context) (*signature.PolicyContext, error) {
|
||||
policyPath := c.GlobalString("policy")
|
||||
var policy *signature.Policy // This could be cached across calls, if we had an application context.
|
||||
var err error
|
||||
if policyPath == "" {
|
||||
if c.GlobalBool("insecure-policy") {
|
||||
policy = &signature.Policy{Default: []signature.PolicyRequirement{signature.NewPRInsecureAcceptAnything()}}
|
||||
} else if policyPath == "" {
|
||||
policy, err = signature.DefaultPolicy(nil)
|
||||
} else {
|
||||
policy, err = signature.NewPolicyFromFile(policyPath)
|
||||
|
Loading…
Reference in New Issue
Block a user