commands

package
v1.0.0-rc.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2026 License: AGPL-3.0 Imports: 41 Imported by: 0

Documentation

Overview

Copyright (C) 2024 Tim Bastin, l3montree GmbH

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	SilenceUsage:      true,
	Use:               "devguard-scanner",
	Short:             "Secure your Software Supply Chain",
	Version:           version,
	DisableAutoGenTag: true,
	Long: `Secure your Software Supply Chain

DevGuard Scanner is a small CLI to help generate, sign and upload SBOMs, SARIF
reports and attestations to a DevGuard backend. Use commands like 'sca', 'sarif',
and 'attest' to interact with the platform. Configuration can be provided via a
./.devguard config file or environment variables (prefix DEVGUARD_).`,
	Example: `  # Run Software Composition Analysis on a container image
  devguard-scanner sca ghcr.io/org/image:tag

  # Run SCA on a local project directory
  devguard-scanner sca ./path/to/project

  # Create and upload an attestation
  devguard-scanner attest predicate.json ghcr.io/org/image:tag --predicateType https://cyclonedx.org/vex/1.0

  # Upload a SARIF report
  devguard-scanner sarif results.sarif.json`,

	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

		level, err := cmd.Flags().GetString("logLevel")
		if err != nil {
			return err
		}

		switch level {
		case "debug":
			initLogger(slog.LevelDebug)
		case "info":
			initLogger(slog.LevelInfo)
		case "warn":
			initLogger(slog.LevelWarn)
		case "error":
			initLogger(slog.LevelError)
		default:
			initLogger(slog.LevelInfo)
		}

		if utils.RunsInCI() {
			slog.Debug("Running in CI")
			err := utils.GitLister.MarkAllPathsAsSafe()
			if err != nil {
				slog.Debug("could not mark all paths as safe", "err", err)
			}
		}

		err = initializeConfig(cmd)
		if err != nil {
			return err
		}

		return nil
	},
}

Functions

func Execute added in v0.17.0

func Execute()

func NewAttestCommand

func NewAttestCommand() *cobra.Command

func NewAttestationCommand

func NewAttestationCommand() *cobra.Command

func NewCleanCommand added in v0.17.0

func NewCleanCommand() *cobra.Command

NewCleanCommand returns a command that wraps `cosign remove` to clean attestations/signatures. It exposes the same --key and --yes flags as cosign for familiarity.

func NewContainerScanningCommand

func NewContainerScanningCommand() *cobra.Command

func NewCurlCommand added in v0.17.0

func NewCurlCommand() *cobra.Command

func NewDiscoverBaseImageAttestationsCommand added in v0.19.0

func NewDiscoverBaseImageAttestationsCommand() *cobra.Command

func NewGenerateTagCommand

func NewGenerateTagCommand() *cobra.Command

func NewGetCommand added in v0.17.0

func NewGetCommand() *cobra.Command

func NewIaCCommand added in v0.17.0

func NewIaCCommand() *cobra.Command

func NewInspectCommand

func NewInspectCommand() *cobra.Command

func NewLoginCommand

func NewLoginCommand() *cobra.Command

func NewMergeSBOMSCommand added in v0.18.7

func NewMergeSBOMSCommand() *cobra.Command

func NewSCACommand

func NewSCACommand() *cobra.Command

func NewSarifCommand added in v0.17.0

func NewSarifCommand() *cobra.Command

func NewSastCommand added in v0.17.0

func NewSastCommand() *cobra.Command

func NewSbomCommand added in v0.17.0

func NewSbomCommand() *cobra.Command

func NewSecretScanningCommand added in v0.17.0

func NewSecretScanningCommand() *cobra.Command

func NewSignCommand

func NewSignCommand() *cobra.Command

func NewSlugCommand added in v0.17.0

func NewSlugCommand() *cobra.Command

func NewVexCommand added in v0.19.0

func NewVexCommand() *cobra.Command

Types

type CurlOptions added in v0.17.0

type CurlOptions struct {
	// contains filtered or unexported fields
}

type MergeSBOMsConfigFile added in v0.18.7

type MergeSBOMsConfigFile struct {
	Purl  string   `json:"purl"`
	SBOMs []string `json:"sboms"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL