CxSASTClientGo

package module
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2025 License: GPL-3.0 Imports: 20 Imported by: 2

README

Simple GoLang client for Checkmarx CxSAST platform - built against Cx9.5 but should also work with 9.x.

This client is not feature-complete and should not be used in production, but can serve as an example or basis from which to build custom GoLang applications.

Documentation

Index

Constants

View Source
const (
	CORP_QUERY    = "Corporate"
	PRODUCT_QUERY = "Cx"
	TEAM_QUERY    = "Team"
	PROJECT_QUERY = "Project"
)
View Source
const (
	PreScanAction  = "SOURCE_CONTROL_COMMAND"
	PostScanAction = "POST_SCAN_COMMAND"
)
View Source
const STATUS_EMPTY = 8 // No queries to process

const STATUS_BROKEN_CHAIN = 1 // Detected broken chains (base.<x> not called), fixed const STATUS_ASSIGNMENT = 2 // Detected base assignments not to result (xvar = base.<x>), fixed

View Source
const STATUS_INVALID = 9 // Invalid content for processing
View Source
const STATUS_OK = 0 // All good
View Source
const STATUS_REMERGE = 1 // Detected query code merged before, this is dangerous and must be reported or logged

Variables

This section is empty.

Functions

func OauthCodeCallbackURL

func OauthCodeCallbackURL(base_url, client_id, redirect_uri, scope, state string) string

func OauthCodeHTTPClient

func OauthCodeHTTPClient(client *http.Client, base_url, client_id, oauth_code, oauth_scope, oauth_redirect_uri string) (*http.Client, error)

func OauthCredentialClient

func OauthCredentialClient(client *http.Client, base_url, client_id, client_secret, username, password string, scopes []string) *http.Client

func SeverityToString added in v0.0.25

func SeverityToString(sev int64) string

func ShortenGUID

func ShortenGUID(guid string) string

func StateToString added in v0.0.25

func StateToString(state int64) string

Types

type ApplicationVersion added in v0.0.11

type ApplicationVersion struct {
	ApplicationVersion string
	EnginePack         string
	HotFix             int
}

type AuthenticationProvider

type AuthenticationProvider struct {
	ID           uint64
	Name         string
	ProviderID   uint64
	ProviderType string
	IsExternal   bool
	Active       bool
}

func (*AuthenticationProvider) String added in v0.0.11

func (c *AuthenticationProvider) String() string

type CustomTask added in v0.0.11

type CustomTask struct {
	ID   uint64
	Name string
	Type string
	Data string
}

type CxQuery added in v0.0.24

type CxQuery struct {
	SourceCode     string
	QueryId        uint64
	QueryName      string
	Language       string
	PackageId      uint64
	PackageName    string
	Severity       int
	Level          string
	TeamOrProjId   uint64
	TeamOrProjName string
	// contains filtered or unexported fields
}

type EngineConfiguration added in v0.0.11

type EngineConfiguration struct {
	ID   uint64
	Name string
}

type IssueTracker added in v0.0.11

type IssueTracker struct {
	ID   uint64
	Name string
	Type string
	URL  string
}
type Link struct {
	Rel string `json:"rel"`
	URI string `json:"uri"`
}
type Links struct {
	Report Link `json:"report"`
	Status Link `json:"status"`
}

type OIDCClaim

type OIDCClaim struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type OIDCClient

type OIDCClient struct {
	ID                                uint64      `json:"id"`
	UpdateAccessTokenClaimsOnRefresh  bool        `json:"updateAccessTokenClaimsOnRefresh"`
	AccessTokenType                   uint64      `json:"accessTokenType"`
	IncludeJwtID                      bool        `json:"includeJwtId"`
	AlwaysIncludeUserClaimsInIDToken  bool        `json:"alwaysIncludeUserClaimsInIdToken"`
	ClientID                          string      `json:"clientId"`
	ClientName                        string      `json:"clientName"`
	AllowOfflineAccess                bool        `json:"allowOfflineAccess"`
	ClientSecrets                     []string    `json:"clientSecrets"`
	AllowedGrantTypes                 []string    `json:"allowedGrantTypes"`
	AllowedScopes                     []string    `json:"allowedScopes"`
	Enabled                           bool        `json:"enabled"`
	RequireClientSecret               bool        `json:"requireClientSecret"`
	RedirectUris                      []string    `json:"redirectUris"`
	PostLogoutRedirectUris            []string    `json:"postLogoutRedirectUris"`
	FrontChannelLogoutUri             *string     `json:"frontChannelLogoutUri"`
	FrontChannelLogoutSessionRequired bool        `json:"frontChannelLogoutSessionRequired"`
	BackChannelLogoutUri              *string     `json:"backChannelLogoutUri"`
	BackChannelLogoutSessionRequired  bool        `json:"backChannelLogoutSessionRequired"`
	IdentityTokenLifetime             uint64      `json:"identityTokenLifetime"`
	AccessTokenLifetime               uint64      `json:"accessTokenLifetime"`
	AuthorizationCodeLifetime         uint64      `json:"authorizationCodeLifetime"`
	AbsoluteRefreshTokenLifetime      uint64      `json:"absoluteRefreshTokenLifetime"`
	SlidingRefreshTokenLifetime       uint64      `json:"slidingRefreshTokenLifetime"`
	RefreshTokenUsage                 uint64      `json:"refreshTokenUsage"`
	RefreshTokenExpiration            uint64      `json:"refreshTokenExpiration"`
	AllowedCorsOrigins                []string    `json:"allowedCorsOrigins"`
	AllowAccessTokensViaBrowser       bool        `json:"allowAccessTokensViaBrowser"`
	Claims                            []OIDCClaim `json:"claims"`
	ClientClaimsPrefix                string      `json:"clientClaimsPrefix"`
	RequirePkce                       bool        `json:"requirePkce"`
}

