binary

package
v0.0.0-...-13447b7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package binary implements the Binary Artifacts security policy check from scorecard.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBinary

func NewBinary() policydef.Policy

NewBinary returns a new Binary Artifacts policy.

Types

type Binary

type Binary bool

Binary is the Binary Artifacts policy object, implements policydef.Policy.

func (Binary) Check

func (b Binary) Check(ctx context.Context, c *github.Client, owner,
	repo string) (*policydef.Result, error)

Check performs the policy check for this policy based on the configuration stored in the org/repo, implementing policydef.Policy.Check()

func (Binary) Fix

func (b Binary) Fix(ctx context.Context, c *github.Client, owner, repo string) error

Fix implementing policydef.Policy.Fix(). Scorecard checks will not have a Fix option.

func (Binary) GetAction

func (b Binary) GetAction(ctx context.Context, c *github.Client, owner, repo string) string

GetAction returns the configured action from this policy's configuration stored in the org-level repo, default log. Implementing policydef.Policy.GetAction()

func (Binary) IsEnabled

func (b Binary) IsEnabled(ctx context.Context, c *github.Client, owner, repo string) (bool, error)

Check whether this policy is enabled or not

func (Binary) Name

func (b Binary) Name() string

Name returns the name of this policy, implementing policydef.Policy.Name()

type OrgConfig

type OrgConfig struct {
	// OptConfig is the standard org-level opt in/out config, RepoOverride applies to all
	// config.
	OptConfig config.OrgOptConfig `json:"optConfig"`

	// Action defines which action to take, default log, other: issue...
	Action string `json:"action"`

	// IgnoreFiles is a list of file names to ignore. Any Binary Artifacts found
	// with these names are allowed, and the policy may still pass. These are
	// just the file name, not a full path. Globs are not allowed.
	IgnoreFiles []string `json:"ignoreFiles"`
}

OrgConfig is the org-level config definition for this policy.

type RepoConfig

type RepoConfig struct {
	// OptConfig is the standard repo-level opt in/out config.
	OptConfig config.RepoOptConfig `json:"optConfig"`

	// Action overrides the same setting in org-level, only if present.
	Action *string `json:"action"`

	// IgnorePaths is a list of full paths to ignore. If these are reported as a
	// Binary Artifact, they will be ignored and the policy may still pass. These
	// must be full paths with directories. Globs are not allowed. These are
	// allowed even if RepoOverride is false.
	IgnorePaths []string `json:"ignorePaths"`
}

RepoConfig is the repo-level config for this policy.

Jump to

Keyboard shortcuts

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