@@ -784,14 +784,21 @@ func InitializeContainerChecks(ctx context.Context, p policy.Policy, cfg Contain
784
784
cfg .CertificationProjectID ,
785
785
& http.Client {Timeout : 60 * time .Second })),
786
786
}, nil
787
- case policy .PolicyScratch :
787
+ case policy .PolicyScratchNonRoot :
788
788
return []check.Check {
789
789
& containerpol.HasLicenseCheck {},
790
790
containerpol .NewHasUniqueTagCheck (cfg .DockerConfig ),
791
791
& containerpol.MaxLayersCheck {},
792
792
& containerpol.HasRequiredLabelsCheck {},
793
793
& containerpol.RunAsNonRootCheck {},
794
794
}, nil
795
+ case policy .PolicyScratchRoot :
796
+ return []check.Check {
797
+ & containerpol.HasLicenseCheck {},
798
+ containerpol .NewHasUniqueTagCheck (cfg .DockerConfig ),
799
+ & containerpol.MaxLayersCheck {},
800
+ & containerpol.HasRequiredLabelsCheck {},
801
+ }, nil
795
802
}
796
803
797
804
return nil , fmt .Errorf ("provided container policy %s is unknown" , p )
@@ -812,7 +819,7 @@ func makeCheckList(checks []check.Check) []string {
812
819
func checkNamesFor (ctx context.Context , p policy.Policy ) []string {
813
820
var c []check.Check
814
821
switch p {
815
- case policy .PolicyContainer , policy .PolicyRoot , policy .PolicyScratch :
822
+ case policy .PolicyContainer , policy .PolicyRoot , policy .PolicyScratchNonRoot , policy . PolicyScratchRoot :
816
823
c , _ = InitializeContainerChecks (ctx , p , ContainerCheckConfig {})
817
824
case policy .PolicyOperator :
818
825
c , _ = InitializeOperatorChecks (ctx , p , OperatorCheckConfig {})
@@ -833,10 +840,16 @@ func ContainerPolicy(ctx context.Context) []string {
833
840
return checkNamesFor (ctx , policy .PolicyContainer )
834
841
}
835
842
836
- // ScratchContainerPolicy returns the names of checks in the
843
+ // ScratchNonRootContainerPolicy returns the names of checks in the
837
844
// container policy with scratch exception.
838
- func ScratchContainerPolicy (ctx context.Context ) []string {
839
- return checkNamesFor (ctx , policy .PolicyScratch )
845
+ func ScratchNonRootContainerPolicy (ctx context.Context ) []string {
846
+ return checkNamesFor (ctx , policy .PolicyScratchNonRoot )
847
+ }
848
+
849
+ // ScratchRootContainerPolicy returns the names of checks in the
850
+ // container policy with scratch and root exception.
851
+ func ScratchRootContainerPolicy (ctx context.Context ) []string {
852
+ return checkNamesFor (ctx , policy .PolicyScratchRoot )
840
853
}
841
854
842
855
// RootExceptionContainerPolicy returns the names of checks in the
0 commit comments