github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/pkg/fanal/types/image.go (about) 1 package types 2 3 import ( 4 v1 "github.com/google/go-containerregistry/pkg/v1" 5 ) 6 7 const ( 8 // DockerImageSource is the docker runtime 9 DockerImageSource ImageSource = "docker" 10 11 // ContainerdImageSource is the containerd runtime 12 ContainerdImageSource ImageSource = "containerd" 13 14 // PodmanImageSource is the podman runtime 15 PodmanImageSource ImageSource = "podman" 16 17 // RemoteImageSource represents a remote scan 18 RemoteImageSource ImageSource = "remote" 19 ) 20 21 var ( 22 AllImageSources = ImageSources{ 23 DockerImageSource, 24 ContainerdImageSource, 25 PodmanImageSource, 26 RemoteImageSource, 27 } 28 ) 29 30 type Platform struct { 31 *v1.Platform 32 33 // Force returns an error if the specified platform is not found. 34 // This option is for DevSecCon, and cannot be configured via Trivy CLI. 35 Force bool 36 } 37 38 type Image interface { 39 v1.Image 40 ImageExtension 41 } 42 43 type ImageExtension interface { 44 Name() string 45 ID() (string, error) 46 RepoTags() []string 47 RepoDigests() []string 48 } 49 50 type ImageOptions struct { 51 RegistryOptions RegistryOptions 52 DockerOptions DockerOptions 53 PodmanOptions PodmanOptions 54 ContainerdOptions ContainerdOptions 55 ImageSources ImageSources 56 } 57 58 type DockerOptions struct { 59 Host string 60 } 61 62 type PodmanOptions struct { 63 // Add Podman-specific options 64 } 65 66 type ContainerdOptions struct { 67 // Add Containerd-specific options 68 } 69 70 // ImageSource represents the source of an image. It can be a string that identifies 71 // the container registry or a type of container runtime. 72 type ImageSource string 73 74 // ImageSources is a slice of image sources 75 type ImageSources []ImageSource 76 77 type RegistryOptions struct { 78 // Auth for registries 79 Credentials []Credential 80 81 // RegistryToken is a bearer token to be sent to a registry 82 RegistryToken string 83 84 // SSL/TLS 85 Insecure bool 86 87 // For internal use. Needed for mTLS authentication. 88 ClientCert []byte 89 ClientKey []byte 90 91 // Architecture 92 Platform Platform 93 94 // ECR 95 AWSAccessKey string 96 AWSSecretKey string 97 AWSSessionToken string 98 AWSRegion string 99 100 // GCP 101 GCPCredPath string 102 } 103 104 type Credential struct { 105 Username string 106 Password string 107 }