models

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProtectionAlreadyInPlace = errors.New("controls already in place in the repository")

Functions

This section is empty.

Types

type Actor

type Actor struct {
	Login string
}

Actor abstracts a user. For now it is intended to model both entities that interact with a repository but also the user using sourcetool. At some point we may split both roles if we need to.

func (*Actor) GetLogin

func (a *Actor) GetLogin() string

GetLogin returns the login string of the Actor

type AttestationStorageReader

type AttestationStorageReader interface {
	GetCommitVsa(context.Context, *Branch, *Commit) (*attestation.Statement, *vpb.VerificationSummary, error)
	GetCommitProvenance(context.Context, *Branch, *Commit) (*attestation.Statement, *provenance.SourceProvenancePred, error)
}

AttestationStorageReader abstracts an attestation storage system where sourcetool can read VSAs and provenance attestations. For now we only have retrieval functions but this may expand to store statements as well if we need to.

type Branch

type Branch struct {
	Name       string
	Repository *Repository
}

func (*Branch) FullRef

func (b *Branch) FullRef() string

type Commit

type Commit struct {
	SHA     string
	Author  string
	Time    *time.Time
	Message string
}

type ControlConfiguration

type ControlConfiguration string
const (
	CONFIG_POLICY         ControlConfiguration = "CONFIG_POLICY"
	CONFIG_GEN_PROVENANCE ControlConfiguration = "CONFIG_GEN_PROVENANCE"
	CONFIG_BRANCH_RULES   ControlConfiguration = "CONFIG_BRANCH_RULES"
	CONFIG_TAG_RULES      ControlConfiguration = "CONFIG_TAG_RULES"
)

type ControlPreRemediationFn

type ControlPreRemediationFn func() (string, error)

ControlPreRemediation is a function returned by the VCS backends when checking for prerequisites that the user may optionally run

type PullRequest

type PullRequest struct {
	Title  string
	Body   string
	Time   *time.Time
	Head   string
	Base   string // main
	Number int
	Repo   *Repository
}

PullRequest models a GitHub pull request. If we need to use this outside of the repo.PullRequestManager and other GitHub-specific code we should model a ChangeRequest or similar interface to accommodate similar constructs, such as GitLab merge requests.

type Repository

type Repository struct {
	Hostname      string
	Path          string
	DefaultBranch string
}

func (*Repository) GetHttpURL

func (r *Repository) GetHttpURL() string

func (*Repository) GetSshURL

func (r *Repository) GetSshURL() string

func (*Repository) PathAsGitHubOwnerName

func (r *Repository) PathAsGitHubOwnerName() (owner, name string, err error)

parseRepoPath parses the owner and repo name from the repository path

type Tag

type Tag struct {
	Name   string
	Commit *Commit
}

type VcsBackend

type VcsBackend interface {
	GetBranchControls(context.Context, *Repository, *Branch) (*slsa.ControlSetStatus, error)
	GetBranchControlsAtCommit(context.Context, *Repository, *Branch, *Commit) (*slsa.ControlSetStatus, error)
	GetTagControls(context.Context, *Tag) (*slsa.Controls, error)
	ControlConfigurationDescr(*Branch, ControlConfiguration) string
	ConfigureControls(*Repository, []*Branch, []ControlConfiguration) error
	GetLatestCommit(context.Context, *Repository, *Branch) (*Commit, error)
	ControlPrecheck(*Repository, []*Branch, ControlConfiguration) (bool, string, ControlPreRemediationFn, error)
}

VcsBackend abstracts a VCS or VCS hosting system that sourcetool can inspect for SLSA controls.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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