scan

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	UUID          string    `json:"uuid"`
	StepUUID      string    `json:"step_uuid"`
	Path          string    `json:"path"`
	ArtifactType  string    `json:"artifactType"`
	FileSizeBytes int       `json:"file_size_bytes"`
	CreatedOn     time.Time `json:"created_on"`
	StorageType   string    `json:"storageType"`
	Key           string    `json:"key"`
	Name          string    `json:"name"`
}

type BitBucketApiClient

type BitBucketApiClient struct {
	Client          resty.Client
	BaseURL         string
	InternalBaseURL string
}

Docs: https://developer.atlassian.com/cloud/bitbucket/rest/intro/

func NewClient

func NewClient(username string, password string, bitBucketCookie string, baseURL string) BitBucketApiClient

func (BitBucketApiClient) GetDownloadArtifact

func (a BitBucketApiClient) GetDownloadArtifact(url string) []byte

func (BitBucketApiClient) GetPipelineArtifact

func (a BitBucketApiClient) GetPipelineArtifact(workspaceSlug string, repoSlug string, buildNumber int, artifactUUID string) []byte

Internal API: https://bitbucket.org/!api/internal/repositories/{workspace}/{repo}/pipelines/{buildId}/artifacts/{ArtifactUUID}/content

func (BitBucketApiClient) GetuserInfo

func (a BitBucketApiClient) GetuserInfo()

Internal API: GET https://bitbucket.org/!api/2.0/user/emails

func (BitBucketApiClient) ListPipelineArtifacts

func (a BitBucketApiClient) ListPipelineArtifacts(nextPageUrl string, workspaceSlug string, repoSlug string, buildNumber int) ([]Artifact, string, *resty.Response, error)

Internal API: https://bitbucket.org/!api/internal/repositories/{workspace}/{repo}/pipelines/{buildNumber}/artifacts

type DownloadArtifact

type DownloadArtifact struct {
	Name      string    `json:"name"`
	Size      int       `json:"size"`
	CreatedOn time.Time `json:"created_on"`
	User      struct {
		Type  string `json:"type"`
		Links struct {
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
		} `json:"links"`
		CreatedOn     time.Time `json:"created_on"`
		DisplayName   string    `json:"display_name"`
		UUID          string    `json:"uuid"`
		AccountID     string    `json:"account_id"`
		AccountStatus string    `json:"account_status"`
		Kind          string    `json:"kind"`
	} `json:"user"`
	Downloads int `json:"downloads"`
	Links     struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
	} `json:"links"`
	Type string `json:"type"`
}

type PaginatedResponse

type PaginatedResponse[T any] struct {
	Pagelen  int    `json:"pagelen"`
	Page     int    `json:"page"`
	Size     int    `json:"size"`
	Next     string `json:"next"`
	Previous string `json:"previous"`
	Values   []T    `json:"values"`
}

type Pipeline

type Pipeline struct {
	Type        string `json:"type"`
	UUID        string `json:"uuid"`
	BuildNumber int    `json:"build_number"`
	Creator     struct {
		Type string `json:"type"`
	} `json:"creator"`
	Repository struct {
		Type string `json:"type"`
	} `json:"repository"`
	Target struct {
		Type string `json:"type"`
	} `json:"target"`
	Trigger struct {
		Type string `json:"type"`
	} `json:"trigger"`
	State struct {
		Type string `json:"type"`
	} `json:"state"`
	Variables []struct {
		Type string `json:"type"`
	} `json:"variables"`
	CreatedOn            string `json:"created_on"`
	CompletedOn          string `json:"completed_on"`
	BuildSecondsUsed     int    `json:"build_seconds_used"`
	ConfigurationSources []struct {
		Source string `json:"source"`
		URI    string `json:"uri"`
	} `json:"configuration_sources"`
	Links struct {
		Type string `json:"type"`
	} `json:"links"`
}

type PipelineStep

type PipelineStep struct {
	Type        string `json:"type"`
	UUID        string `json:"uuid"`
	StartedOn   string `json:"started_on"`
	CompletedOn string `json:"completed_on"`
	State       struct {
		Type string `json:"type"`
	} `json:"state"`
	Image struct {
	} `json:"image"`
	SetupCommands []struct {
	} `json:"setup_commands"`
	ScriptCommands []struct {
	} `json:"script_commands"`
}

type PublicRepository

