snyk-docker-plugin

  • Version 6.13.18
  • Published
  • 712 kB
  • 26 dependencies
  • Apache-2.0 license

Install

npm i snyk-docker-plugin
yarn add snyk-docker-plugin
pnpm add snyk-docker-plugin

Overview

Snyk CLI docker plugin

Index

Functions

function analyseDockerfile

analyseDockerfile: (contents: string) => Promise<DockerFileAnalysis>;

    function display

    display: (
    scanResults: ScanResult[],
    testResults: TestResult[],
    errors: string[],
    options?: Options
    ) => Promise<string>;

      function parseDockerfile

      parseDockerfile: (content: string) => Dockerfile;

        function scan

        scan: (options?: Partial<PluginOptions>) => Promise<PluginResponse>;

          function updateDockerfileBaseImageName

          updateDockerfileBaseImageName: (
          contents: string,
          newBaseImageName: string
          ) => UpdateDockerfileBaseImageNameResult;
          • Updates the image name of the last from stage, after resolving all aliases

            Parameter contents

            Contents of the Dockerfile to update

            Parameter newBaseImageName

            New base image name Dockerfile contents should be updated to

          Interfaces

          interface AutoDetectedUserInstructions

          interface AutoDetectedUserInstructions {}

            property dockerfileLayers

            dockerfileLayers: DockerFileLayers;

              property dockerfilePackages

              dockerfilePackages: DockerFilePackages;

                interface Binary

                interface Binary {}

                  property name

                  name: string;

                    property version

                    version: string;

                      interface ContainerTarget

                      interface ContainerTarget {}

                        property image

                        image: string;

                          interface DockerFileAnalysis

                          interface DockerFileAnalysis {}

                            property baseImage

                            baseImage?: string;

                              property dockerfileLayers

                              dockerfileLayers: DockerFileLayers;

                                property dockerfilePackages

                                dockerfilePackages: DockerFilePackages;

                                  property error

                                  error?: {
                                  code: DockerFileAnalysisErrorCode;
                                  };

                                    interface Fact

                                    interface Fact {}
                                    • A collection of things that were found as part of a scan. As the developer and owner, you are responsible for defining and maintaining your own Facts. Examples of facts: a dependency graph, a list of file content hashes, Dockerfile analysis. See FactType.

                                    property data

                                    data: any;

                                      property type

                                      type: FactType;

                                        interface Identity

                                        interface Identity {}
                                        • The identity of a scan result allows to uniquely locate "what" you found. Any differences in the identity influences how a Project is created in Snyk and can result in a completely different Project (for example, if "args.targetFramework" differs).

                                        property args

                                        args?: { [key: string]: string };

                                          property targetFile

                                          targetFile?: string;

                                            property type

                                            type: string;
                                            • This used to be represented as "packageManager" but now can contain any sensible ecosystem type. Examples: dockerfile, cpp, terraform-module, deb, npm, and so on.

                                            interface ManifestFile

                                            interface ManifestFile {}

                                              property contents

                                              contents: string;
                                              • Base64-encoded file contents. We use Base64 to avoid any assumptions about the original file encoding, which is difficult to infer and may be corrupted when the data is transferred over the network.

                                              property name

                                              name: string;

                                                property path

                                                path: string;

                                                  interface PluginResponse

                                                  interface PluginResponse {}

                                                    property scanResults

                                                    scanResults: ScanResult[];
                                                    • The first result is guaranteed to be the OS dependencies scan result.

                                                    interface ScanResult

                                                    interface ScanResult {}

                                                      property facts

                                                      facts: Fact[];
                                                      • Facts are the collection of things you found.

                                                      property identity

                                                      identity: Identity;
                                                      • Identity defines "what" you found.

                                                      property name

                                                      name?: string;
                                                      • User-friendly name to use as the name of the Project that Snyk creates.

                                                      property policy

                                                      policy?: string;
                                                      • Contains the Snyk policy file content.

                                                      property target

                                                      target: ContainerTarget;
                                                      • The target defines "where" you found this scan result.

                                                      Enums

                                                      enum DockerFileAnalysisErrorCode

                                                      enum DockerFileAnalysisErrorCode {
                                                      BASE_IMAGE_NAME_NOT_FOUND = 'BASE_IMAGE_NAME_NOT_FOUND',
                                                      BASE_IMAGE_NON_RESOLVABLE = 'BASE_IMAGE_NON_RESOLVABLE',
                                                      }

                                                        member BASE_IMAGE_NAME_NOT_FOUND

                                                        BASE_IMAGE_NAME_NOT_FOUND = 'BASE_IMAGE_NAME_NOT_FOUND'

                                                          member BASE_IMAGE_NON_RESOLVABLE

                                                          BASE_IMAGE_NON_RESOLVABLE = 'BASE_IMAGE_NON_RESOLVABLE'

                                                            enum UpdateDockerfileBaseImageNameErrorCode

                                                            enum UpdateDockerfileBaseImageNameErrorCode {
                                                            BASE_IMAGE_NAME_FRAGMENTED = 'BASE_IMAGE_NAME_FRAGMENTED',
                                                            BASE_IMAGE_NAME_NOT_FOUND = 'BASE_IMAGE_NAME_NOT_FOUND',
                                                            DOCKERFILE_GENERATION_FAILED = 'DOCKERFILE_GENERATION_FAILED',
                                                            }

                                                              member BASE_IMAGE_NAME_FRAGMENTED

                                                              BASE_IMAGE_NAME_FRAGMENTED = 'BASE_IMAGE_NAME_FRAGMENTED'

                                                                member BASE_IMAGE_NAME_NOT_FOUND

                                                                BASE_IMAGE_NAME_NOT_FOUND = 'BASE_IMAGE_NAME_NOT_FOUND'

                                                                  member DOCKERFILE_GENERATION_FAILED

                                                                  DOCKERFILE_GENERATION_FAILED = 'DOCKERFILE_GENERATION_FAILED'

                                                                    Type Aliases

                                                                    type FactType

                                                                    type FactType =
                                                                    | 'autoDetectedUserInstructions'
                                                                    | 'depGraph'
                                                                    | 'dockerfileAnalysis'
                                                                    | 'imageCreationTime'
                                                                    | 'imageId'
                                                                    | 'imageLabels'
                                                                    // Collects the file names of the individual .tar layers found in the scanned image.
                                                                    | 'imageLayers'
                                                                    // Package manager manifests (e.g. requirements.txt, Gemfile.lock) collected as part of an application scan.
                                                                    | 'imageManifestFiles'
                                                                    | 'imageNames'
                                                                    | 'imageOsReleasePrettyName'
                                                                    | 'imageSizeBytes'
                                                                    // Hashes of extracted *.jar binaries, hashed with sha1 algorithm
                                                                    | 'jarFingerprints'
                                                                    // Hashes of executables not installed by a package manager (e.g. if they were copied straight onto the image).
                                                                    | 'keyBinariesHashes'
                                                                    | 'loadedPackages'
                                                                    | 'ociDistributionMetadata'
                                                                    | 'rootFs'
                                                                    // Used for application dependencies scanning; shows which files were used in the analysis of the dependencies.
                                                                    | 'testedFiles';

                                                                      Namespaces

                                                                      namespace dockerFile

                                                                      module 'lib/dockerfile/index.ts' {}

                                                                        function analyseDockerfile

                                                                        analyseDockerfile: (contents: string) => Promise<DockerFileAnalysis>;

                                                                          function getDockerfileBaseImageName

                                                                          getDockerfileBaseImageName: (
                                                                          dockerfile: Dockerfile
                                                                          ) => GetDockerfileBaseImageNameResult;
                                                                          • Return the image name of the last from stage, after resolving all aliases

                                                                            Parameter dockerfile

                                                                            Dockerfile to use for retrieving the last stage image name

                                                                          function getPackagesFromDockerfile

                                                                          getPackagesFromDockerfile: (dockerfile: Dockerfile) => DockerFilePackages;

                                                                            function instructionDigest

                                                                            instructionDigest: (instruction: any) => string;

                                                                              function parseDockerfile

                                                                              parseDockerfile: (content: string) => Dockerfile;

                                                                                function readDockerfileAndAnalyse

                                                                                readDockerfileAndAnalyse: (
                                                                                dockerfilePath?: string
                                                                                ) => Promise<DockerFileAnalysis | undefined>;

                                                                                  function updateDockerfileBaseImageName

                                                                                  updateDockerfileBaseImageName: (
                                                                                  contents: string,
                                                                                  newBaseImageName: string
                                                                                  ) => UpdateDockerfileBaseImageNameResult;
                                                                                  • Updates the image name of the last from stage, after resolving all aliases

                                                                                    Parameter contents

                                                                                    Contents of the Dockerfile to update

                                                                                    Parameter newBaseImageName

                                                                                    New base image name Dockerfile contents should be updated to

                                                                                  interface DockerFileAnalysis

                                                                                  interface DockerFileAnalysis {}

                                                                                    property baseImage

                                                                                    baseImage?: string;

                                                                                      property dockerfileLayers

                                                                                      dockerfileLayers: DockerFileLayers;

                                                                                        property dockerfilePackages

                                                                                        dockerfilePackages: DockerFilePackages;

                                                                                          property error

                                                                                          error?: {
                                                                                          code: DockerFileAnalysisErrorCode;
                                                                                          };

                                                                                            namespace facts

                                                                                            module 'lib/facts.ts' {}

                                                                                              interface AutoDetectedUserInstructionsFact

                                                                                              interface AutoDetectedUserInstructionsFact {}

                                                                                                property data

                                                                                                data: AutoDetectedUserInstructions;

                                                                                                  property type

                                                                                                  type: 'autoDetectedUserInstructions';

                                                                                                    interface DepGraphFact

                                                                                                    interface DepGraphFact {}

                                                                                                      property data

                                                                                                      data: DepGraph;

                                                                                                        property type

                                                                                                        type: 'depGraph';

                                                                                                          interface DockerfileAnalysisFact

                                                                                                          interface DockerfileAnalysisFact {}

                                                                                                            property data

                                                                                                            data: DockerFileAnalysis;

                                                                                                              property type

                                                                                                              type: 'dockerfileAnalysis';

                                                                                                                interface ImageCreationTimeFact

                                                                                                                interface ImageCreationTimeFact {}

                                                                                                                  property data

                                                                                                                  data: string;

                                                                                                                    property type

                                                                                                                    type: 'imageCreationTime';

                                                                                                                      interface ImageIdFact

                                                                                                                      interface ImageIdFact {}

                                                                                                                        property data

                                                                                                                        data: string;

                                                                                                                          property type

                                                                                                                          type: 'imageId';

                                                                                                                            interface ImageLabels

                                                                                                                            interface ImageLabels {}

                                                                                                                              property data

                                                                                                                              data: {
                                                                                                                              [key: string]: string;
                                                                                                                              };

                                                                                                                                property type

                                                                                                                                type: 'imageLabels';

                                                                                                                                  interface ImageLayersFact

                                                                                                                                  interface ImageLayersFact {}

                                                                                                                                    property data

                                                                                                                                    data: string[];

                                                                                                                                      property type

                                                                                                                                      type: 'imageLayers';

                                                                                                                                        interface ImageManifestFilesFact

                                                                                                                                        interface ImageManifestFilesFact {}

                                                                                                                                          property data

                                                                                                                                          data: ManifestFile[];

                                                                                                                                            property type

                                                                                                                                            type: 'imageManifestFiles';

                                                                                                                                              interface ImageNamesFact

                                                                                                                                              interface ImageNamesFact {}

                                                                                                                                                property data

                                                                                                                                                data: ImageNameInfo;

                                                                                                                                                  property type

                                                                                                                                                  type: 'imageNames';

                                                                                                                                                    interface ImageOsReleasePrettyNameFact

                                                                                                                                                    interface ImageOsReleasePrettyNameFact {}

                                                                                                                                                      property data

                                                                                                                                                      data: string;

                                                                                                                                                        property type

                                                                                                                                                        type: 'imageOsReleasePrettyName';

                                                                                                                                                          interface ImageSizeBytesFact

                                                                                                                                                          interface ImageSizeBytesFact {}

                                                                                                                                                            property data

                                                                                                                                                            data: number;

                                                                                                                                                              property type

                                                                                                                                                              type: 'imageSizeBytes';

                                                                                                                                                                interface JarFingerprintsFact

                                                                                                                                                                interface JarFingerprintsFact {}

                                                                                                                                                                  property data

                                                                                                                                                                  data: {
                                                                                                                                                                  fingerprints: JarFingerprint[];
                                                                                                                                                                  origin: string;
                                                                                                                                                                  path: string;
                                                                                                                                                                  };

                                                                                                                                                                    property type

                                                                                                                                                                    type: 'jarFingerprints';

                                                                                                                                                                      interface KeyBinariesHashesFact

                                                                                                                                                                      interface KeyBinariesHashesFact {}

                                                                                                                                                                        property data

                                                                                                                                                                        data: string[];

                                                                                                                                                                          property type

                                                                                                                                                                          type: 'keyBinariesHashes';

                                                                                                                                                                            interface LoadedPackagesFact

                                                                                                                                                                            interface LoadedPackagesFact {}

                                                                                                                                                                              property data

                                                                                                                                                                              data: string;

                                                                                                                                                                                property type

                                                                                                                                                                                type: 'loadedPackages';

                                                                                                                                                                                  interface OCIDistributionMetadataFact

                                                                                                                                                                                  interface OCIDistributionMetadataFact {}

                                                                                                                                                                                    property data

                                                                                                                                                                                    data: OCIDistributionMetadata;

                                                                                                                                                                                      property type

                                                                                                                                                                                      type: 'ociDistributionMetadata';

                                                                                                                                                                                        interface RootFsFact

                                                                                                                                                                                        interface RootFsFact {}

                                                                                                                                                                                          property data

                                                                                                                                                                                          data: string[];

                                                                                                                                                                                            property type

                                                                                                                                                                                            type: 'rootFs';

                                                                                                                                                                                              interface TestedFilesFact

                                                                                                                                                                                              interface TestedFilesFact {}

                                                                                                                                                                                                property data

                                                                                                                                                                                                data: string[];

                                                                                                                                                                                                  property type

                                                                                                                                                                                                  type: 'testedFiles';

                                                                                                                                                                                                    Package Files (10)

                                                                                                                                                                                                    Dependencies (26)

                                                                                                                                                                                                    Dev Dependencies (17)

                                                                                                                                                                                                    Peer Dependencies (0)

                                                                                                                                                                                                    No peer dependencies.

                                                                                                                                                                                                    Badge

                                                                                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/snyk-docker-plugin.

                                                                                                                                                                                                    • Markdown
                                                                                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/snyk-docker-plugin)
                                                                                                                                                                                                    • HTML
                                                                                                                                                                                                      <a href="https://www.jsdocs.io/package/snyk-docker-plugin"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>