scan

package
v0.47.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: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountID   string `json:"accountId"`
	AccountURI  string `json:"accountUri"`
	AccountName string `json:"accountName"`
}

type Artifact

type Artifact struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Source   string `json:"source"`
	Resource struct {
		Type       string `json:"type"`
		Data       string `json:"data"`
		Properties struct {
			Localpath    string `json:"localpath"`
			Artifactsize string `json:"artifactsize"`
		} `json:"properties"`
		URL         string `json:"url"`
		DownloadURL string `json:"downloadUrl"`
	} `json:"resource"`
}

type AuthenticatedUser

type AuthenticatedUser struct {
	DisplayName  string    `json:"displayName"`
	PublicAlias  string    `json:"publicAlias"`
	EmailAddress string    `json:"emailAddress"`
	CoreRevision int       `json:"coreRevision"`
	TimeStamp    time.Time `json:"timeStamp"`
	ID           string    `json:"id"`
	Revision     int       `json:"revision"`
}

type AzureDevOpsApiClient

type AzureDevOpsApiClient struct {
	Client   resty.Client
	BaseURL  string
	VsspsURL string // URL for profile/account APIs
}

https://learn.microsoft.com/en-us/rest/api/azure/devops/

func NewClient

func NewClient(username string, password string, baseURL string) AzureDevOpsApiClient

func (AzureDevOpsApiClient) DownloadArtifactZip

func (a AzureDevOpsApiClient) DownloadArtifactZip(url string) ([]byte, *resty.Response, error)

func (AzureDevOpsApiClient) ListBuildArtifacts

func (a AzureDevOpsApiClient) ListBuildArtifacts(continuationToken string, organization string, project string, buildId int) ([]Artifact, *resty.Response, string, error)

https://learn.microsoft.com/en-us/rest/api/azure/devops/build/artifacts/list?view=azure-devops-rest-7.1 this endpoint is NOT paged

func (AzureDevOpsApiClient) ListBuildLogs

func (a AzureDevOpsApiClient) ListBuildLogs(organization string, project string, buildId int) ([]BuildLog, *resty.Response, error)

https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/get-build-logs?view=azure-devops-rest-7.2 this endpoint is NOT paged

type Build