type PasswordConfig

type PasswordConfig struct {
	Config      oauth2.Config
	Username    string
	Password    string
	ReuseSource *PasswordTokenSource
}

func (*PasswordConfig) Client

func (c *PasswordConfig) Client(ctx context.Context) *http.Client

func (*PasswordConfig) Token

func (c *PasswordConfig) Token(ctx context.Context) (*oauth2.Token, error)

func (*PasswordConfig) TokenSource

func (c *PasswordConfig) TokenSource(ctx context.Context) oauth2.TokenSource

type PasswordTokenSource

type PasswordTokenSource struct {
	LastToken *oauth2.Token
	// contains filtered or unexported fields
}

func (*PasswordTokenSource) Token

func (c *PasswordTokenSource) Token() (*oauth2.Token, error)

type PathNode

type PathNode struct {
	FileName   string
	Line       uint64
	Column     uint64
	Name       string
	Length     uint64
	MethodLine uint64
	NodeId     uint64
}

type PathResultInfo added in v0.0.25

type PathResultInfo struct {
	Source1           []string
	AbsoluteFileName1 string
	Line1             uint64
	Column1           uint64
	MethodLine1       uint64
	Source2           []string
	AbsoluteFileName2 string
	Line2             uint64
	Column2           uint64
	MethodLine2       uint64
	QueryID           uint64
	State             string
	Severity          string
	PathID            uint64
	SimilarityID      int64
	Comment           string
}

type Preset

type Preset struct {
	PresetID uint64 `json:"id"`
	Name     string
	QueryIDs []uint64
	Filled   bool    `json:"-"`
	Queries  []Query `json:"-"`
}

func (*Preset) LinkQueries added in v0.0.14

func (p *Preset) LinkQueries(queries *QueryCollection)

func (*Preset) String

func (p *Preset) String() string

Presets

type Project

type Project struct {
	ProjectID    uint64 `json:"id"`
	TeamID       uint64
	Name         string
	IsPublic     bool
	SourceType   string
	Settings     *ProjectSettings
	Repo         *ProjectRepo
	Filters      *SourceFilters
	CustomFields []ProjectCustomField
}

func ConvertProjects

func ConvertProjects(pps *[]ProjectComplex) []Project

func (*Project) SetCustomField added in v0.0.21

func (p *Project) SetCustomField(id uint, name, value string)

func (*Project) String

func (p *Project) String() string

type ProjectComplex

type ProjectComplex struct {
	ProjectID          uint64 `json:"id"`
	TeamID             uint64
	Name               string
	IsPublic           bool
	SourceSettingsLink struct {
		Type string
		Rel  string
		Uri  string
	}
	CustomFields []ProjectCustomField
	Links        []map[string]string
}

this type is used temporarily to convert into the 'simpler' format defined in types.go

func (ProjectComplex) ToProject

func (pp ProjectComplex) ToProject() Project

type ProjectCustomField

type ProjectCustomField struct {
	ID        uint   `json:"id"`
	Value     string `json:"value"`
	Name      string `json:"name"`
	Mandatory bool   `json:"isMandatory"`
}

type ProjectRepo

type ProjectRepo struct {
	URL    string
	Branch string
	UseSSH bool
}

func (*ProjectRepo) String

func (pr *ProjectRepo) String() string

type ProjectSettings

type ProjectSettings struct {
	ProjectID uint64
	PresetID  uint64
	//PresetName            string
	EngineConfigurationID uint64
	PostScanAction        int64
	EmailNotifications    struct {
		FailedScan []string
		BeforeScan []string
		AfterScan  []string
	}
}

type Query

type Query struct {
	Name               string
	QueryID            uint64 `xml:"QueryId"`
	BaseQueryID        uint64
	CWE                uint64 `xml:"Cwe"`
	Severity           int
	PackageID          uint64 `xml:"PackageId"`
	Language           string
	Group              string
	IsExecutable       bool        `xml:"IsExecutable"`
	Source             string      `xml:"Source"`
	DescriptionID      uint64      `xml:"CxDescriptionID"`
	Version            uint64      `xml:"QueryVersionCode"`
	OwningGroup        *QueryGroup `json:"-"`
	Dependencies       []uint64    `json:"-"`         // dependencies on queries outside of the inheritance hierarchy
	CustomDependencies []uint64    `json:"-"`         // dependencies on custom queries outside of the inheritance hierarchy
	UnknownCalls       []string    `json:"-"`         // calls ot functions that are not other CxQL queries (may be API)
	Hierarchy          []uint64    `json:"Hierarchy"` // inheritance hierarchy
	IsValid            bool        `json:"-"`
}

