Documentation
¶
Index ¶
- Constants
- func OauthCodeCallbackURL(base_url, client_id, redirect_uri, scope, state string) string
- func OauthCodeHTTPClient(client *http.Client, ...) (*http.Client, error)
- func OauthCredentialClient(client *http.Client, ...) *http.Client
- func SeverityToString(sev int64) string
- func ShortenGUID(guid string) string
- func StateToString(state int64) string
- type ApplicationVersion
- type AuthenticationProvider
- type CustomTask
- type CxQuery
- type EngineConfiguration
- type IssueTracker
- type Link
- type Links
- type OIDCClaim
- type OIDCClient
- type PasswordConfig
- type PasswordTokenSource
- type PathNode
- type PathResultInfo
- type Preset
- type Project
- type ProjectComplex
- type ProjectCustomField
- type ProjectRepo
- type ProjectSettings
- type Query
- type QueryCollection
- func (qc *QueryCollection) AddQuery(l *QueryLanguage, g *QueryGroup, q *Query)
- func (qc *QueryCollection) DetectDependencies(teamsByID *map[uint64]*Team, projectsByID *map[uint64]*Project)
- func (qc *QueryCollection) FindCorpBaseQuery(language, query string) *Query
- func (qc *QueryCollection) FindProductQuery(language, query string) *Query
- func (qc *QueryCollection) FindProjectBaseQueryInTree(language, query string, projectId uint64, teamsByID *map[uint64]*Team, ...) (*Query, error)
- func (qc *QueryCollection) FindTeamBaseQueryInTree(language, query string, teamId uint64, teamsByID *map[uint64]*Team) (*Query, error)
- func (qc *QueryCollection) FromXML(response []byte) error
- func (qc *QueryCollection) GenerateHierarchy(query *Query)
- func (qc *QueryCollection) GetCorpQueries() []*Query
- func (qc *QueryCollection) GetCustomQueryCollection() QueryCollection
- func (qc *QueryCollection) GetProjectQueries(project *Project) []*Query
- func (qc *QueryCollection) GetQuery(language, group, query string) *Query
- func (qc *QueryCollection) GetQueryByID(qid uint64) *Query
- func (qc *QueryCollection) GetQueryCount() uint
- func (qc *QueryCollection) GetQueryDependencies(q *Query) []string
- func (qc *QueryCollection) GetQueryLanguage(language string) *QueryLanguage
- func (qc *QueryCollection) GetRootQueryID(queryId uint64) uint64
- func (qc *QueryCollection) GetTeamQueries(teamId uint64) []*Query
- func (qc *QueryCollection) LinkBaseQueries(teamsByID *map[uint64]*Team, projectsByID *map[uint64]*Project)
- func (qc *QueryCollection) LinkGroups()
- func (qc QueryCollection) MakeMergedTeamQuery(source *Query, destName string, teamsById *map[uint64]Team) (*Query, error)
- func (qc *QueryCollection) QueryHierarchy(queryId uint64) []uint64
- func (qc *QueryCollection) QueryHierarchyString(queryId uint64) []string
- func (qc *QueryCollection) String() string
- type QueryGroup
- type QueryLanguage
- type QueryMerger
- func (q *QueryMerger) Add(query *Query, owner string)
- func (q *QueryMerger) CheckStatus() (status int, message string)
- func (q *QueryMerger) Clear()
- func (q *QueryMerger) Count() int
- func (q *QueryMerger) Delete()
- func (q *QueryMerger) Insert(query *Query, owner string)
- func (q *QueryMerger) Merge(destqueryname string) (qquerycode string, err error)
- func (q *QueryMerger) Query(index int) (xquery CxQuery, err error)
- func (q *QueryMerger) Severity(highest bool) int
- func (q *QueryMerger) UncommentedCode() (quncommentedcode string)
- type Report
- type ReportStatus
- type ReportStatusResponse
- type ResultState
- type Role
- type SASTCache
- func (c *SASTCache) GenerateProjectIDMap()
- func (c *SASTCache) GenerateTeamIDMap()
- func (c *SASTCache) GenerateUserIDMap()
- func (c *SASTCache) GetPreset(presetID uint64) (*Preset, error)
- func (c *SASTCache) GetPresetByName(name string) (*Preset, error)
- func (c *SASTCache) GetProject(projectID uint64) (*Project, error)
- func (c *SASTCache) GetProjectByName(name string) (*Project, error)
- func (c *SASTCache) GetProjectsByTeamID(teamID uint64) []*Project
- func (c *SASTCache) GetQuery(queryID uint64) (*Query, error)
- func (c *SASTCache) GetQueryByNames(language, group, query string) (*Query, error)
- func (c *SASTCache) GetRole(roleID uint64) (*Role, error)
- func (c *SASTCache) GetRoleByName(name string) (*Role, error)
- func (c *SASTCache) GetTeam(teamID uint64) (*Team, error)
- func (c *SASTCache) GetTeamByName(name string) (*Team, error)
- func (c *SASTCache) GetTeamsByParentID(parentID uint64) []*Team
- func (c *SASTCache) GetUser(userID uint64) (*User, error)
- func (c *SASTCache) GetUserByEmail(email string) (*User, error)
- func (c *SASTCache) GetUsersInTeam(teamID uint64) []*User
- func (c *SASTCache) GetUsersInTeams(teams []Team) []*User
- func (c *SASTCache) MatchPresetQueries()
- func (c *SASTCache) MatchTeamProjects()
- func (c *SASTCache) MatchTeamUsers()
- func (c *SASTCache) PresetSummary() string
- func (c *SASTCache) ProjectSummary() string
- func (c *SASTCache) QuerySummary() string
- func (c *SASTCache) Refresh(client *SASTClient) []error
- func (c *SASTCache) RefreshPresets(client *SASTClient) error
- func (c *SASTCache) RefreshProjects(client *SASTClient) error
- func (c *SASTCache) RefreshQueries(client *SASTClient) error
- func (c *SASTCache) RefreshRoles(client *SASTClient) error
- func (c *SASTCache) RefreshTeams(client *SASTClient) error
- func (c *SASTCache) RefreshUsers(client *SASTClient) error
- func (c *SASTCache) String() string
- func (c *SASTCache) TeamSummary() string
- func (c *SASTCache) TeamTree() string
- func (c *SASTCache) UserSummary() string
- type SASTClient
- func (c SASTClient) ClientsValid() (bool, bool)
- func (c SASTClient) CompareVersions(version, target string) int
- func (c SASTClient) CreateOIDCClient(client *OIDCClient) error
- func (c SASTClient) CreateTeam(name string, parentId uint64) (uint64, error)
- func (c SASTClient) DeleteOIDCClient(client *OIDCClient) error
- func (c SASTClient) DeleteTeamByID(teamId uint64) error
- func (c SASTClient) DownloadReportByID(reportID uint64) ([]byte, error)
- func (c SASTClient) GenerateAndDownloadReportByID(scanID uint64, reportType string) ([]byte, error)
- func (c SASTClient) GetAllPathResultInfos(scanId uint64) ([]PathResultInfo, error)
- func (c SASTClient) GetAuthenticationProviders() ([]AuthenticationProvider, error)
- func (c SASTClient) GetCurrentRESTToken() string
- func (c SASTClient) GetCurrentSOAPToken() string
- func (c SASTClient) GetCurrentUser() (User, error)
- func (c SASTClient) GetCustomFields() ([]ProjectCustomField, error)
- func (c SASTClient) GetCustomTasks() ([]CustomTask, error)
- func (c SASTClient) GetEngineConfigurations() ([]EngineConfiguration, error)
- func (c SASTClient) GetEngineConfigurationsSOAP() ([]EngineConfiguration, error)
- func (c SASTClient) GetIssueTrackers() ([]IssueTracker, error)
- func (c SASTClient) GetLastScanByID(projectid uint64) (Scan, error)
- func (c SASTClient) GetOIDCClientByID(clientId string) (OIDCClient, error)
- func (c SASTClient) GetOIDCClients() ([]OIDCClient, error)
- func (c SASTClient) GetPresetByID(presetID uint64) (Preset, error)
- func (c SASTClient) GetPresetByName(name string) (Preset, error)
- func (c SASTClient) GetPresetContents(p *Preset, queries *QueryCollection) error
- func (c SASTClient) GetPresets() ([]Preset, error)
- func (c SASTClient) GetProjectByID(id uint64) (Project, error)
- func (c SASTClient) GetProjectByIDV(id uint64, version string) (Project, error)
- func (c SASTClient) GetProjectCustomFields(project *Project) error
- func (c SASTClient) GetProjectLastFullScanIDODATA(project *Project) (uint64, error)
- func (c SASTClient) GetProjectRepository(project *Project) error
- func (c SASTClient) GetProjectSettings(project *Project) error
- func (c SASTClient) GetProjectSettingsByID(projectid uint64) (ProjectSettings, error)
- func (c SASTClient) GetProjectSourceFilters(project *Project) error
- func (c SASTClient) GetProjects() ([]Project, error)
- func (c SASTClient) GetProjectsByName(name string) ([]Project, error)
- func (c SASTClient) GetProjectsInTeamByID(teamid uint64) ([]Project, error)
- func (c SASTClient) GetQueriesSOAP() (QueryCollection, error)
- func (c SASTClient) GetQueriesSOAPRaw() ([]byte, error)
- func (c SASTClient) GetQueryByID(qid uint64, queries *[]Query) *Query
- func (c SASTClient) GetReportStatusByID(reportID uint64) (ReportStatusResponse, error)
- func (c SASTClient) GetResultPathsForQuerySOAP(scanID, queryID uint64) ([]ScanResult, error)
- func (c SASTClient) GetResultStateListSOAP() ([]ResultState, error)
- func (c SASTClient) GetResultsForScanSOAP(scanId uint64) ([]ScanResult, error)
- func (c SASTClient) GetResultsFromXML(xmlReportData []byte) ([]ScanResult, error)
- func (c SASTClient) GetRoles() ([]Role, error)
- func (c SASTClient) GetScanByID(scanid uint64) (Scan, error)
- func (c SASTClient) GetScanCustomStateUsedODATA(scanId uint64, stateId uint) (bool, error)
- func (c SASTClient) GetScanPresetSOAP(scanid uint64) (Preset, error)
- func (c SASTClient) GetScanResultPathNodes(scanId, pathId uint64) ([]PathNode, error)
- func (c SASTClient) GetScanResultSummary(results []ScanResult) ScanResultSummary
- func (c SASTClient) GetScanSchedules() ([]ScanSchedule, error)
- func (c SASTClient) GetScanSettingsByIDSOAP(scanId uint64) (ScanSettingsSOAP, error)
- func (c SASTClient) GetScanSourceCodeByIDSOAP(scanId uint64) ([]byte, error)
- func (c SASTClient) GetSourcesByScanIDSOAP(scanId uint64, files []string) ([]SourceFile, error)
- func (c SASTClient) GetTeamByID(teamId uint64) (Team, error)
- func (c SASTClient) GetTeamHierarchy(teamId uint64, teamMap *map[uint64]*Team) []*Team
- func (c SASTClient) GetTeams() ([]Team, error)
- func (c SASTClient) GetUsers() ([]User, error)
- func (c SASTClient) GetVersionSOAP() (ApplicationVersion, error)
- func (c SASTClient) PresetLink(p *Preset) string
- func (c SASTClient) ProjectLink(p *Project) string
- func (c SASTClient) QueryGroupLink(q *QueryGroup) string
- func (c SASTClient) QueryLanguageLink(q *QueryLanguage) string
- func (c SASTClient) QueryLink(q *Query) string
- func (c SASTClient) RequestNewReportByID(scanID uint64, reportType string) (Report, error)
- func (c SASTClient) RoleLink(r *Role) string
- func (c SASTClient) SaveOIDCClient(client *OIDCClient) error
- func (c SASTClient) ScanProjectByID(projectID uint64, isIncremental, isPublic, forceScan bool, comment string) (uint64, error)
- func (c SASTClient) ScanProjectWithSettingsByID(settings *ScanSettings) (uint64, error)
- func (c SASTClient) String() string
- func (c SASTClient) TeamLink(t *Team) string
- func (c SASTClient) UpdateProjectCustomFields(project *Project) error
- func (c SASTClient) UploadBytesForProjectByID(projectID uint64, fileContents *[]byte) error
- func (c SASTClient) UploadFileForProjectByID(projectID uint64, filename string) error
- func (c SASTClient) UserLink(u *User) string
- type SASTTime
- type Scan
- type ScanResult
- type ScanResultStatusSummary
- type ScanResultSummary
- type ScanSchedule
- type ScanSettings
- type ScanSettingsSOAP
- type SourceFile
- type SourceFilters
- type Team
- type User
Constants ¶
const ( CORP_QUERY = "Corporate" PRODUCT_QUERY = "Cx" TEAM_QUERY = "Team" PROJECT_QUERY = "Project" )
const ( PreScanAction = "SOURCE_CONTROL_COMMAND" PostScanAction = "POST_SCAN_COMMAND" )
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
const STATUS_INVALID = 9 // Invalid content for processing
const STATUS_OK = 0 // All good
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 OauthCodeHTTPClient ¶
func OauthCredentialClient ¶
func SeverityToString ¶ added in v0.0.25
func ShortenGUID ¶
func StateToString ¶ added in v0.0.25
Types ¶
type ApplicationVersion ¶ added in v0.0.11
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 EngineConfiguration ¶ added in v0.0.11
type IssueTracker ¶ added in v0.0.11
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) TokenSource ¶
func (c *PasswordConfig) TokenSource(ctx context.Context) oauth2.TokenSource
type PasswordTokenSource ¶
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)
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
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 ProjectRepo ¶
func (*ProjectRepo) String ¶
func (pr *ProjectRepo) String() string
type ProjectSettings ¶
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) MergeDependencies ¶ added in v0.0.24
func (*Query) StringDetailed ¶ added in v0.0.22
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 (*QueryCollection) FindTeamBaseQueryInTree ¶ added in v0.0.22
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 (*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 ReportStatus ¶
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 Role ¶
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) GetPresetByName ¶
func (*SASTCache) GetProjectByName ¶
func (*SASTCache) GetProjectsByTeamID ¶
func (*SASTCache) GetQueryByNames ¶
func (*SASTCache) GetTeamsByParentID ¶
func (*SASTCache) GetUsersInTeam ¶
func (*SASTCache) GetUsersInTeams ¶
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 (*SASTCache) ProjectSummary ¶
func (*SASTCache) QuerySummary ¶
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) TeamSummary ¶
func (*SASTCache) UserSummary ¶
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 (SASTClient) PresetLink ¶
func (c SASTClient) PresetLink(p *Preset) string
func (SASTClient) ProjectLink ¶
func (c SASTClient) ProjectLink(p *Project) string
Links to objects in the portal
func (SASTClient) QueryGroupLink ¶
func (c SASTClient) QueryGroupLink(q *QueryGroup) string
func (SASTClient) QueryLanguageLink ¶
func (c SASTClient) QueryLanguageLink(q *QueryLanguage) string
func (SASTClient) QueryLink ¶
func (c SASTClient) QueryLink(q *Query) string
func (SASTClient) RequestNewReportByID ¶
func (c SASTClient) RequestNewReportByID(scanID uint64, reportType string) (Report, error)
func (SASTClient) RoleLink ¶
func (c SASTClient) RoleLink(r *Role) string
func (SASTClient) SaveOIDCClient ¶
func (c SASTClient) SaveOIDCClient(client *OIDCClient) error
func (SASTClient) ScanProjectByID ¶
func (SASTClient) ScanProjectWithSettingsByID ¶
func (c SASTClient) ScanProjectWithSettingsByID(settings *ScanSettings) (uint64, error)
func (SASTClient) String ¶
func (c SASTClient) String() string
func (SASTClient) TeamLink ¶
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 (SASTClient) UserLink ¶
func (c SASTClient) UserLink(u *User) string
type SASTTime ¶ added in v0.0.20
func (SASTTime) MarshalJSON ¶ added in v0.0.27
func (*SASTTime) UnmarshalJSON ¶ added in v0.0.20
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
}
}
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 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
}