type Build struct {
	Links struct {
		Self struct {
			Href string `json:"href"`
		} `json:"self"`
		Web struct {
			Href string `json:"href"`
		} `json:"web"`
		SourceVersionDisplayURI struct {
			Href string `json:"href"`
		} `json:"sourceVersionDisplayUri"`
		Timeline struct {
			Href string `json:"href"`
		} `json:"timeline"`
		Badge struct {
			Href string `json:"href"`
		} `json:"badge"`
	} `json:"_links"`
	Properties struct {
	} `json:"properties"`
	Tags              []interface{} `json:"tags"`
	ValidationResults []interface{} `json:"validationResults"`
	Plans             []struct {
		PlanID string `json:"planId"`
	} `json:"plans"`
	TriggerInfo struct {
	} `json:"triggerInfo"`
	ID          int       `json:"id"`
	BuildNumber string    `json:"buildNumber"`
	Status      string    `json:"status"`
	Result      string    `json:"result"`
	QueueTime   time.Time `json:"queueTime"`
	StartTime   time.Time `json:"startTime"`
	FinishTime  time.Time `json:"finishTime"`
	URL         string    `json:"url"`
	Definition  struct {
		Drafts      []interface{} `json:"drafts"`
		ID          int           `json:"id"`
		Name        string        `json:"name"`
		URL         string        `json:"url"`
		URI         string        `json:"uri"`
		Path        string        `json:"path"`
		Type        string        `json:"type"`
		QueueStatus string        `json:"queueStatus"`
		Revision    int           `json:"revision"`
		Project     struct {
			ID             string    `json:"id"`
			Name           string    `json:"name"`
			URL            string    `json:"url"`
			State          string    `json:"state"`
			Revision       int       `json:"revision"`
			Visibility     string    `json:"visibility"`
			LastUpdateTime time.Time `json:"lastUpdateTime"`
		} `json:"project"`
	} `json:"definition"`
	BuildNumberRevision int `json:"buildNumberRevision"`
	Project             struct {
		ID             string    `json:"id"`
		Name           string    `json:"name"`
		URL            string    `json:"url"`
		State          string    `json:"state"`
		Revision       int       `json:"revision"`
		Visibility     string    `json:"visibility"`
		LastUpdateTime time.Time `json:"lastUpdateTime"`
	} `json:"project"`
	URI           string `json:"uri"`
	SourceBranch  string `json:"sourceBranch"`
	SourceVersion string `json:"sourceVersion"`
	Queue         struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
		Pool struct {
			ID       int    `json:"id"`
			Name     string `json:"name"`
			IsHosted bool   `json:"isHosted"`
		} `json:"pool"`
	} `json:"queue"`
	Priority     string `json:"priority"`
	Reason       string `json:"reason"`
	RequestedFor struct {
		DisplayName string `json:"displayName"`
		URL         string `json:"url"`
		Links       struct {
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
		} `json:"_links"`
		ID         string `json:"id"`
		UniqueName string `json:"uniqueName"`
		ImageURL   string `json:"imageUrl"`
		Descriptor string `json:"descriptor"`
	} `json:"requestedFor"`
	RequestedBy struct {
		DisplayName string `json:"displayName"`
		URL         string `json:"url"`
		Links       struct {
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
		} `json:"_links"`
		ID         string `json:"id"`
		UniqueName string `json:"uniqueName"`
		ImageURL   string `json:"imageUrl"`
		Descriptor string `json:"descriptor"`
	} `json:"requestedBy"`
	LastChangedDate time.Time `json:"lastChangedDate"`
	LastChangedBy   struct {
		DisplayName string `json:"displayName"`
		URL         string `json:"url"`
		Links       struct {
			Avatar struct {
				Href string `json:"href"`
			} `json:"avatar"`
		} `json:"_links"`
		ID         string `json:"id"`
		UniqueName string `json:"uniqueName"`
		ImageURL   string `json:"imageUrl"`
		Descriptor string `json:"descriptor"`
	} `json:"lastChangedBy"`
	OrchestrationPlan struct {
		PlanID string `json:"planId"`
	} `json:"orchestrationPlan"`
	Logs struct {
		ID   int    `json:"id"`
		Type string `json:"type"`
		URL  string `json:"url"`
	} `json:"logs"`
	Repository struct {
		ID                 string      `json:"id"`
		Type               string      `json:"type"`
		Name               string      `json:"name"`
		URL                string      `json:"url"`
		Clean              interface{} `json:"clean"`
		CheckoutSubmodules bool        `json:"checkoutSubmodules"`
	} `json:"repository"`
	RetainedByRelease            bool        `json:"retainedByRelease"`
	TriggeredByBuild             interface{} `json:"triggeredByBuild"`
	AppendCommitMessageToRunName bool        `json:"appendCommitMessageToRunName"`
}

type BuildLog

type BuildLog struct {
	LineCount     int       `json:"lineCount"`
	CreatedOn     time.Time `json:"createdOn"`
	LastChangedOn time.Time `json:"lastChangedOn"`
	ID            int       `json:"id"`
	Type          string    `json:"type"`
	URL           string    `json:"url"`
}

type PaginatedResponse

type PaginatedResponse[T any] struct {
	Count int `json:"count"`
	Value []T `json:"value"`
}

type Project

type Project struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	URL            string    `json:"url"`
	State          string    `json:"state"`
	Revision       int       `json:"revision"`
	Visibility     string    `json:"visibility"`
	LastUpdateTime time.Time `json:"lastUpdateTime"`
}

type ScanOptions

type ScanOptions struct {
	Username               string
	AccessToken            string
	ConfidenceFilter       []string
	MaxScanGoRoutines      int
	TruffleHogVerification bool
	MaxBuilds              int
	Organization           string
	Project                string
	Artifacts              bool
	DevOpsURL              string
	MaxArtifactSize        int64
	HitTimeout             time.Duration
	Context                context.Context
	Client                 AzureDevOpsApiClient
}

ScanOptions contains configuration options for Azure DevOps scanning operations.

func InitializeOptions

func InitializeOptions(username, accessToken, devOpsURL, organization, project, maxArtifactSizeStr string,
	artifacts, truffleHogVerification bool,
	maxBuilds, 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

Jump to

Keyboard shortcuts

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