Documentation
¶
Index ¶
- Variables
- type AttOpFn
- type AttestOptions
- type AttestationResult
- type ConfigFn
- func WithAllowMergeCommits(allow bool) ConfigFn
- func WithAuthenticator(a *auth.Authenticator) ConfigFn
- func WithCreatePolicyPR(yesno bool) ConfigFn
- func WithEnforce(enforce bool) ConfigFn
- func WithExpectedIdentity(issuer, san string) ConfigFn
- func WithGithubCollector(yesno bool) ConfigFn
- func WithGithubStorer(yesno bool) ConfigFn
- func WithNotesCollector(yesno bool) ConfigFn
- func WithNotesStorer(yesno bool) ConfigFn
- func WithPolicyRepo(slug string) ConfigFn
- func WithStorageLocation(l ...string) ConfigFn
- func WithUserForkOrg(org string) ConfigFn
- type Tool
- func (t *Tool) AttestRevision(ctx context.Context, branch *models.Branch, rev models.Revision, ...) (*AttestationResult, error)
- func (t *Tool) Attester() *attest.Attester
- func (t *Tool) Backend() models.VcsBackend
- func (t *Tool) CheckPolicyRepoFork(_ context.Context) (bool, error)
- func (t *Tool) ConfigureControls(ctx context.Context, repo *models.Repository, branches []*models.Branch, ...) error
- func (t *Tool) ControlConfigurationDescr(branch *models.Branch, config models.ControlConfiguration) string
- func (t *Tool) ControlPrecheck(_ context.Context, r *models.Repository, branches []*models.Branch, ...) (ok bool, remediationMessage string, remediateFn models.ControlPreRemediationFn, ...)
- func (t *Tool) CreateBranchPolicy(ctx context.Context, r *models.Repository, branches []*models.Branch) (*policy.RepoPolicy, error)
- func (t *Tool) CreatePolicyRepoFork(ctx context.Context) error
- func (t *Tool) CreateRepositoryPolicy(ctx context.Context, r *models.Repository, branches []*models.Branch) (*policy.RepoPolicy, *models.PullRequest, error)
- func (t *Tool) FindPolicyPR(ctx context.Context, repo *models.Repository) (*models.PullRequest, error)
- func (t *Tool) GetBranchControls(ctx context.Context, branch *models.Branch) (*slsa.ControlSet, error)
- func (t *Tool) GetBranchControlsAtCommit(ctx context.Context, branch *models.Branch, commit *models.Commit) (*slsa.ControlSet, error)
- func (t *Tool) GetPreviousCommit(ctx context.Context, branch *models.Branch, commit *models.Commit) (*models.Commit, error)
- func (t *Tool) GetRepositoryPolicy(ctx context.Context, r *models.Repository) (*policy.RepoPolicy, error)
- func (t *Tool) OnboardRepository(ctx context.Context, repo *models.Repository, branches []*models.Branch) error
Constants ¶
This section is empty.
Variables ¶
var ControlConfigurations = []models.ControlConfiguration{ models.CONFIG_POLICY, models.CONFIG_GEN_PROVENANCE, models.CONFIG_BRANCH_RULES, models.CONFIG_TAG_RULES, }
Functions ¶
This section is empty.
Types ¶
type AttOpFn ¶ added in v0.7.0
type AttOpFn func(*AttestOptions) error
func WithLocalPolicy ¶ added in v0.7.0
func WithOutputPath ¶ added in v0.7.0
func WithUseStdout ¶ added in v0.7.0
type AttestOptions ¶ added in v0.7.0
type AttestationResult ¶ added in v0.7.0
type AttestationResult struct {
VerifiedLevels slsa.SourceVerifiedLevels
Shortfall *policy.PolicyShortfall
}
AttestationResult is the outcome of attesting a revision. Both attestations are always produced (and optionally pushed) regardless of whether the policy's target level was achieved. Shortfall will be not nil when the achieved SLSA level is below the policy's target.
type ConfigFn ¶
func WithAllowMergeCommits ¶ added in v0.7.0
func WithAuthenticator ¶
func WithAuthenticator(a *auth.Authenticator) ConfigFn
func WithCreatePolicyPR ¶
func WithEnforce ¶
func WithExpectedIdentity ¶ added in v0.7.0
WithExpectedIdentity overrides the identity (OIDC issuer and SAN) expected to have signed the attestations the tool verifies. Empty values keep the corresponding default.
func WithGithubCollector ¶ added in v0.7.0
func WithGithubStorer ¶ added in v0.7.0
func WithNotesCollector ¶ added in v0.7.0
func WithNotesStorer ¶ added in v0.7.0
func WithPolicyRepo ¶
func WithStorageLocation ¶ added in v0.7.0
func WithUserForkOrg ¶
type Tool ¶
type Tool struct {
Authenticator *auth.Authenticator
Options options.Options
// contains filtered or unexported fields
}
Tool is the main object intended to expose sourcetool's functionality as a public API. Some of the logic is still implemented on the CLI commands but we want to slowly move it to public function under this struct.
func (*Tool) AttestRevision ¶ added in v0.7.0
func (t *Tool) AttestRevision( ctx context.Context, branch *models.Branch, rev models.Revision, funcs ...AttOpFn, ) (*AttestationResult, error)
AttestRevision checks the source control system status, the repository policy and generates the repository attestations (provenance & VSA) for a revision
func (*Tool) Attester ¶ added in v0.7.0
Attester returns an attester object with the tool configuration
func (*Tool) Backend ¶ added in v0.7.0
func (t *Tool) Backend() models.VcsBackend
Backend returns the VCS backend
func (*Tool) CheckPolicyRepoFork ¶
CheckPolicyRepoFork checks that the logged in user has a fork of the configured policy repo.
func (*Tool) ConfigureControls ¶
func (t *Tool) ConfigureControls(ctx context.Context, repo *models.Repository, branches []*models.Branch, configs []models.ControlConfiguration) error
ConfigureControls sets up a control in the repo
func (*Tool) ControlConfigurationDescr ¶
func (t *Tool) ControlConfigurationDescr(branch *models.Branch, config models.ControlConfiguration) string
ControlConfigurationDescr returns a description of the controls
func (*Tool) ControlPrecheck ¶
func (t *Tool) ControlPrecheck( _ context.Context, r *models.Repository, branches []*models.Branch, config models.ControlConfiguration, ) (ok bool, remediationMessage string, remediateFn models.ControlPreRemediationFn, err error)
ControlPrecheck performs a prerequisite check before enabling a contrlol Backend may optionally return a remediation function to correct the prerequisite which the CLI can before attempting to enable the control.
func (*Tool) CreateBranchPolicy ¶
func (t *Tool) CreateBranchPolicy(ctx context.Context, r *models.Repository, branches []*models.Branch) (*policy.RepoPolicy, error)
CreateBranchPolicy creates a repository policy
func (*Tool) CreatePolicyRepoFork ¶
CreatePolicyRepoFork creates a fork of the policy repository in the user's GitHub org
func (*Tool) CreateRepositoryPolicy ¶
func (t *Tool) CreateRepositoryPolicy(ctx context.Context, r *models.Repository, branches []*models.Branch) (*policy.RepoPolicy, *models.PullRequest, error)
CreateRepositoryPolicy creates a policy for a repository
func (*Tool) FindPolicyPR ¶
func (t *Tool) FindPolicyPR(ctx context.Context, repo *models.Repository) (*models.PullRequest, error)
func (*Tool) GetBranchControls ¶
func (t *Tool) GetBranchControls(ctx context.Context, branch *models.Branch) (*slsa.ControlSet, error)
GetRepoControls returns the controls that are enabled in a repository branch.
func (*Tool) GetBranchControlsAtCommit ¶ added in v0.7.0
func (t *Tool) GetBranchControlsAtCommit(ctx context.Context, branch *models.Branch, commit *models.Commit) (*slsa.ControlSet, error)
GetRepoControls returns the controls that are enabled in a repository branch.
func (*Tool) GetPreviousCommit ¶ added in v0.7.0
func (t *Tool) GetPreviousCommit(ctx context.Context, branch *models.Branch, commit *models.Commit) (*models.Commit, error)
GetPreviousCommit returns the previous commit of the passed commit
func (*Tool) GetRepositoryPolicy ¶
func (t *Tool) GetRepositoryPolicy(ctx context.Context, r *models.Repository) (*policy.RepoPolicy, error)
GetRepositoryPolicy retrieves the policy of repo from the community
func (*Tool) OnboardRepository ¶
func (t *Tool) OnboardRepository(ctx context.Context, repo *models.Repository, branches []*models.Branch) error
OnboardRepository configures a repository to set up the required controls to meet SLSA Source L3.
Directories
¶
| Path | Synopsis |
|---|---|
|
backends
|
|
|
modelsfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
|
Code generated by counterfeiter.
|
Code generated by counterfeiter. |