func (*Query) IsCustom

func (q *Query) IsCustom() bool

func (*Query) MergeDependencies added in v0.0.24

func (q *Query) MergeDependencies(other *Query)

func (*Query) String

func (q *Query) String() string

func (*Query) StringDetailed added in v0.0.22

func (q *Query) StringDetailed() string

type QueryCollection

type QueryCollection struct {
	QueryLanguages []QueryLanguage
	QueryCount     uint
}

func (*QueryCollection) AddQuery

func (qc *QueryCollection) AddQuery(l *QueryLanguage, g *QueryGroup, q *Query)

func (*QueryCollection) DetectDependencies added in v0.0.22

func (qc *QueryCollection) DetectDependencies(teamsByID *map[uint64]*Team, projectsByID *map[uint64]*Project)

func (*QueryCollection) FindCorpBaseQuery added in v0.0.22

func (qc *QueryCollection) FindCorpBaseQuery(language, query string) *Query

func (*QueryCollection) FindProductQuery added in v0.0.22

func (qc *QueryCollection) FindProductQuery(language, query string) *Query

func (*QueryCollection) FindProjectBaseQueryInTree added in v0.0.22

func (qc *QueryCollection) FindProjectBaseQueryInTree(language, query string, projectId uint64, teamsByID *map[uint64]*Team, projectsByID *map[uint64]*Project) (*Query, error)

func (*QueryCollection) FindTeamBaseQueryInTree added in v0.0.22

func (qc *QueryCollection) FindTeamBaseQueryInTree(language, query string, teamId uint64, teamsByID *map[uint64]*Team) (*Query, error)

func (*QueryCollection) FromXML added in v0.0.13

func (qc *QueryCollection) FromXML(response []byte) error

func (*QueryCollection) GenerateHierarchy added in v0.0.23

func (qc *QueryCollection) GenerateHierarchy(query *Query)

func (*QueryCollection) GetCorpQueries added in v0.0.25

func (qc *QueryCollection) GetCorpQueries() []*Query

func (*QueryCollection) GetCustomQueryCollection

func (qc *QueryCollection) GetCustomQueryCollection() QueryCollection

func (*QueryCollection) GetProjectQueries added in v0.0.23

func (qc *QueryCollection) GetProjectQueries(project *Project) []*Query

func (*QueryCollection) GetQuery

func (qc *QueryCollection) GetQuery(language, group, query string) *Query

func (*QueryCollection) GetQueryByID

func (qc *QueryCollection) GetQueryByID(qid uint64) *Query

func (*QueryCollection) GetQueryCount added in v0.0.16

func (qc *QueryCollection) GetQueryCount() uint

func (*QueryCollection) GetQueryDependencies added in v0.0.22

func (qc *QueryCollection) GetQueryDependencies(q *Query) []string

This function returns some information about a query which may explain failure to migrate to CheckmarxOne - query depends on other queries that may not exist (may need to be migrated first) - query belongs to a non-existent project or team (has nowhere to migrate to) - returns an empty array for product-default queries

func (*QueryCollection) GetQueryLanguage

func (qc *QueryCollection) GetQueryLanguage(language string) *QueryLanguage

func (*QueryCollection) GetRootQueryID added in v0.0.23

func (qc *QueryCollection) GetRootQueryID(queryId uint64) uint64

func (*QueryCollection) GetTeamQueries added in v0.0.23

func (qc *QueryCollection) GetTeamQueries(teamId uint64) []*Query

func (*QueryCollection) LinkBaseQueries added in v0.0.13

func (qc *QueryCollection) LinkBaseQueries(teamsByID *map[uint64]*Team, projectsByID *map[uint64]*Project)

func (*QueryCollection) LinkGroups added in v0.0.22

func (qc *QueryCollection) LinkGroups()

func (QueryCollection) MakeMergedTeamQuery added in v0.0.24

func (qc QueryCollection) MakeMergedTeamQuery(source *Query, destName string, teamsById *map[uint64]Team) (*Query, error)

Merges all team-level queries in the source query's inheritance chain

func (*QueryCollection) QueryHierarchy added in v0.0.23

func (qc *QueryCollection) QueryHierarchy(queryId uint64) []uint64