type PublicRepository struct {
	Type     string `json:"type"`
	FullName string `json:"full_name"`
	Links    struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Avatar struct {
			Href string `json:"href"`
		} `json:"avatar"`
		Pullrequests struct {
			Href string `json:"href"`
		} `json:"pullrequests"`
		Commits struct {
			Href string `json:"href"`
		} `json:"commits"`
		Forks struct {
			Href string `json:"href"`
		} `json:"forks"`
		Watchers struct {
			Href string `json:"href"`
		} `json:"watchers"`
		Branches struct {
			Href string `json:"href"`
		} `json:"branches"`
		Tags struct {
			Href string `json:"href"`
		} `json:"tags"`
		Downloads struct {
			Href string `json:"href"`
		} `json:"downloads"`
		Source struct {
			Href string `json:"href"`
		} `json:"source"`
		Clone []struct {
			Name string `json:"name"`
			Href string `json:"href"`
		} `json:"clone"`
		Hooks struct {
			Href string `json:"href"`
		} `json:"hooks"`
	} `json:"links"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Scm         string `json:"scm"`
	Website     string `json:"website"`
	Owner       struct {
		DisplayName string `json:"display_name"`
		Links       struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
		} `json:"links"`
		Type      string `json:"type"`
		UUID      string `json:"uuid"`
		AccountID string `json:"account_id"`
		Nickname  string `json:"nickname"`
	} `json:"owner"`
	Workspace struct {
		Type  string `json:"type"`
		UUID  string `json:"uuid"`
		Name  string `json:"name"`
		Slug  string `json:"slug"`
		Links struct {
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
		} `json:"links"`
	} `json:"workspace"`
	IsPrivate bool `json:"is_private"`
	Project   struct {
		Type  string `json:"type"`
		Key   string `json:"key"`
		UUID  string `json:"uuid"`
		Name  string `json:"name"`
		Links struct {
			Self struct {
				Href string `json:"href"`
			} `json:"self"`
			HTML struct {
				Href string `json:"href"`
			} `json:"html"`
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
		} `json:"links"`
	} `json:"project"`
	ForkPolicy string    `json:"fork_policy"`
	CreatedOn  time.Time `json:"created_on"`
	UpdatedOn  time.Time `json:"updated_on"`
	Size       int       `json:"size"`
	Language   string    `json:"language"`
	UUID       string    `json:"uuid"`
	Mainbranch struct {
		Name string `json:"name"`
		Type string `json:"type"`
	} `json:"mainbranch"`
	OverrideSettings struct {
		DefaultMergeStrategy bool `json:"default_merge_strategy"`
		BranchingModel       bool `json:"branching_model"`
	} `json:"override_settings"`
	Parent                interface{} `json:"parent"`
	EnforcedSignedCommits interface{} `json:"enforced_signed_commits"`
	HasIssues             bool        `json:"has_issues"`
	HasWiki               bool        `json:"has_wiki"`
}

type Repository

type Repository struct {
	Type  string `json:"type"`
	Links struct {
		Self struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"self"`
		HTML struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"html"`
		Avatar struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"avatar"`
		Pullrequests struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"pullrequests"`
		Commits struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"commits"`
		Forks struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"forks"`
		Watchers struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"watchers"`
		Downloads struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"downloads"`
		Clone []struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"clone"`
		Hooks struct {
			Href string `json:"href"`
			Name string `json:"name"`
		} `json:"hooks"`
	} `json:"links"`
	UUID      string `json:"uuid"`
	FullName  string `json:"full_name"`
	IsPrivate bool   `json:"is_private"`
	Scm       string `json:"scm"`
	Owner     struct {
		Type string `json:"type"`
	} `json:"owner"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	CreatedOn   time.Time `json:"created_on"`
	UpdatedOn   time.Time `json:"updated_on"`
	Size        int       `json:"size"`
	Language    string    `json:"language"`
	HasIssues   bool      `json:"has_issues"`
	HasWiki     bool      `json:"has_wiki"`
	ForkPolicy  string    `json:"fork_policy"`
	Project     struct {
		Type string `json:"type"`
	} `json:"project"`
	Mainbranch struct {
		Type string `json:"type"`
	} `json:"mainbranch"`
}

type ScanOptions

type ScanOptions struct {
	Email                  string
	AccessToken            string
	ConfidenceFilter       []string
	MaxScanGoRoutines      int
	TruffleHogVerification bool
	MaxPipelines           int
	Workspace              string
	Owned                  bool
	Public                 bool
	After                  string
	Artifacts              bool
	BitBucketURL           string
	MaxArtifactSize        int64
	HitTimeout             time.Duration
	Context                context.Context
	Client                 BitBucketApiClient
	HasProvidedCookie      bool
}

ScanOptions contains configuration options for BitBucket scanning operations.

func InitializeOptions

func InitializeOptions(email, accessToken, bitBucketCookie, bitBucketURL, workspace, after, maxArtifactSizeStr string,
	owned, public, artifacts, truffleHogVerification bool,
	maxPipelines, maxScanGoRoutines int, confidenceFilter []string, hitTimeout time.Duration) (ScanOptions, error)

InitializeOptions prepares scan options from CLI parameters.

type Scanner

type Scanner interface {
	pkgscanner.BaseScanner
}

func NewScanner

func NewScanner(opts ScanOptions) Scanner

type UserInfo

type UserInfo struct {
	DisplayName string `json:"display_name"`
	Links       struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Avatar struct {
			Href string `json:"href"`
		} `json:"avatar"`
		Repositories struct {
			Href string `json:"href"`
		} `json:"repositories"`
		Snippets struct {
			Href string `json:"href"`
		} `json:"snippets"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Hooks struct {
			Href string `json:"href"`
		} `json:"hooks"`
	} `json:"links"`
	CreatedOn     time.Time   `json:"created_on"`
	Type          string      `json:"type"`
	UUID          string      `json:"uuid"`
	Has2FaEnabled bool        `json:"has_2fa_enabled"`
	Username      string      `json:"username"`
	IsStaff       bool        `json:"is_staff"`
	AccountID     string      `json:"account_id"`
	Nickname      string      `json:"nickname"`
	AccountStatus string      `json:"account_status"`
	Location      interface{} `json:"location"`
}

type Workspace

type Workspace struct {
	UUID  string `json:"uuid"`
	Links struct {
		Owners struct {
			Href string `json:"href"`
		} `json:"owners"`
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Repositories struct {
			Href string `json:"href"`
		} `json:"repositories"`
		Snippets struct {
			Href string `json:"href"`
		} `json:"snippets"`
		HTML struct {
			Href string `json:"href"`
		} `json:"html"`
		Avatar struct {
			Href string `json:"href"`
		} `json:"avatar"`
		Members struct {
			Href string `json:"href"`
		} `json:"members"`
		Projects struct {
			Href string `json:"href"`
		} `json:"projects"`
	} `json:"links"`
	CreatedOn time.Time `json:"created_on"`
	Type      string    `json:"type"`
	Slug      string    `json:"slug"`
	IsPrivate bool      `json:"is_private"`
	Name      string    `json:"name"`
}

Jump to

Keyboard shortcuts

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