convenience function for debugging (get this query's inheritance chain as ints)

func (*QueryCollection) QueryHierarchyString added in v0.0.24

func (qc *QueryCollection) QueryHierarchyString(queryId uint64) []string

convenience function for debugging (get this query's inheritance chain as strings)

func (*QueryCollection) String added in v0.0.13

func (qc *QueryCollection) String() string

type QueryGroup

type QueryGroup struct {
	Name            string
	PackageID       uint64
	Queries         []Query
	Language        string `xml:"languageName"`
	OwningProjectID uint64 `xml:"ProjectId"`
	PackageType     string `xml:"PackageTypeName"`
	OwningTeamID    uint64 `xml:"OwningTeam"`
}

func (*QueryGroup) GetQuery

func (qg *QueryGroup) GetQuery(name string) *Query

func (*QueryGroup) IsCustom

func (q *QueryGroup) IsCustom() bool

func (*QueryGroup) String

func (q *QueryGroup) String() string

type QueryLanguage

type QueryLanguage struct {
	Name        string
	LanguageID  uint64
	QueryGroups []QueryGroup
}

func (*QueryLanguage) GetQueryGroup

func (ql *QueryLanguage) GetQueryGroup(group string) *QueryGroup

func (*QueryLanguage) GetQueryGroupByID added in v0.0.13

func (ql *QueryLanguage) GetQueryGroupByID(packageId uint64) *QueryGroup

func (*QueryLanguage) String

func (q *QueryLanguage) String() string

type QueryMerger added in v0.0.24

type QueryMerger []CxQuery

func Merger added in v0.0.24

func Merger() *QueryMerger

Gets a list of queries

func (*QueryMerger) Add added in v0.0.24

func (q *QueryMerger) Add(query *Query, owner string)

Append a new query code to the end of the queries list to be processed

func (*QueryMerger) CheckStatus added in v0.0.24

func (q *QueryMerger) CheckStatus() (status int, message string)

Helper funtion to check the contents

func (*QueryMerger) Clear added in v0.0.24

func (q *QueryMerger) Clear()

Clears the queries list (slice), to be ready for the next processing

func (*QueryMerger) Count added in v0.0.24

func (q *QueryMerger) Count() int

Count the number of queries in queries list

func (*QueryMerger) Delete added in v0.0.24

func (q *QueryMerger) Delete()

Removes the last query on the list

func (*QueryMerger) Insert added in v0.0.24

func (q *QueryMerger) Insert(query *Query, owner string)

Insert a new query code at the top of the queries list to be processed

func (*QueryMerger) Merge added in v0.0.24

func (q *QueryMerger) Merge(destqueryname string) (qquerycode string, err error)

Merge the list of queries int a singe code Parameter:

  • destqueryname to detect and process query renames use an empty string if this check is not needed Example: JS: Potentially_Vulnerable_To_Xsrf in v9.3 Found as Potentially_Vulnerable_To_CSRF in v9.5.5 and CXONE

Returns: - qquerycode the merged query code - qstatus the status of the merged query

func (*QueryMerger) Query added in v0.0.24

func (q *QueryMerger) Query(index int) (xquery CxQuery, err error)

Retrieves a query object from list given its index

func (*QueryMerger) Severity added in v0.0.24

func (q *QueryMerger) Severity(highest bool) int

Gets the last ververity or the highest severity from the queries list

func (*QueryMerger) UncommentedCode added in v0.0.24

func (q *QueryMerger) UncommentedCode() (quncommentedcode string)

Helper funtion to get CxQL code without comments Returns: - quncommentedcode the uncommented and merged query code It does not check for errors, just deliver the uncommented code

type Report

type Report struct {
	ReportID uint64 `json:"reportId"`
	Links    Links  `json:"links"`
}

type ReportStatus

type ReportStatus struct {
	ID    int    `json:"id"`
	Value string `json:"value"`
}

ReportStatus - ReportStatus Structure

type ReportStatusResponse

type ReportStatusResponse struct {
	Location    string       `json:"location"`
	ContentType string       `json:"contentType"`
	Status      ReportStatus `json:"status"`
}

ReportStatusResponse - ReportStatusResponse Structure

type ResultState added in v0.0.11

type ResultState struct {
	Name       string `xml:"ResultName"`
	ID         uint   `xml:"ResultID"`
	Permission string `xml:"ResultPermission"`
	IsCustom   bool
}

type Role

type Role struct {
	RoleID        uint64 `json:"id"`
	IsSystemRole  bool
	Name          string
	Description   string
	PermissionIDs []uint64
}

func (*Role) String

func (r *Role) String() string

Roles

type SASTCache

type SASTCache struct {
	Projects     []Project
	ProjectsByID map[uint64]*Project `json:"-"`
	Teams        []Team
	TeamsByID    map[uint64]*Team `json:"-"`
	Users        []User
	UsersByID    map[uint64]*User `json:"-"`
	Queries      QueryCollection
	Presets      []Preset
	Roles        []Role
}

func (*SASTCache) GenerateProjectIDMap added in v0.0.14

func (c *SASTCache) GenerateProjectIDMap()

func (*SASTCache) GenerateTeamIDMap added in v0.0.14

func (c *SASTCache) GenerateTeamIDMap()

func (*SASTCache) GenerateUserIDMap added in v0.0.14

func (c *SASTCache) GenerateUserIDMap()

func (*SASTCache) GetPreset

func (c *SASTCache) GetPreset(presetID uint64) (*Preset, error)

func (*SASTCache) GetPresetByName

func (c *SASTCache) GetPresetByName(name string) (*Preset, error)

func (*SASTCache) GetProject

func (c *SASTCache) GetProject(projectID uint64) (*Project, error)

func (*SASTCache) GetProjectByName

func (c *SASTCache) GetProjectByName(name string) (*Project, error)

func (*SASTCache) GetProjectsByTeamID

func (c *SASTCache) GetProjectsByTeamID(teamID uint64) []*Project

func (*SASTCache) GetQuery

func (c *SASTCache) GetQuery(queryID uint64) (*Query, error)

func (*SASTCache) GetQueryByNames

func (c *SASTCache) GetQueryByNames(language, group, query string) (*Query, error)

func (*SASTCache) GetRole

func (c *SASTCache) GetRole(roleID uint64) (*Role, error)

func (*SASTCache) GetRoleByName

func (c *SASTCache) GetRoleByName(name string) (*Role, error)

func (*SASTCache) GetTeam

func (c *SASTCache) GetTeam(teamID uint64) (*Team, error)

func (*SASTCache) GetTeamByName

func (c *SASTCache) GetTeamByName(name string) (*Team, error)

func (*SASTCache) GetTeamsByParentID

func (c *SASTCache) GetTeamsByParentID(parentID uint64) []*Team

func (*SASTCache) GetUser

func (c *SASTCache) GetUser(userID uint64) (*User, error)

func (*SASTCache) GetUserByEmail

func (c *SASTCache) GetUserByEmail(email string) (*User, error)

func (*SASTCache) GetUsersInTeam

func (c *SASTCache) GetUsersInTeam(teamID uint64) []*User

func (*SASTCache) GetUsersInTeams

func (c *SASTCache) GetUsersInTeams(teams []Team) []*User

func (*SASTCache) MatchPresetQueries added in v0.0.15

func (c *SASTCache) MatchPresetQueries()

func (*SASTCache) MatchTeamProjects added in v0.0.14

func (c *SASTCache) MatchTeamProjects()

func (*SASTCache) MatchTeamUsers added in v0.0.14

func (c *SASTCache) MatchTeamUsers()

func (*SASTCache) PresetSummary

func (c *SASTCache) PresetSummary() string

func (*SASTCache) ProjectSummary

func (c *SASTCache) ProjectSummary() string

func (*SASTCache) QuerySummary

func (c *SASTCache) QuerySummary() string

func (*SASTCache) Refresh

func (c *SASTCache) Refresh(client *SASTClient) []error

func (*SASTCache) RefreshPresets

func (c *SASTCache) RefreshPresets(client *SASTClient) error

func (*SASTCache) RefreshProjects

func (c *SASTCache) RefreshProjects(client *SASTClient) error

func (*SASTCache) RefreshQueries

func (c *SASTCache) RefreshQueries(client *SASTClient) error

func (*SASTCache) RefreshRoles

func (c *SASTCache) RefreshRoles(client *SASTClient) error

func (*SASTCache) RefreshTeams

func (c *SASTCache) RefreshTeams(client *SASTClient) error

func (*SASTCache) RefreshUsers

func (c *SASTCache) RefreshUsers(client *SASTClient) error

func (*SASTCache) String

func (c *SASTCache) String() string

func (*SASTCache) TeamSummary

func (c *SASTCache) TeamSummary() string

func (*SASTCache) TeamTree

func (c *SASTCache) TeamTree() string

func (*SASTCache) UserSummary

func (c *SASTCache) UserSummary() string

type SASTClient

type SASTClient struct {
	CurrentUser *User
	// contains filtered or unexported fields
}

func New

func New(client *http.Client, soap_client *http.Client, base_url string, logger *logrus.Logger) (*SASTClient, error)

If you want to provide your own authenticated HTTP Client (prepared through OAuth2 library) you can use this instead. this is useful if you are using SAST authentication on a third-party website with authorization_code style oauth oauth authorization_code helper function are implemented in sastpassclient.go

func NewTokenClient

func NewTokenClient(client *http.Client, base_url string, username string, password string, logger *logrus.Logger) (*SASTClient, error)

NewTokenClient will authenticate with SAST using the standard OIDC clients included in the platform

func (SASTClient) ClientsValid

func (c SASTClient) ClientsValid() (bool, bool)

func (SASTClient) CompareVersions added in v0.0.19

func (c SASTClient) CompareVersions(version, target string) int

func (SASTClient) CreateOIDCClient

func (c SASTClient) CreateOIDCClient(client *OIDCClient) error

func (SASTClient) CreateTeam

func (c SASTClient) CreateTeam(name string, parentId uint64) (uint64, error)

func (SASTClient) DeleteOIDCClient

func (c SASTClient) DeleteOIDCClient(client *OIDCClient) error

func (SASTClient) DeleteTeamByID

func (c SASTClient) DeleteTeamByID(teamId uint64) error

func (SASTClient) DownloadReportByID

func (c SASTClient) DownloadReportByID(reportID uint64) ([]byte, error)

func (SASTClient) GenerateAndDownloadReportByID

func (c SASTClient) GenerateAndDownloadReportByID(scanID uint64, reportType string) ([]byte, error)

convenience function

func (SASTClient) GetAllPathResultInfos added in v0.0.25

func (c SASTClient) GetAllPathResultInfos(scanId uint64) ([]PathResultInfo, error)

func (SASTClient) GetAuthenticationProviders

func (c SASTClient) GetAuthenticationProviders() ([]AuthenticationProvider, error)

func (SASTClient) GetCurrentRESTToken added in v0.0.28

func (c SASTClient) GetCurrentRESTToken() string

func (SASTClient) GetCurrentSOAPToken added in v0.0.28

func (c SASTClient) GetCurrentSOAPToken() string

func (SASTClient) GetCurrentUser

func (c SASTClient) GetCurrentUser() (User, error)

func (SASTClient) GetCustomFields added in v0.0.21

func (c SASTClient) GetCustomFields() ([]ProjectCustomField, error)

func (SASTClient) GetCustomTasks added in v0.0.11

func (c SASTClient) GetCustomTasks() ([]CustomTask, error)

func (SASTClient) GetEngineConfigurations added in v0.0.11

func (c SASTClient) GetEngineConfigurations() ([]EngineConfiguration, error)

func (SASTClient) GetEngineConfigurationsSOAP added in v0.0.11

func (c SASTClient) GetEngineConfigurationsSOAP() ([]EngineConfiguration, error)

func (SASTClient) GetIssueTrackers added in v0.0.11

func (c SASTClient) GetIssueTrackers() ([]IssueTracker, error)

func (SASTClient) GetLastScanByID

func (c SASTClient) GetLastScanByID(projectid uint64) (Scan, error)

func (SASTClient) GetOIDCClientByID

func (c SASTClient) GetOIDCClientByID(clientId string) (OIDCClient, error)

convenience

func (SASTClient) GetOIDCClients

func (c SASTClient) GetOIDCClients() ([]OIDCClient, error)

func (SASTClient) GetPresetByID

func (c SASTClient) GetPresetByID(presetID uint64) (Preset, error)

func (SASTClient) GetPresetByName

func (c SASTClient) GetPresetByName(name string) (Preset, error)

func (SASTClient) GetPresetContents

func (c SASTClient) GetPresetContents(p *Preset, queries *QueryCollection) error

func (SASTClient) GetPresets

func (c SASTClient) GetPresets() ([]Preset, error)

func (SASTClient) GetProjectByID

func (c SASTClient) GetProjectByID(id uint64) (Project, error)

func (SASTClient) GetProjectByIDV

func (c SASTClient) GetProjectByIDV(id uint64, version string) (Project, error)

func (SASTClient) GetProjectCustomFields

func (c SASTClient) GetProjectCustomFields(project *Project) error

func (SASTClient) GetProjectLastFullScanIDODATA added in v0.0.25

func (c SASTClient) GetProjectLastFullScanIDODATA(project *Project) (uint64, error)

func (SASTClient) GetProjectRepository

func (c SASTClient) GetProjectRepository(project *Project) error

func (SASTClient) GetProjectSettings

func (c SASTClient) GetProjectSettings(project *Project) error

func (SASTClient) GetProjectSettingsByID

func (c SASTClient) GetProjectSettingsByID(projectid uint64) (ProjectSettings, error)

func (SASTClient) GetProjectSourceFilters added in v0.0.12

func (c SASTClient) GetProjectSourceFilters(project *Project) error

func (SASTClient) GetProjects

func (c SASTClient) GetProjects() ([]Project, error)

func (SASTClient) GetProjectsByName added in v0.0.18

func (c SASTClient) GetProjectsByName(name string) ([]Project, error)

func (SASTClient) GetProjectsInTeamByID

func (c SASTClient) GetProjectsInTeamByID(teamid uint64) ([]Project, error)

func (SASTClient) GetQueriesSOAP

func (c SASTClient) GetQueriesSOAP() (QueryCollection, error)

func (SASTClient) GetQueriesSOAPRaw added in v0.0.13

func (c SASTClient) GetQueriesSOAPRaw() ([]byte, error)

func (SASTClient) GetQueryByID

func (c SASTClient) GetQueryByID(qid uint64, queries *[]Query) *Query

func (SASTClient) GetReportStatusByID

func (c SASTClient) GetReportStatusByID(reportID uint64) (ReportStatusResponse, error)

func (SASTClient) GetResultPathsForQuerySOAP added in v0.0.25

func (c SASTClient) GetResultPathsForQuerySOAP(scanID, queryID uint64) ([]ScanResult, error)

func (SASTClient) GetResultStateListSOAP added in v0.0.11

func (c SASTClient) GetResultStateListSOAP() ([]ResultState, error)

func (SASTClient) GetResultsForScanSOAP added in v0.0.25

func (c SASTClient) GetResultsForScanSOAP(scanId uint64) ([]ScanResult, error)

func (SASTClient) GetResultsFromXML

func (c SASTClient) GetResultsFromXML(xmlReportData []byte) ([]ScanResult, error)

func (SASTClient) GetRoles

func (c SASTClient) GetRoles() ([]Role, error)

func (SASTClient) GetScanByID

func (c SASTClient) GetScanByID(scanid uint64) (Scan, error)

func (SASTClient) GetScanCustomStateUsedODATA added in v0.0.34

func (c SASTClient) GetScanCustomStateUsedODATA(scanId uint64, stateId uint) (bool, error)

func (SASTClient) GetScanPresetSOAP

func (c SASTClient) GetScanPresetSOAP(scanid uint64) (Preset, error)

func (SASTClient) GetScanResultPathNodes added in v0.0.25

func (c SASTClient) GetScanResultPathNodes(scanId, pathId uint64) ([]PathNode, error)

func (SASTClient) GetScanResultSummary

func (c SASTClient) GetScanResultSummary(results []ScanResult) ScanResultSummary

func (SASTClient) GetScanSchedules added in v0.0.33

func (c SASTClient) GetScanSchedules() ([]ScanSchedule, error)

func (SASTClient) GetScanSettingsByIDSOAP added in v0.0.25

func (c SASTClient) GetScanSettingsByIDSOAP(scanId uint64) (ScanSettingsSOAP, error)

func (SASTClient) GetScanSourceCodeByIDSOAP added in v0.0.25

func (c SASTClient) GetScanSourceCodeByIDSOAP(scanId uint64) ([]byte, error)

func (SASTClient) GetSourcesByScanIDSOAP added in v0.0.25

func (c SASTClient) GetSourcesByScanIDSOAP(scanId uint64, files []string) ([]SourceFile, error)

func (SASTClient) GetTeamByID

func (c SASTClient) GetTeamByID(teamId uint64) (Team, error)

func (SASTClient) GetTeamHierarchy added in v0.0.25

func (c SASTClient) GetTeamHierarchy(teamId uint64, teamMap *map[uint64]*Team) []*Team

func (SASTClient) GetTeams

func (c SASTClient) GetTeams() ([]Team, error)

func (SASTClient) GetUsers

func (c SASTClient) GetUsers() ([]User, error)

func (SASTClient) GetVersionSOAP added in v0.0.11

func (c SASTClient) GetVersionSOAP() (ApplicationVersion, error)
func (c SASTClient) PresetLink(p *Preset) string
func (c SASTClient) ProjectLink(p *Project) string

Links to objects in the portal

func (c SASTClient) QueryGroupLink(q *QueryGroup) string
func (c SASTClient) QueryLanguageLink(q *QueryLanguage) string
func (c SASTClient) QueryLink(q *Query) string

func (SASTClient) RequestNewReportByID

func (c SASTClient) RequestNewReportByID(scanID uint64, reportType string) (Report, error)
func (c SASTClient) RoleLink(r *Role) string

func (SASTClient) SaveOIDCClient

func (c SASTClient) SaveOIDCClient(client *OIDCClient) error

func (SASTClient) ScanProjectByID

func (c SASTClient) ScanProjectByID(projectID uint64, isIncremental, isPublic, forceScan bool, comment string) (uint64, error)

func (SASTClient) ScanProjectWithSettingsByID

func (c SASTClient) ScanProjectWithSettingsByID(settings *ScanSettings) (uint64, error)

func (SASTClient) String

func (c SASTClient) String() string
func (c SASTClient) TeamLink(t *Team) string

func (SASTClient) UpdateProjectCustomFields added in v0.0.21

func (c SASTClient) UpdateProjectCustomFields(project *Project) error

func (SASTClient) UploadBytesForProjectByID

func (c SASTClient) UploadBytesForProjectByID(projectID uint64, fileContents *[]byte) error

func (SASTClient) UploadFileForProjectByID

func (c SASTClient) UploadFileForProjectByID(projectID uint64, filename string) error
func (c SASTClient) UserLink(u *User) string

type SASTTime added in v0.0.20

type SASTTime struct {
	time.Time
}

func (SASTTime) MarshalJSON added in v0.0.27

func (ct SASTTime) MarshalJSON() (output []byte, err error)

func (*SASTTime) UnmarshalJSON added in v0.0.20

func (ct *SASTTime) UnmarshalJSON(b []byte) (err error)

type Scan

type Scan struct {
	ScanID  uint64 `json:"id"`
	Project struct {
		ID   uint64
		Name string
	}
	Status struct {
		ID   uint64
		Name string
	}
	ScanState struct {
		Path       string `json:"path"`
		FilesCount uint64 `json:"filesCount"`
		LOC        uint64 `json:"linesOfCode"`
		FailedLOC  uint64 `json:"failedLinesOfCode"`
		SourceID   string `json:"sourceId"`
		CxVersion  string `json:"cxVersion"`
		Languages  []struct {
			ID           uint64   `json:"languageID"`
			Name         string   `json:"languageName"`
			Hash         string   `json:"languageHash"`
			CreationDate SASTTime `json:"stateCreationDate"`
		} `json:"languageStateCollection"`
	}
	DateAndTime struct {
		StartedOn        SASTTime
		FinishedOn       SASTTime
		EngineStartedOn  SASTTime
		EngineFinishedOn SASTTime
	}
}

func (*Scan) String

func (s *Scan) String() string

type ScanResult

type ScanResult struct {
	QueryName         string
	QueryID           uint64
	PathID            uint64
	Line              uint64
	Column            uint64
	DetectionDate     string
	Filename          string
	DeepLink          string
	Status            string
	Severity          string
	State             string
	SimilarityID      int64
	SourceMethod      string
	DestinationMethod string
	Group             string
	Language          string
	Comment           string
	Nodes             []PathNode
}

func (ScanResult) String

func (r ScanResult) String() string

type ScanResultStatusSummary

type ScanResultStatusSummary struct {
	ToVerify               uint64
	NotExploitable         uint64
	Confirmed              uint64
	ProposedNotExploitable uint64
	Urgent                 uint64
}

func (ScanResultStatusSummary) String

func (s ScanResultStatusSummary) String() string

func (ScanResultStatusSummary) Total

func (s ScanResultStatusSummary) Total() uint64

type ScanResultSummary

type ScanResultSummary struct {
	High        ScanResultStatusSummary
	Medium      ScanResultStatusSummary
	Low         ScanResultStatusSummary
	Information ScanResultStatusSummary
}

func (ScanResultSummary) String

func (s ScanResultSummary) String() string

type ScanSchedule added in v0.0.33

type ScanSchedule struct {
	ProjectID   uint64   `json:"projectId"`
	ProjectName string   `json:"projectName"`
	Days        []string `json:"scanDays"`
	Time        string   `json:"scanTime"`
}

func (ScanSchedule) String added in v0.0.33

func (s ScanSchedule) String() string

type ScanSettings

type ScanSettings struct {
	ProjectID              uint64  `json:"projectID"`
	OverrideProjectSetting bool    `json:"overrideProjectSetting"`
	IsIncremental          bool    `json:"isIncremental"`
	IsPublic               bool    `json:"isPublic"`
	ForceScan              bool    `json:"forceScan"`
	Comment                string  `json:"comment"`
	PresetID               uint64  `json:"presetId"`
	EngineConfigurationID  uint64  `json:"engineConfigurationId"`
	ZippedSource           *[]byte `json:"zippedSource,omitempty"`
}

type ScanSettingsSOAP added in v0.0.25

type ScanSettingsSOAP struct {
	Text         string `xml:",chardata"`
	IsSuccesfull string `xml:"IsSuccesfull"`
	Started      struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"Started"`
	Finished struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"Finished"`
	RequestStarted struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"RequestStarted"`
	RequestComplete struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"RequestComplete"`
	ScanRisk                    string `xml:"ScanRisk"`
	Preset                      string `xml:"Preset"`
	Path                        string `xml:"Path"`
	Comment                     string `xml:"Comment"`
	LOC                         string `xml:"LOC"`
	FilesCount                  string `xml:"FilesCount"`
	High                        string `xml:"High"`
	Medium                      string `xml:"Medium"`
	Low                         string `xml:"Low"`
	Info                        string `xml:"Info"`
	ScanRiskSeverity            string `xml:"ScanRiskSeverity"`
	ScanRiskQuantity            string `xml:"ScanRiskQuantity"`
	IsIncremental               string `xml:"IsIncremental"`
	ScanType                    string `xml:"ScanType"`
	ScanLanguageStateCollection struct {
		Text                   string `xml:",chardata"`
		CxWSQueryLanguageState []struct {
			Text              string `xml:",chardata"`
			LanguageID        string `xml:"LanguageID"`
			LanguageName      string `xml:"LanguageName"`
			LanguageHash      string `xml:"LanguageHash"`
			StateCreationDate string `xml:"StateCreationDate"`
		} `xml:"CxWSQueryLanguageState"`
	} `xml:"ScanLanguageStateCollection"`
	EngineStart struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"EngineStart"`
	EngineFinish struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"EngineFinish"`
	ScanQueued struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"ScanQueued"`
	TotalScanTime             string `xml:"TotalScanTime"`
	TotalEngineTime           string `xml:"TotalEngineTime"`
	StatisticsCalculationDate struct {
		Text   string `xml:",chardata"`
		Hour   string `xml:"Hour"`
		Minute string `xml:"Minute"`
		Second string `xml:"Second"`
		Day    string `xml:"Day"`
		Month  string `xml:"Month"`
		Year   string `xml:"Year"`
	} `xml:"StatisticsCalculationDate"`
	ProjectName         string `xml:"ProjectName"`
	TeamName            string `xml:"TeamName"`
	ScanCompletedStatus string `xml:"ScanCompletedStatus"`
}

type SourceFile added in v0.0.25

type SourceFile struct {
	Filename string
	Source   string
}

type SourceFilters added in v0.0.12

type SourceFilters struct {
	ProjectID      uint64 `json:"projectId"`
	FoldersPattern string `json:"excludeFoldersPattern"`
	FilesPattern   string `json:"excludeFilesPattern"`
	PathPattern    string `json:"pathFilter"`
}

func (SourceFilters) HasFilters added in v0.0.12

func (f SourceFilters) HasFilters() bool

func (SourceFilters) ToGlob added in v0.0.12

func (f SourceFilters) ToGlob() string

type Team

type Team struct {
	TeamID         uint64 `json:"id"`
	Name           string
	FullName       string
	ParentID       uint64
	Projects       []*Project
	Users          []uint64
	InheritedUsers []uint64
}

func (Team) HasInheritedUsers added in v0.0.11

func (t Team) HasInheritedUsers() bool

func (Team) HasProjects

func (t Team) HasProjects() bool

func (Team) HasUsers added in v0.0.11

func (t Team) HasUsers() bool

func (*Team) String

func (t *Team) String() string

Teams

type User

type User struct {
	UserID        uint64 `json:"id"`
	FirstName     string
	LastName      string
	UserName      string
	LastLoginDate string
	Email         string
	IDPID         uint64 `json:"authenticationProviderId"`
	RoleIDs       []uint64
	TeamIDs       []uint64
	AccessToUI    bool `json:"accessToUi"`
}

func (User) IsInTeam added in v0.0.11

func (u User) IsInTeam(teamID uint64) bool

func (*User) String

func (u *User) String() string

Users

Jump to

Keyboard shortcuts

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