Documentation
¶
Overview ¶
Copyright 2025 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2025 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2026 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2026 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func AllPaginationQueryParameters() []string
- func AnalysisStepName(step AnalysisStep) (string, bool)
- func AssetGroupAssociations() []string
- func AssetGroupCollectionAssociations() []string
- func ErrIsGraphSchemaDuplicateError(err error) bool
- func FromDAWGSRelationship(includeProperties bool) func(*graph.Relationship) UnifiedEdge
- func GetAssetGroupMemberProperties(primaryDisplayKinds graphschema.PrimaryDisplayKinds, node *graph.Node) (primaryKind, displayName, objectId, envId string)
- func IgnoreFilters() []string
- func IsExtendedNodeKind(kind graph.Kind) bool
- func IsValidIconColor(iconColor string) bool
- func MatchReservedGraphKindNamespace(candidate string) (string, bool)
- func RoleAssociations() []string
- func SSOProviderIsStringField(field string) bool
- func SSOProviderSortableFields(field string) bool
- func SSOProviderValidFilterPredicates(field string) ([]string, error)
- func UserAssociations() []string
- func UserSessionAssociations() []string
- type ADDataQualityAggregation
- type ADDataQualityAggregations
- type ADDataQualityStat
- type ADDataQualityStats
- type AnalysisMode
- type AnalysisRequest
- type AnalysisRequestType
- type AnalysisStep
- type AnalysisSteps
- func (s AnalysisSteps) Bits() int
- func (s AnalysisSteps) Has(step AnalysisStep) bool
- func (s AnalysisSteps) IsEmpty() bool
- func (s AnalysisSteps) MarshalJSON() ([]byte, error)
- func (s AnalysisSteps) Merge(steps AnalysisSteps) AnalysisSteps
- func (s *AnalysisSteps) Scan(value any) error
- func (s *AnalysisSteps) UnmarshalJSON(data []byte) error
- func (s AnalysisSteps) Value() (driver.Value, error)
- type AssetGroup
- type AssetGroupCertification
- type AssetGroupCollection
- type AssetGroupCollectionEntries
- type AssetGroupCollectionEntry
- type AssetGroupCollections
- type AssetGroupExpansionMethod
- type AssetGroupHistory
- type AssetGroupHistoryAction
- type AssetGroupSelector
- type AssetGroupSelectorNode
- type AssetGroupSelectorNodeExpanded
- type AssetGroupSelectorNodeSource
- type AssetGroupSelectorNodes
- type AssetGroupSelectorSpec
- type AssetGroupSelectors
- type AssetGroupTag
- func (s AssetGroupTag) AuditData() AuditData
- func (s AssetGroupTag) GetExpansionMethod() AssetGroupExpansionMethod
- func (s AssetGroupTag) IsStringColumn(filter string) bool
- func (s AssetGroupTag) IsTierZero() bool
- func (s AssetGroupTag) KindName() string
- func (AssetGroupTag) TableName() string
- func (s AssetGroupTag) ToKind() graph.Kind
- func (s AssetGroupTag) ToType() string
- func (s AssetGroupTag) ValidFilters() map[string][]FilterOperator
- type AssetGroupTagCounts
- type AssetGroupTagCountsMap
- type AssetGroupTagSelector
- func (s AssetGroupTagSelector) AuditData() AuditData
- func (s AssetGroupTagSelector) IsSortable(criteria string) bool
- func (s AssetGroupTagSelector) IsStringColumn(filter string) bool
- func (AssetGroupTagSelector) TableName() string
- func (s AssetGroupTagSelector) ValidFilters() map[string][]FilterOperator
- type AssetGroupTagSelectors
- type AssetGroupTagType
- type AssetGroupTags
- type AssetGroups
- func (s AssetGroups) FindByName(name string) (AssetGroup, bool)
- func (s AssetGroups) GetFilterableColumns() []string
- func (s AssetGroups) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
- func (s AssetGroups) IsSortable(column string) bool
- func (s AssetGroups) IsString(column string) bool
- func (s AssetGroups) ValidFilters() map[string][]FilterOperator
- type AuditData
- type AuditEntry
- type AuditLog
- type AuditLogAction
- type AuditLogEntryStatus
- type AuditLogs
- type Auditable
- type AuditableURL
- type AuthSecret
- type AuthToken
- type AuthTokens
- func (s AuthTokens) GetFilterableColumns() []string
- func (s AuthTokens) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
- func (s AuthTokens) IDs() []uuid.UUID
- func (s AuthTokens) IsSortable(column string) bool
- func (s AuthTokens) IsString(column string) bool
- func (s AuthTokens) StripKeys() AuthTokens
- func (s AuthTokens) ValidFilters() map[string][]FilterOperator
- type AzureDataQualityAggregation
- type AzureDataQualityAggregations
- type AzureDataQualityStat
- type AzureDataQualityStats
- type AzureStatKinds
- type BaseADEntity
- type Basic
- type BigSerial
- type CSVWriter
- type CompletedTask
- type CustomNodeKind
- type CustomNodeKindConfig
- type CustomNodeKindMap
- type CustomNodeKindType
- type CustomNodeKinds
- type DataQualityAggregation
- type DataQualityAggregations
- type DataQualityMetricType
- type DataQualityStat
- type DataQualityStats
- type DataType
- type DatapipeStatus
- type DatapipeStatusWrapper
- type DomainCacheEntry
- type EdgeCompositionEdge
- type EdgeCompositionEdges
- type EdgeCompositionNode
- type EdgeCompositionNodes
- type EnvironmentInput
- type EnvironmentKindsToEnvironment
- type EnvironmentPayload
- type EnvironmentProperties
- type EnvironmentSelector
- type EnvironmentSelectors
- func (s EnvironmentSelectors) GetFilterCriteria(request *http.Request, environmentKinds []graph.Kind) (graph.Criteria, error)
- func (s EnvironmentSelectors) GetFilterableColumns() []string
- func (s EnvironmentSelectors) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
- func (s EnvironmentSelectors) IsSortable(column string) bool
- func (s EnvironmentSelectors) IsString(column string) bool
- func (s EnvironmentSelectors) ValidFilters() map[string][]FilterOperator
- type EnvironmentTargetedAccessControl
- type EnvironmentsInput
- type Exposure
- type Exposures
- type ExtensionInput
- type FileType
- type Filter
- type FilterOperator
- type FilterSetOperator
- type Filtered
- type Filters
- type GraphExtensionInput
- type GraphExtensionPayload
- type GraphExtensionUpsertResult
- type GraphMigration
- type GraphSchemaExtension
- type GraphSchemaExtensionPayload
- type GraphSchemaExtensions
- type GraphSchemaKindInfo
- type GraphSchemaNodeKind
- type GraphSchemaNodeKinds
- type GraphSchemaNodeKindsPayload
- type GraphSchemaProperties
- type GraphSchemaProperty
- type GraphSchemaRelationshipKind
- type GraphSchemaRelationshipKindWithNamedSchema
- type GraphSchemaRelationshipKinds
- type GraphSchemaRelationshipKindsPayload
- type GraphSchemaRelationshipKindsWithNamedSchema
- type IngestJob
- type IngestJobs
- func (s IngestJobs) GetFilterableColumns() []string
- func (s IngestJobs) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
- func (s IngestJobs) IsSortable(column string) bool
- func (s IngestJobs) IsString(column string) bool
- func (s IngestJobs) ValidFilters() map[string][]FilterOperator
- type IngestTask
- type IngestTasks
- type Installation
- type JobStatus
- type Kind
- type KindInfoInput
- type KindInfoInputs
- type KindInfoPayload
- type LegacyADOU
- type Migration
- type NodeInput
- type NodesInput
- type OIDCProvider
- type OUCacheEntry
- type PZRuleInput
- type PZRulePayload
- type PZRulesInput
- type PZRulesPayload
- type PagedNodeListEntry
- type PaginatedResponse
- type Permission
- type Permissions
- type QueryParameterFilter
- type QueryParameterFilterMap
- func (s QueryParameterFilterMap) AddFilter(filter QueryParameterFilter)
- func (s QueryParameterFilterMap) BuildAliasedSQLFilter(tableAlias models.Optional[string]) (SQLFilter, error)
- func (s QueryParameterFilterMap) BuildGDBNodeFilter() graph.Criteria
- func (s QueryParameterFilterMap) BuildSQLFilter() (SQLFilter, error)
- func (s QueryParameterFilterMap) FirstFilter(name string) (QueryParameterFilter, bool)
- func (s QueryParameterFilterMap) IsFiltered(name string) bool
- func (s QueryParameterFilterMap) ToFiltersModel() Filters
- type QueryParameterFilterParser
- type QueryParameterFilters
- type ReconcileResult
- type RelationshipFindingInput
- type RelationshipFindingsInput
- type RelationshipFindingsPayload
- type RelationshipInput
- type RelationshipsInput
- type Remediation
- type RemediationInput
- type RemediationPayload
- type ReservedKindError
- type Role
- type Roles
- func (s Roles) FindByName(name string) (Role, bool)
- func (s Roles) FindByPermissions(permissions Permissions) (Role, bool)
- func (s Roles) GetFilterableColumns() []string
- func (s Roles) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
- func (s Roles) Has(other Role) bool
- func (s Roles) IDs() []int32
- func (s Roles) IsSortable(column string) bool
- func (s Roles) IsString(column string) bool
- func (s Roles) Names() []string
- func (s Roles) Permissions() Permissions
- func (s Roles) RemoveByName(name string) Roles
- func (s Roles) ValidFilters() map[string][]FilterOperator
- type SAMLProvider
- func (s SAMLProvider) AuditData() AuditData
- func (s *SAMLProvider) FormatSAMLProviderURLs(hostUrl url.URL)
- func (s SAMLProvider) GetSAMLUserGivenNameFromAssertion(assertion *saml.Assertion) (string, error)
- func (s SAMLProvider) GetSAMLUserPrincipalNameFromAssertion(assertion *saml.Assertion) (string, error)
- func (s SAMLProvider) GetSAMLUserRolesFromAssertion(assertion *saml.Assertion) (roles []string)
- func (s SAMLProvider) GetSAMLUserSurnameFromAssertion(assertion *saml.Assertion) (string, error)
- func (SAMLProvider) TableName() string
- type SAMLProviders
- type SAMLRootURIVersion
- type SQLFilter
- type SSOProvider
- type SSOProviderAutoProvisionConfig
- type SSOProviderConfig
- type SavedQueries
- func (s SavedQueries) GetFilterableColumns() []string
- func (s SavedQueries) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
- func (s SavedQueries) IsSortable(column string) bool
- func (s SavedQueries) IsString(column string) bool
- func (s SavedQueries) ValidFilters() map[string][]FilterOperator
- type SavedQueriesInput
- type SavedQueriesPayload
- type SavedQueriesPermissions
- type SavedQuery
- type SavedQueryInput
- type SavedQueryPayload
- type SavedQueryScope
- type SchemaEnvironment
- type SchemaEnvironmentPrincipalKind
- type SchemaEnvironmentPrincipalKinds
- type SchemaFinding
- func (s SchemaFinding) FindingKind() graph.Kind
- func (s SchemaFinding) GetDisplayName() string
- func (s SchemaFinding) GetExtensionName() string
- func (s SchemaFinding) GetPZDisplayName() string
- func (s SchemaFinding) GetSubtypes() []string
- func (s SchemaFinding) GetType() SchemaFindingType
- func (s SchemaFinding) Is(others ...graph.Kind) bool
- func (s SchemaFinding) IsSortable(column string) bool
- func (s SchemaFinding) IsSubtype(subtype string) bool
- func (s SchemaFinding) IsType(findingType SchemaFindingType) bool
- func (s SchemaFinding) String() string
- func (SchemaFinding) TableName() string
- func (SchemaFinding) ValidFilters() map[string][]FilterOperator
- type SchemaFindingType
- type SchemaFindingsSubtype
- type ScopedSavedQuery
- type SearchResult
- type SelectorAutoCertifyMethod
- type SelectorSeed
- type SelectorSeedInput
- type SelectorSeedPayload
- type SelectorSeeds
- type SelectorType
- type Serial
- type SessionAuthProvider
- type SessionFlagKey
- type Sort
- type SortDirection
- type SortItem
- type SourceKind
- type UnifiedEdge
- type UnifiedGraph
- func (s *UnifiedGraph) AddNode(primaryDisplayKinds graphschema.PrimaryDisplayKinds, node *graph.Node, ...)
- func (s *UnifiedGraph) AddPathSet(primaryDisplayKinds graphschema.PrimaryDisplayKinds, paths graph.PathSet, ...)
- func (s *UnifiedGraph) AddRelationship(rel *graph.Relationship, includeProperties bool)
- type UnifiedGraphWPropertyKeys
- type UnifiedNode
- type Unique
- type UpdatedAssetGroupSelectors
- type User
- type UserSession
- type Users
- type ValidFilters
Constants ¶
const ( SelectorSpecActionAdd = "add" SelectorSpecActionRemove = "remove" TierZeroAssetGroupName = "Admin Tier Zero" TierZeroAssetGroupTag = "admin_tier_0" OwnedAssetGroupName = "Owned" OwnedAssetGroupTag = "owned" )
const ( AssetGroupActorBloodHound = "BloodHound" AssetGroupActorOpenGraphExtensionManagement = "OpenGraph Extension Management" AssetGroupTierZeroPosition = 1 AssetGroupTierHygienePlaceholderId = 0 )
const ( TierZeroGlyph = "gem" OwnedGlyph = "skull" AssetGroupTagKindPrefix = "Tag_" )
const ( PaginationQueryParameterBefore = "before" PaginationQueryParameterAfter = "after" PaginationQueryParameterLimit = "limit" PaginationQueryParameterOffset = "offset" PaginationQueryParameterSkip = "skip" PaginationQueryParameterSortBy = "sort_by" )
const ( ObjectIDAttributeNameFormat = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri" ObjectIDEmail = "urn:oid:0.9.2342.19200300.100.1.3" ObjectIDGivenName = "urn:oid:2.5.4.42" ObjectIDName = "urn:oid:2.5.4.41" ObjectIDSurname = "urn:oid:2.5.4.4" XMLTypeString = "xs:string" XMLSOAPClaimsEmailAddress = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" XMLSOAPClaimsGivenName = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" XMLSOAPClaimsName = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" XMLSOAPClaimsSurname = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" MicrosoftClaimsRole = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" )
const ( ErrResponseDetailsBadQueryParameterFilters = "there are errors in the query parameter filters specified" ErrResponseDetailsFilterPredicateNotSupported = "the specified filter predicate is not supported for this column" ErrResponseDetailsColumnNotFilterable = "the specified column cannot be filtered" ErrResponseDetailsColumnNotSortable = "the specified column cannot be sorted" )
const AssetGroupHistoryRecordRollingWindow = 90
AssetGroupHistoryRecordRollingWindow This defines the rolling window in days that the asset group history table will be truncated down to at the end of a successful analysis run
const Namespace = "bh"
Namespace constant for prometheus metrics
const PermissionURIScheme = "permission"
Variables ¶
var ( ErrNotFiltered = errors.New("parameter value is not filtered") FmtErrFilterValueConversion = "unable to convert filter value to SQL literal for %s: %w" )
var ( ErrGraphExtensionBuiltIn = errors.New("cannot modify a built-in graph extension") ErrGraphExtensionValidation = errors.New("graph schema validation error") ErrGraphDBRefreshKinds = errors.New("error refreshing graph db kinds") ErrFeatureFlag = errors.New("error checking if feature flag is enabled") ErrDuplicateGraphSchemaExtensionName = errors.New("duplicate graph schema extension name") ErrDuplicateGraphSchemaExtensionNamespace = errors.New("duplicate graph schema extension namespace") ErrDuplicateSchemaNodeKindName = errors.New("duplicate schema node kind name") ErrDuplicateGraphSchemaExtensionPropertyName = errors.New("duplicate graph schema extension property name") ErrDuplicateSchemaRelationshipKindName = errors.New("duplicate schema relationship kind name") ErrDuplicateSchemaEnvironment = errors.New("duplicate schema environment") ErrDuplicateSchemaFindingName = errors.New("duplicate schema finding name") ErrDuplicatePrincipalKind = errors.New("duplicate principal kind") // entity panel db errors ErrKindInfoKindNotFound = errors.New("kind info references a kind that does not exist") // entity panel duplicate errors, enforced at both the model (validation) and db (uniqueness constraint) layers ErrKindInfoDuplicatePosition = errors.New("kind info position already in use for this kind") ErrKindInfoDuplicateInfoKey = errors.New("kind info key already in use for this kind") // entity panel validation errors ErrInvalidKindInfoTitle = errors.New("invalid kind info title: must not be empty or whitespace-only") ErrInvalidKindInfoKey = errors.New("invalid kind info key: must match pattern ^[a-z0-9_-]{1,128}$") ErrTooManyKindInfoEntries = errors.New("too many kind info entries: maximum 100 allowed per kind") ErrInvalidKindInfoPosition = errors.New("invalid kind info position: must be >= 0") ErrInvalidKindInfoContent = errors.New("invalid kind info content: must be a JSON object of the form {\"markdown\":{\"content\":\"...\"}}") ErrInvalidKindInfoTemplate = errors.New("invalid kind info markdown template") )
var (
ErrSAMLAssertion = errors.New("SAML assertion error")
)
var ValidColorStringRegex = regexp.MustCompile("^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$")
Functions ¶
func AllPaginationQueryParameters ¶
func AllPaginationQueryParameters() []string
func AnalysisStepName ¶
func AnalysisStepName(step AnalysisStep) (string, bool)
Returns false if name is not found for AnalysisStep.
func AssetGroupAssociations ¶
func AssetGroupAssociations() []string
AssetGroupAssociations returns a list of AssetGroup model associations to load eagerly by default with GORM Preload(...). Note: this does not include the "Collections" association on-purpose since this collection grows over time and may require additional parameters for fetching.
func AssetGroupCollectionAssociations ¶
func AssetGroupCollectionAssociations() []string
AssetGroupCollectionAssociations returns a list of AssetGroupCollection model associations to eagerly by default with GORM Preload(...).
func FromDAWGSRelationship ¶
func FromDAWGSRelationship(includeProperties bool) func(*graph.Relationship) UnifiedEdge
This is being used with slices.Map so it is necessary to return a closure
func GetAssetGroupMemberProperties ¶
func GetAssetGroupMemberProperties(primaryDisplayKinds graphschema.PrimaryDisplayKinds, node *graph.Node) (primaryKind, displayName, objectId, envId string)
These are the relevant properties for asset group tags. This method serves to keep consistency across the feature
func IgnoreFilters ¶
func IgnoreFilters() []string
func IsExtendedNodeKind ¶
IsExtendedNodeKind reports whether a kind is an internal or framework kind that should not be treated as a user-ingested node kind.
func IsValidIconColor ¶
func MatchReservedGraphKindNamespace ¶
MatchReservedGraphKindNamespace reports whether a kind either exactly matches a reserved namespace or uses one as its "namespace_" prefix. The matched namespace is returned (in its canonical lowercase form) for use in error messages. Comparisons are case-insensitive.
This function is used to validate kind names at ingest time and at extension upload time.
func RoleAssociations ¶
func RoleAssociations() []string
func SSOProviderIsStringField ¶
Define which fields are string type
func SSOProviderSortableFields ¶
Define sortable fields
func SSOProviderValidFilterPredicates ¶
Define valid filter predicates for each field
func UserAssociations ¶
func UserAssociations() []string
Used by gorm to preload / instantiate the user FK'd tables data
func UserSessionAssociations ¶
func UserSessionAssociations() []string
Used by gorm to preload / instantiate the user FK'd tables data
Types ¶
type ADDataQualityAggregation ¶
type ADDataQualityAggregation struct {
Domains int `json:"domains"`
Users int `json:"users"`
Groups int `json:"groups"`
Computers int `json:"computers"`
OUs int `json:"ous" gorm:"column:ous"`
Containers int `json:"containers"`
GPOs int `json:"gpos" gorm:"column:gpos"`
AIACAs int `json:"aiacas" gorm:"column:aiacas"`
RootCAs int `json:"rootcas" gorm:"column:rootcas"`
EnterpriseCAs int `json:"enterprisecas" gorm:"column:enterprisecas"`
NTAuthStores int `json:"ntauthstores" gorm:"column:ntauthstores"`
CertTemplates int `json:"certtemplates" gorm:"column:certtemplates"`
IssuancePolicies int `json:"issuancepolicies" gorm:"column:issuancepolicies"`
Sites int `json:"sites" gorm:"column:sites"`
SiteServers int `json:"siteservers" gorm:"column:siteservers"`
SiteSubnets int `json:"sitesubnets" gorm:"column:sitesubnets"`
Acls int `json:"acls" gorm:"column:acls"`
Sessions int `json:"sessions"`
Relationships int `json:"relationships"`
SessionCompleteness float32 `json:"session_completeness"`
LocalGroupCompleteness float32 `json:"local_group_completeness"`
RunID string `json:"run_id" gorm:"index"`
Serial
}
type ADDataQualityAggregations ¶
type ADDataQualityAggregations []ADDataQualityAggregation
type ADDataQualityStat ¶
type ADDataQualityStat struct {
DomainSID string `json:"domain_sid" gorm:"column:domain_sid"`
Users int `json:"users"`
Groups int `json:"groups"`
Computers int `json:"computers"`
OUs int `json:"ous" gorm:"column:ous"`
Containers int `json:"containers"`
GPOs int `json:"gpos" gorm:"column:gpos"`
AIACAs int `json:"aiacas" gorm:"column:aiacas"`
RootCAs int `json:"rootcas" gorm:"column:rootcas"`
EnterpriseCAs int `json:"enterprisecas" gorm:"column:enterprisecas"`
NTAuthStores int `json:"ntauthstores" gorm:"column:ntauthstores"`
CertTemplates int `json:"certtemplates" gorm:"column:certtemplates"`
IssuancePolicies int `json:"issuancepolicies" gorm:"column:issuancepolicies"`
Sites int `json:"sites" gorm:"column:sites"`
SiteServers int `json:"siteservers" gorm:"column:siteservers"`
SiteSubnets int `json:"sitesubnets" gorm:"column:sitesubnets"`
ACLs int `json:"acls" gorm:"column:acls"`
Sessions int `json:"sessions"`
Relationships int `json:"relationships"`
SessionCompleteness nan.Float64 `json:"session_completeness"`
LocalGroupCompleteness nan.Float64 `json:"local_group_completeness"`
RunID string `json:"run_id" gorm:"index"`
Serial
}
type ADDataQualityStats ¶
type ADDataQualityStats []ADDataQualityStat
func (ADDataQualityStats) IsSortable ¶
func (s ADDataQualityStats) IsSortable(column string) bool
type AnalysisMode ¶
type AnalysisMode string
const ( // This list needs to be updated when new modes are added. AnalysisModeNoPostProcessing AnalysisMode = "no_post_processing" AnalysisModeFull AnalysisMode = "full" )
func (AnalysisMode) AnalysisStepsFromMode ¶
func (s AnalysisMode) AnalysisStepsFromMode() AnalysisSteps
This function needs to be updated when new modes are added. If the mode is unknown, defaults to full analysis. With this function, and by making AnalysisMode a parameter for RequestAnalysis(), we ensure consumers of RequestAnalysis() cannot queue arbitrary bitmasks.
type AnalysisRequest ¶
type AnalysisRequest struct {
RequestedBy string `json:"requested_by"`
RequestType AnalysisRequestType `json:"request_type"`
RequestedAt time.Time `json:"requested_at"`
AnalysisSteps AnalysisSteps `json:"analysis_step" gorm:"column:analysis_step"` // Internally bits indicating which analysis pipeline steps to run.
DeleteAllGraph bool `json:"delete_all_graph"` // Deletes all nodes and edges in the graph
DeleteSourcelessGraph bool `json:"delete_sourceless_graph"` // Deletes all nodes and edges in the graph that have a type not registered in the source_kinds table
DeleteSourceKinds pq.StringArray `gorm:"type:text[];column:delete_source_kinds"` // Deletes all nodes and edges per kind provided.
DeleteRelationships pq.StringArray `gorm:"type:text[];column:delete_relationships"` // Deletes all relationships by name
}
type AnalysisRequestType ¶
type AnalysisRequestType string
const ( AnalysisRequestAnalysis AnalysisRequestType = "analysis" AnalysisRequestDeletion AnalysisRequestType = "deletion" )
type AnalysisStep ¶
type AnalysisStep int32
AnalysisStep represents a single step in analysis
func AnalysisStepADPostProcessing ¶
func AnalysisStepADPostProcessing() AnalysisStep
func AnalysisStepAzurePostProcessing ¶
func AnalysisStepAzurePostProcessing() AnalysisStep
func AnalysisStepGenerateFindings ¶
func AnalysisStepGenerateFindings() AnalysisStep
func AnalysisStepTagging ¶
func AnalysisStepTagging() AnalysisStep
type AnalysisSteps ¶
type AnalysisSteps struct {
// contains filtered or unexported fields
}
AnalysisSteps represents a set of steps in analysis using a bitmask. bits is an unexported field so callers cannot create arbitrary nonzero bitmasks.
func AnalysisStepsFull ¶
func AnalysisStepsFull() AnalysisSteps
func AnalysisStepsNoPostProcessing ¶
func AnalysisStepsNoPostProcessing() AnalysisSteps
func (AnalysisSteps) Bits ¶
func (s AnalysisSteps) Bits() int
func (AnalysisSteps) Has ¶
func (s AnalysisSteps) Has(step AnalysisStep) bool
Has reports whether all of the bits in step are set in s.
func (AnalysisSteps) IsEmpty ¶
func (s AnalysisSteps) IsEmpty() bool
func (AnalysisSteps) MarshalJSON ¶
func (s AnalysisSteps) MarshalJSON() ([]byte, error)
func (AnalysisSteps) Merge ¶
func (s AnalysisSteps) Merge(steps AnalysisSteps) AnalysisSteps
func (*AnalysisSteps) Scan ¶
func (s *AnalysisSteps) Scan(value any) error
func (*AnalysisSteps) UnmarshalJSON ¶
func (s *AnalysisSteps) UnmarshalJSON(data []byte) error
type AssetGroup ¶
type AssetGroup struct {
Name string `json:"name"`
Tag string `json:"tag"`
SystemGroup bool `json:"system_group"`
Selectors AssetGroupSelectors `gorm:"constraint:OnDelete:CASCADE;"`
Collections AssetGroupCollections `json:"-" gorm:"constraint:OnDelete:CASCADE;"`
MemberCount int `json:"member_count" gorm:"-"`
Serial
}
func (AssetGroup) AuditData ¶
func (s AssetGroup) AuditData() AuditData
type AssetGroupCertification ¶
type AssetGroupCertification int
const ( AssetGroupCertificationPending AssetGroupCertification = 0 AssetGroupCertificationRevoked AssetGroupCertification = 1 AssetGroupCertificationManual AssetGroupCertification = 2 AssetGroupCertificationAuto AssetGroupCertification = 3 )
type AssetGroupCollection ¶
type AssetGroupCollection struct {
AssetGroupID int32 `json:"-"`
Entries AssetGroupCollectionEntries `json:"entries" gorm:"constraint:OnDelete:CASCADE;"`
BigSerial
}
type AssetGroupCollectionEntries ¶
type AssetGroupCollectionEntries []AssetGroupCollectionEntry
type AssetGroupCollections ¶
type AssetGroupCollections []AssetGroupCollection
func (AssetGroupCollections) GetFilterableColumns ¶
func (s AssetGroupCollections) GetFilterableColumns() []string
func (AssetGroupCollections) GetValidFilterPredicatesAsStrings ¶
func (s AssetGroupCollections) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
func (AssetGroupCollections) IsSortable ¶
func (s AssetGroupCollections) IsSortable(column string) bool
func (AssetGroupCollections) ValidFilters ¶
func (s AssetGroupCollections) ValidFilters() map[string][]FilterOperator
type AssetGroupExpansionMethod ¶
type AssetGroupExpansionMethod int
const ( AssetGroupExpansionMethodNone AssetGroupExpansionMethod = 0 AssetGroupExpansionMethodAll AssetGroupExpansionMethod = 1 AssetGroupExpansionMethodChildren AssetGroupExpansionMethod = 2 AssetGroupExpansionMethodParents AssetGroupExpansionMethod = 3 )
type AssetGroupHistory ¶
type AssetGroupHistory struct {
ID int64 `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at"`
Actor string `json:"actor"`
Email null.String `json:"email"`
Action AssetGroupHistoryAction `json:"action"`
Target string `json:"target"`
AssetGroupTagId int `json:"asset_group_tag_id"`
EnvironmentId null.String `json:"environment_id"`
Note null.String `json:"note"`
}
AssetGroupHistory is the record of CRUD changes associated with v2 of the asset groups feature
func (AssetGroupHistory) AuditData ¶
func (s AssetGroupHistory) AuditData() AuditData
func (AssetGroupHistory) IsSortable ¶
func (s AssetGroupHistory) IsSortable(criteria string) bool
func (AssetGroupHistory) IsStringColumn ¶
func (s AssetGroupHistory) IsStringColumn(filter string) bool
func (AssetGroupHistory) TableName ¶
func (AssetGroupHistory) TableName() string
func (AssetGroupHistory) ValidFilters ¶
func (s AssetGroupHistory) ValidFilters() map[string][]FilterOperator
type AssetGroupHistoryAction ¶
type AssetGroupHistoryAction string
const ( AssetGroupHistoryActionCreateTag AssetGroupHistoryAction = "CreateTag" AssetGroupHistoryActionUpdateTag AssetGroupHistoryAction = "UpdateTag" AssetGroupHistoryActionDeleteTag AssetGroupHistoryAction = "DeleteTag" AssetGroupHistoryActionAnalysisEnabledTag AssetGroupHistoryAction = "AnalysisEnabledTag" AssetGroupHistoryActionAnalysisDisabledTag AssetGroupHistoryAction = "AnalysisDisabledTag" AssetGroupHistoryActionCreateSelector AssetGroupHistoryAction = "CreateSelector" AssetGroupHistoryActionUpdateSelector AssetGroupHistoryAction = "UpdateSelector" AssetGroupHistoryActionDeleteSelector AssetGroupHistoryAction = "DeleteSelector" AssetGroupHistoryActionCertifyNodeAuto AssetGroupHistoryAction = "CertifyNodeAuto" AssetGroupHistoryActionCertifyNodeManual AssetGroupHistoryAction = "CertifyNodeManual" AssetGroupHistoryActionCertifyNodeRevoked AssetGroupHistoryAction = "CertifyNodeRevoked" )
func ToAssetGroupHistoryActionFromAssetGroupCertification ¶
func ToAssetGroupHistoryActionFromAssetGroupCertification(certifyValue AssetGroupCertification) AssetGroupHistoryAction
type AssetGroupSelector ¶
type AssetGroupSelector struct {
AssetGroupID int32 `json:"asset_group_id" gorm:"UNIQUE_INDEX:compositeindex"`
Name string `json:"name" gorm:"UNIQUE_INDEX:compositeindex"`
Selector string `json:"selector"`
SystemSelector bool `json:"system_selector"`
Serial
}
func (AssetGroupSelector) AuditData ¶
func (s AssetGroupSelector) AuditData() AuditData
type AssetGroupSelectorNode ¶
type AssetGroupSelectorNode struct {
SelectorId int `json:"selector_id"`
NodeId graph.ID `json:"node_id"`
Certified AssetGroupCertification `json:"certified"`
CertifiedBy null.String `json:"certified_by"`
Source AssetGroupSelectorNodeSource `json:"source"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
NodePrimaryKind string `json:"node_primary_kind"`
NodeEnvironmentId string `json:"node_environment_id"`
NodeObjectId string `json:"node_object_id"`
NodeName string `json:"node_name"`
}
func (AssetGroupSelectorNode) IsStringColumn ¶
func (s AssetGroupSelectorNode) IsStringColumn(filter string) bool
func (AssetGroupSelectorNode) TableName ¶
func (s AssetGroupSelectorNode) TableName() string
func (AssetGroupSelectorNode) ValidFilters ¶
func (s AssetGroupSelectorNode) ValidFilters() map[string][]FilterOperator
type AssetGroupSelectorNodeExpanded ¶
type AssetGroupSelectorNodeExpanded struct {
AssetGroupSelectorNode
AssetGroupTagId int `json:"asset_group_tag_id"`
Position int `json:"position"`
}
type AssetGroupSelectorNodeSource ¶
type AssetGroupSelectorNodeSource int
const ( AssetGroupSelectorNodeSourceSeed AssetGroupSelectorNodeSource = 1 AssetGroupSelectorNodeSourceChild AssetGroupSelectorNodeSource = 2 AssetGroupSelectorNodeSourceParent AssetGroupSelectorNodeSource = 3 )
type AssetGroupSelectorNodes ¶
type AssetGroupSelectorNodes []AssetGroupSelectorNode
type AssetGroupSelectorSpec ¶
type AssetGroupSelectorSpec struct {
SelectorName string `json:"selector_name"`
EntityObjectID string `json:"sid"`
Action string `json:"action"`
}
func (AssetGroupSelectorSpec) AuditData ¶
func (s AssetGroupSelectorSpec) AuditData() AuditData
func (AssetGroupSelectorSpec) Validate ¶
func (s AssetGroupSelectorSpec) Validate() error
type AssetGroupSelectors ¶
type AssetGroupSelectors []AssetGroupSelector
func (AssetGroupSelectors) Strings ¶
func (s AssetGroupSelectors) Strings() []string
type AssetGroupTag ¶
type AssetGroupTag struct {
ID int `json:"id"`
Type AssetGroupTagType `json:"type" validate:"required"`
KindId int `json:"kind_id"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
CreatedAt time.Time `json:"created_at"`
CreatedBy string `json:"created_by"`
UpdatedAt time.Time `json:"updated_at"`
UpdatedBy string `json:"updated_by"`
DeletedAt null.Time `json:"deleted_at"`
DeletedBy null.String `json:"deleted_by"`
Position null.Int32 `json:"position"`
RequireCertify null.Bool `json:"require_certify"`
AnalysisEnabled null.Bool `json:"analysis_enabled"`
Glyph null.String `json:"glyph"`
}
func (AssetGroupTag) AuditData ¶
func (s AssetGroupTag) AuditData() AuditData
func (AssetGroupTag) GetExpansionMethod ¶
func (s AssetGroupTag) GetExpansionMethod() AssetGroupExpansionMethod
func (AssetGroupTag) IsStringColumn ¶
func (s AssetGroupTag) IsStringColumn(filter string) bool
func (AssetGroupTag) IsTierZero ¶
func (s AssetGroupTag) IsTierZero() bool
func (AssetGroupTag) KindName ¶
func (s AssetGroupTag) KindName() string
func (AssetGroupTag) TableName ¶
func (AssetGroupTag) TableName() string
func (AssetGroupTag) ToKind ¶
func (s AssetGroupTag) ToKind() graph.Kind
func (AssetGroupTag) ToType ¶
func (s AssetGroupTag) ToType() string
func (AssetGroupTag) ValidFilters ¶
func (s AssetGroupTag) ValidFilters() map[string][]FilterOperator
type AssetGroupTagCounts ¶
type AssetGroupTagCountsMap ¶
type AssetGroupTagCountsMap map[int]AssetGroupTagCounts
type AssetGroupTagSelector ¶
type AssetGroupTagSelector struct {
ID int `json:"id"`
AssetGroupTagId int `json:"asset_group_tag_id"`
CreatedAt time.Time `json:"created_at"`
CreatedBy string `json:"created_by"`
UpdatedAt time.Time `json:"updated_at"`
UpdatedBy string `json:"updated_by"`
DisabledAt null.Time `json:"disabled_at"`
DisabledBy null.String `json:"disabled_by"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
AutoCertify SelectorAutoCertifyMethod `json:"auto_certify"`
IsDefault bool `json:"is_default"`
AllowDisable bool `json:"allow_disable"`
RuleKey null.String `json:"rule_key"`
ExtensionId null.Int32 `json:"extension_id"`
Seeds []SelectorSeed `json:"seeds,omitempty" validate:"required" gorm:"-"`
}
func (AssetGroupTagSelector) AuditData ¶
func (s AssetGroupTagSelector) AuditData() AuditData
func (AssetGroupTagSelector) IsSortable ¶
func (s AssetGroupTagSelector) IsSortable(criteria string) bool
func (AssetGroupTagSelector) IsStringColumn ¶
func (s AssetGroupTagSelector) IsStringColumn(filter string) bool
func (AssetGroupTagSelector) TableName ¶
func (AssetGroupTagSelector) TableName() string
func (AssetGroupTagSelector) ValidFilters ¶
func (s AssetGroupTagSelector) ValidFilters() map[string][]FilterOperator
type AssetGroupTagSelectors ¶
type AssetGroupTagSelectors []AssetGroupTagSelector
type AssetGroupTagType ¶
type AssetGroupTagType int
const ( AssetGroupTagTypeTier AssetGroupTagType = 1 AssetGroupTagTypeLabel AssetGroupTagType = 2 AssetGroupTagTypeOwned AssetGroupTagType = 3 )
type AssetGroupTags ¶
type AssetGroupTags []AssetGroupTag
type AssetGroups ¶
type AssetGroups []AssetGroup
func (AssetGroups) FindByName ¶
func (s AssetGroups) FindByName(name string) (AssetGroup, bool)
func (AssetGroups) GetFilterableColumns ¶
func (s AssetGroups) GetFilterableColumns() []string
func (AssetGroups) GetValidFilterPredicatesAsStrings ¶
func (s AssetGroups) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
func (AssetGroups) IsSortable ¶
func (s AssetGroups) IsSortable(column string) bool
func (AssetGroups) IsString ¶
func (s AssetGroups) IsString(column string) bool
func (AssetGroups) ValidFilters ¶
func (s AssetGroups) ValidFilters() map[string][]FilterOperator
type AuditEntry ¶
type AuditEntry struct {
CommitID uuid.UUID
Action AuditLogAction
Model Auditable
Status AuditLogEntryStatus
ErrorMsg string
}
func NewAuditEntry ¶
func NewAuditEntry(action AuditLogAction, status AuditLogEntryStatus, data AuditData) (AuditEntry, error)
func (AuditEntry) Matches ¶
func (s AuditEntry) Matches(x any) bool
Necessary function for testing. Ensures all fields except CommitID match so mocking checks pass.
func (AuditEntry) String ¶
func (s AuditEntry) String() string
type AuditLog ¶
type AuditLog struct {
ID int64 `json:"id" gorm:"primaryKey"`
CreatedAt time.Time `json:"created_at" gorm:"index"`
ActorID string `json:"actor_id" gorm:"index"`
ActorName string `json:"actor_name"`
ActorEmail string `json:"actor_email"`
Action AuditLogAction `json:"action" gorm:"index"`
Fields types.JSONUntypedObject `json:"fields"`
RequestID string `json:"request_id"`
SourceIpAddress string `json:"source_ip_address"`
Status AuditLogEntryStatus `json:"status"`
CommitID uuid.UUID `json:"commit_id" gorm:"type:text"`
}
TODO embed Basic into this struct instead of declaring the ID and CreatedAt fields. This will require a migration
type AuditLogAction ¶
type AuditLogAction string
const ( AuditLogActionAcceptEULA AuditLogAction = "AcceptEULA" AuditLogActionAcceptFedEULA AuditLogAction = "AcceptFedEULA" // INFO: The FedEULA is only applicable to select enterprise installations AuditLogActionLoginAttempt AuditLogAction = "LoginAttempt" AuditLogActionCreateUser AuditLogAction = "CreateUser" AuditLogActionUpdateUser AuditLogAction = "UpdateUser" AuditLogActionDeleteUser AuditLogAction = "DeleteUser" AuditLogActionCreateAssetGroup AuditLogAction = "CreateAssetGroup" AuditLogActionUpdateAssetGroup AuditLogAction = "UpdateAssetGroup" AuditLogActionDeleteAssetGroup AuditLogAction = "DeleteAssetGroup" AuditLogActionDeleteAssetGroupSelector AuditLogAction = "DeleteAssetGroupSelector" AuditLogActionCreateAuthToken AuditLogAction = "CreateAuthToken" AuditLogActionUpdateAuthTokenExpiration AuditLogAction = "UpdateAuthTokenExpiration" AuditLogActionDeleteExpiredAuthTokens AuditLogAction = "DeleteExpiredAuthTokens" AuditLogActionDeleteAuthToken AuditLogAction = "DeleteAuthToken" AuditLogActionDeleteAllAuthTokens AuditLogAction = "DeleteAllAuthTokens" AuditLogActionCreateAuthSecret AuditLogAction = "CreateAuthSecret" AuditLogActionUpdateAuthSecret AuditLogAction = "UpdateAuthSecret" AuditLogActionDeleteAuthSecret AuditLogAction = "DeleteAuthSecret" AuditLogActionCreateSAMLIdentityProvider AuditLogAction = "CreateSAMLIdentityProvider" AuditLogActionUpdateSAMLIdentityProvider AuditLogAction = "UpdateSAMLIdentityProvider" AuditLogActionCreateOIDCIdentityProvider AuditLogAction = "CreateOIDCIdentityProvider" AuditLogActionUpdateOIDCIdentityProvider AuditLogAction = "UpdateOIDCIdentityProvider" AuditLogActionCreateSSOIdentityProvider AuditLogAction = "CreateSSOIdentityProvider" AuditLogActionUpdateSSOIdentityProvider AuditLogAction = "UpdateSSOIdentityProvider" AuditLogActionDeleteSSOIdentityProvider AuditLogAction = "DeleteSSOIdentityProvider" AuditLogActionAcceptRisk AuditLogAction = "AcceptRisk" AuditLogActionUnacceptRisk AuditLogAction = "UnacceptRisk" AuditLogActionUpdateFindingStatus AuditLogAction = "UpdateFindingStatus" AuditLogActionExportRelationshipRisks AuditLogAction = "ExportRelationshipRisks" AuditLogActionExportListRisks AuditLogAction = "ExportListRisks" AuditLogActionExportAllRisks AuditLogAction = "ExportAllRisks" AuditLogActionDeleteBloodhoundData AuditLogAction = "DeleteBloodhoundData" AuditLogActionMutateGraph AuditLogAction = "MutateGraph" AuditLogActionUpdateParameter AuditLogAction = "UpdateParameter" AuditLogActionCreateAssetGroupTag AuditLogAction = "CreateAssetGroupTag" AuditLogActionUpdateAssetGroupTag AuditLogAction = "UpdateAssetGroupTag" AuditLogActionDeleteAssetGroupTag AuditLogAction = "DeleteAssetGroupTag" AuditLogActionCreateAssetGroupTagSelector AuditLogAction = "CreateAssetGroupTagSelector" AuditLogActionUpdateAssetGroupTagSelector AuditLogAction = "UpdateAssetGroupTagSelector" AuditLogActionDeleteAssetGroupTagSelector AuditLogAction = "DeleteAssetGroupTagSelector" AuditLogActionCreateCustomNodeKind AuditLogAction = "CreateCustomNodeKind" AuditLogActionUpdateCustomNodeKind AuditLogAction = "UpdateCustomNodeKind" AuditLogActionDeleteCustomNodeKind AuditLogAction = "DeleteCustomNodeKind" AuditLogActionToggleEarlyAccessFeatureFlag AuditLogAction = "ToggleEarlyAccessFeatureFlag" AuditLogActionCreateClient AuditLogAction = "CreateClient" AuditLogActionDeleteClient AuditLogAction = "DeleteClient" AuditLogActionReplaceClientToken AuditLogAction = "ReplaceClientToken" AuditLogActionUpdateClient AuditLogAction = "UpdateClient" AuditLogActionStartClientJob AuditLogAction = "StartClientJob" AuditLogActionImportSavedQuery AuditLogAction = "ImportSavedQueries" AuditLogActionExportSavedQuery AuditLogAction = "ExportSavedQuery" AuditLogActionExportSavedQueries AuditLogAction = "ExportSavedQueries" AuditLogActionUpdateETACList AuditLogAction = "UpdateETACList" AuditLogActionDeleteETACList AuditLogAction = "DeleteETACList" AuditLogActionCreateGraphSchemaExtension AuditLogAction = "CreateGraphSchemaExtension" AuditLogActionDeleteGraphSchemaExtension AuditLogAction = "DeleteGraphSchemaExtension" AuditLogActionCreateSupportUserSessionAttempt AuditLogAction = "CreateSupportUserSessionAttempt" AuditLogActionInvalidateSupportUserSession AuditLogAction = "InvalidateSupportUserSession" AuditLogActionInvalidateAllSupportUserSessions AuditLogAction = "InvalidateAllSupportUserSessions" AuditLogActionRunCypherQuery AuditLogAction = "RunCypherQuery" AuditLogActionCreateAlertWebhook AuditLogAction = "CreateAlertWebhook" AuditLogActionUpdateAlertWebhook AuditLogAction = "UpdateAlertWebhook" AuditLogActionDeleteAlertWebhook AuditLogAction = "DeleteAlertWebhook" AuditLogActionRotateAlertWebhookSecret AuditLogAction = "RotateAlertWebhookSecret" )
type AuditLogEntryStatus ¶
type AuditLogEntryStatus string
const ( AuditLogStatusSuccess AuditLogEntryStatus = "success" AuditLogStatusFailure AuditLogEntryStatus = "failure" AuditLogStatusIntent AuditLogEntryStatus = "intent" )
type AuditLogs ¶
type AuditLogs []AuditLog
func (AuditLogs) GetFilterableColumns ¶
func (AuditLogs) GetValidFilterPredicatesAsStrings ¶
func (AuditLogs) IsSortable ¶
func (AuditLogs) ValidFilters ¶
func (s AuditLogs) ValidFilters() map[string][]FilterOperator
type AuditableURL ¶
type AuditableURL string
func (AuditableURL) AuditData ¶
func (s AuditableURL) AuditData() AuditData
type AuthSecret ¶
type AuthSecret struct {
UserID uuid.UUID `json:"-"`
Digest string `json:"-"`
DigestMethod string `json:"digest_method"`
ExpiresAt time.Time `json:"expires_at"`
TOTPSecret string `json:"-"`
TOTPActivated bool `json:"totp_activated"`
Serial
}
func (AuthSecret) AuditData ¶
func (s AuthSecret) AuditData() AuditData
func (AuthSecret) Expired ¶
func (s AuthSecret) Expired() bool
Expired returns true if the auth secret has expired, false otherwise
type AuthToken ¶
type AuthToken struct {
UserID uuid.NullUUID `json:"user_id" gorm:"type:text"`
ClientID uuid.NullUUID `json:"-" gorm:"type:text"`
Name null.String `json:"name"`
Key string `json:"key,omitempty"`
HmacMethod string `json:"hmac_method"`
LastAccess time.Time `json:"last_access"`
ExpiresAt sql.NullTime `json:"expires_at"`
CreatedBy uuid.NullUUID `json:"created_by" gorm:"type:text"`
Unique
}
type AuthTokens ¶
type AuthTokens []AuthToken
func (AuthTokens) GetFilterableColumns ¶
func (s AuthTokens) GetFilterableColumns() []string
func (AuthTokens) GetValidFilterPredicatesAsStrings ¶
func (s AuthTokens) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
func (AuthTokens) IDs ¶
func (s AuthTokens) IDs() []uuid.UUID
func (AuthTokens) IsSortable ¶
func (s AuthTokens) IsSortable(column string) bool
func (AuthTokens) IsString ¶
func (s AuthTokens) IsString(column string) bool
func (AuthTokens) StripKeys ¶
func (s AuthTokens) StripKeys() AuthTokens
func (AuthTokens) ValidFilters ¶
func (s AuthTokens) ValidFilters() map[string][]FilterOperator
type AzureDataQualityAggregation ¶
type AzureDataQualityAggregation struct {
Serial
AzureStatKinds
RunID string `json:"run_id" gorm:"index"`
Tenants int `json:"tenants"`
}
type AzureDataQualityAggregations ¶
type AzureDataQualityAggregations []AzureDataQualityAggregation
type AzureDataQualityStat ¶
type AzureDataQualityStat struct {
Serial
AzureStatKinds
RunID string `json:"run_id" gorm:"index"`
TenantID string `json:"tenantid" gorm:"column:tenant_id"`
}
type AzureDataQualityStats ¶
type AzureDataQualityStats []AzureDataQualityStat
func (AzureDataQualityStats) IsSortable ¶
func (s AzureDataQualityStats) IsSortable(column string) bool
type AzureStatKinds ¶
type AzureStatKinds struct {
Relationships int `json:"relationships"`
Users int `json:"users"`
Groups int `json:"groups"`
Apps int `json:"apps"`
ServicePrincipals int `json:"service_principals"`
Devices int `json:"devices"`
ManagementGroups int `json:"management_groups"`
Subscriptions int `json:"subscriptions"`
ResourceGroups int `json:"resource_groups"`
VMs int `json:"vms"`
KeyVaults int `json:"key_vaults"`
AutomationAccounts int `json:"automation_accounts"`
ContainerRegistries int `json:"container_registries"`
FunctionApps int `json:"function_apps"`
LogicApps int `json:"logic_apps"`
ManagedClusters int `json:"managed_clusters"`
VMScaleSets int `json:"vm_scale_sets"`
WebApps int `json:"web_apps"`
}
type BaseADEntity ¶
type Basic ¶
type Basic struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt sql.NullTime `json:"deleted_at" gorm:"-"`
}
Basic is a struct which includes the following basic fields: CreatedAt, UpdatedAt, DeletedAt.
type BigSerial ¶
BigSerial is a struct that follows the same design principles as Serial but with one exception: the ID type is set to int64 to support an ID sequence limit of up to 9223372036854775807.
type CompletedTask ¶
type CompletedTask struct {
IngestJobId int64 `json:"ingest_job_id"`
FileName string `json:"file_name"`
ParentFileName string `json:"parent_file_name"`
Errors pq.StringArray `json:"errors" gorm:"type:text[]"`
Warnings pq.StringArray `json:"warnings" gorm:"type:text[]"`
BigSerial
}
type CustomNodeKind ¶
type CustomNodeKind struct {
ID int32 `json:"id"`
KindId int16 `json:"kindId"` // FK to kind.id; stored column
KindName string `json:"kindName"` // joined from kind.name; not a stored column
SchemaNodeKindId *int32 `json:"-"` // SchemaNodeKindId is nullable
Config CustomNodeKindConfig `json:"config"`
}
func (CustomNodeKind) AuditData ¶
func (s CustomNodeKind) AuditData() AuditData
func (CustomNodeKind) TableName ¶
func (s CustomNodeKind) TableName() string
type CustomNodeKindConfig ¶
type CustomNodeKindConfig struct {
Icon graphschema.DisplayNodeIcon `json:"icon"`
}
func (*CustomNodeKindConfig) Scan ¶
func (s *CustomNodeKindConfig) Scan(value any) error
func (CustomNodeKindConfig) Validate ¶
func (s CustomNodeKindConfig) Validate() error
type CustomNodeKindMap ¶
type CustomNodeKindMap map[string]CustomNodeKindConfig
type CustomNodeKindType ¶
type CustomNodeKindType string
type CustomNodeKinds ¶
type CustomNodeKinds []CustomNodeKind
func (CustomNodeKinds) AuditData ¶
func (s CustomNodeKinds) AuditData() AuditData
type DataQualityAggregation ¶
type DataQualityAggregation struct {
RunID string `json:"run_id"`
SchemaExtensionID int32 `json:"extension_id"`
SchemaEnvironmentKindID int32 `json:"environment_kind_id"`
MetricType DataQualityMetricType `json:"metric_type"`
MetricName string `json:"metric_name"`
MetricValue float64 `json:"metric_value"`
KindID null.Int32 `json:"kind_id"`
Serial
}
DataQualityAggregation represent a single aggregated data quality metric for a custom OpenGraph schema, combined across environment instances for one collection run.
func (DataQualityAggregation) TableName ¶
func (s DataQualityAggregation) TableName() string
type DataQualityAggregations ¶
type DataQualityAggregations []DataQualityAggregation
func (DataQualityAggregations) IsSortable ¶
func (s DataQualityAggregations) IsSortable(column string) bool
type DataQualityMetricType ¶
type DataQualityMetricType string
const ( DataQualityMetricTypeNode DataQualityMetricType = "node" DataQualityMetricTypeRelationship DataQualityMetricType = "relationship" )
type DataQualityStat ¶
type DataQualityStat struct {
Serial
RunID string `json:"run_id"`
SchemaExtensionID int32 `json:"extension_id"`
SchemaEnvironmentKindID int32 `json:"environment_kind_id"`
EnvironmentID string `json:"environment_id"`
MetricType DataQualityMetricType `json:"metric_type"`
MetricName string `json:"metric_name"`
MetricValue float64 `json:"metric_value"`
KindID null.Int32 `json:"kind_id"`
}
func (DataQualityStat) TableName ¶
func (DataQualityStat) TableName() string
type DataQualityStats ¶
type DataQualityStats []DataQualityStat
func (DataQualityStats) IsSortable ¶
func (s DataQualityStats) IsSortable(column string) bool
type DatapipeStatus ¶
type DatapipeStatus string
const ( DatapipeStatusIdle DatapipeStatus = "idle" DatapipeStatusIngesting DatapipeStatus = "ingesting" DatapipeStatusAnalyzing DatapipeStatus = "analyzing" DatapipeStatusPurging DatapipeStatus = "purging" DatapipeStatusPruning DatapipeStatus = "pruning" DatapipeStatusStarting DatapipeStatus = "starting" DatapipeStatusOptimizing DatapipeStatus = "optimizing" )
func AllDatapipeStatuses ¶
func AllDatapipeStatuses() []DatapipeStatus
func (DatapipeStatus) TableName ¶
func (DatapipeStatus) TableName() string
type DatapipeStatusWrapper ¶
type DatapipeStatusWrapper struct {
Status DatapipeStatus `json:"status"`
UpdatedAt time.Time `json:"updated_at"`
LastCompleteAnalysisAt time.Time `json:"last_complete_analysis_at"`
LastAnalysisRunAt time.Time `json:"last_analysis_run_at"`
LastCompleteOptimizeAt time.Time `json:"last_complete_optimize_at"`
NextScheduledAnalysisAt null.Time `json:"next_scheduled_analysis_at"`
}
type DomainCacheEntry ¶
DomainCacheEntry is used to store necessary domain properties for hydration
type EdgeCompositionEdge ¶
These structs were created for the new edge composition model, but are being saved for later use, since it doesn't work with our current post implementation
type EdgeCompositionEdges ¶
type EdgeCompositionEdges []EdgeCompositionEdge
type EdgeCompositionNode ¶
type EdgeCompositionNodes ¶
type EdgeCompositionNodes []EdgeCompositionNode
type EnvironmentInput ¶
type EnvironmentKindsToEnvironment ¶
type EnvironmentKindsToEnvironment map[string]SchemaEnvironment
type EnvironmentPayload ¶
type EnvironmentProperties ¶
type EnvironmentSelector ¶
type EnvironmentSelector struct {
EnvironmentProperties
Name string `json:"name"`
ObjectID string `json:"id"`
Collected bool `json:"collected"`
ImpactValue *int `json:"impactValue,omitempty"`
HygieneAttackPaths *int64 `json:"hygiene_attack_paths,omitempty"` // caution: if value is bigger than maxsafeint, the UI will truncate the value
Exposures Exposures `json:"exposures,omitempty"`
}
type EnvironmentSelectors ¶
type EnvironmentSelectors []EnvironmentSelector
func (EnvironmentSelectors) GetFilterCriteria ¶
func (EnvironmentSelectors) GetFilterableColumns ¶
func (s EnvironmentSelectors) GetFilterableColumns() []string
func (EnvironmentSelectors) GetValidFilterPredicatesAsStrings ¶
func (s EnvironmentSelectors) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
func (EnvironmentSelectors) IsSortable ¶
func (s EnvironmentSelectors) IsSortable(column string) bool
func (EnvironmentSelectors) IsString ¶
func (s EnvironmentSelectors) IsString(column string) bool
func (EnvironmentSelectors) ValidFilters ¶
func (s EnvironmentSelectors) ValidFilters() map[string][]FilterOperator
type EnvironmentTargetedAccessControl ¶
type EnvironmentTargetedAccessControl struct {
UserID string `json:"user_id"`
EnvironmentID string `json:"environment_id"`
BigSerial
}
EnvironmentTargetedAccessControl defines the model for a row in the environment_targeted_access_control table
func (EnvironmentTargetedAccessControl) TableName ¶
func (EnvironmentTargetedAccessControl) TableName() string
type EnvironmentsInput ¶
type EnvironmentsInput []EnvironmentInput
type Exposure ¶
type Exposure struct {
ExposurePercent int `json:"exposure_percent"`
AssetGroupTag AssetGroupTag `json:"asset_group_tag"`
}
type ExtensionInput ¶
type ExtensionInput struct {
Name string
DisplayName string
Version string
Namespace string // the required extension prefix for node and edge kind names
}
func (ExtensionInput) GetDisplayName ¶
func (s ExtensionInput) GetDisplayName() string
type Filter ¶
type Filter struct {
Operator FilterOperator
Value string
SetOperator FilterSetOperator
IsStringData bool
}
type FilterOperator ¶
type FilterOperator string
const ( GreaterThan FilterOperator = "gt" GreaterThanOrEquals FilterOperator = "gte" LessThan FilterOperator = "lt" LessThanOrEquals FilterOperator = "lte" Equals FilterOperator = "eq" NotEquals FilterOperator = "neq" ApproximatelyEquals FilterOperator = "~eq" NullString = "null" TrueString = "true" FalseString = "false" )
func ParseFilterOperator ¶
func ParseFilterOperator(raw string) (FilterOperator, error)
type FilterSetOperator ¶
type FilterSetOperator string
const ( FilterAnd FilterSetOperator = "AND" FilterOr FilterSetOperator = "OR" )
type Filtered ¶
type Filtered interface {
ValidFilters() map[string][]FilterOperator
}
type GraphExtensionInput ¶
type GraphExtensionInput struct {
ExtensionInput ExtensionInput
RelationshipKindsInput RelationshipsInput
NodeKindsInput NodesInput
EnvironmentsInput EnvironmentsInput
RelationshipFindingsInput RelationshipFindingsInput
PZRulesInput PZRulesInput
SavedQueriesInput SavedQueriesInput
}
func (GraphExtensionInput) Validate ¶
func (s GraphExtensionInput) Validate() error
Validate performs comprehensive validation on a GraphExtensionInput
type GraphExtensionPayload ¶
type GraphExtensionPayload struct {
GraphSchemaExtension GraphSchemaExtensionPayload `json:"schema"`
GraphSchemaRelationshipKinds []GraphSchemaRelationshipKindsPayload `json:"relationship_kinds"`
GraphSchemaNodeKinds []GraphSchemaNodeKindsPayload `json:"node_kinds"`
GraphEnvironments []EnvironmentPayload `json:"environments"`
GraphRelationshipFindings []RelationshipFindingsPayload `json:"relationship_findings"`
SavedQueries *SavedQueriesPayload `json:"queries,omitempty"`
PZRules *PZRulesPayload `json:"pz_rules,omitempty"`
}
GraphExtensionPayload is the JSON format for graph extension upserts, shared by both the HTTP upload handler (api/v2) and the filesystem-based embedded extension loader. It deserializes snake_case JSON and converts into the service-layer GraphExtensionInput via ToGraphExtensionInput.
func (GraphExtensionPayload) ToGraphExtensionInput ¶
func (s GraphExtensionPayload) ToGraphExtensionInput() (GraphExtensionInput, error)
ToGraphExtensionInput converts the GraphExtensionPayload model to the service-layer GraphExtensionInput.
type GraphExtensionUpsertResult ¶
type GraphExtensionUpsertResult struct {
ExtensionExisted bool // indicates whether the extension was created or updated, used when determining appropriate API response
Extension GraphSchemaExtension // Persisted graph schema extension record used for logging
NodeKindsResult ReconcileResult[GraphSchemaNodeKind]
RelationshipKindsResult ReconcileResult[GraphSchemaRelationshipKind]
KindInfosResult ReconcileResult[GraphSchemaKindInfo]
EnvironmentsResult ReconcileResult[SchemaEnvironment]
RelationshipFindingsResult ReconcileResult[SchemaFinding]
SavedQueriesResult ReconcileResult[SavedQuery]
PZRulesResult ReconcileResult[AssetGroupTagSelector]
}
GraphExtensionUpsertResult contains the persisted extension and entity outcomes from an extension upsert.
type GraphMigration ¶
func (GraphMigration) Version ¶
func (s GraphMigration) Version() version.Version
type GraphSchemaExtension ¶
type GraphSchemaExtension struct {
Serial
Name string
DisplayName string
Version string
IsBuiltin bool
Namespace string
}
func (GraphSchemaExtension) AuditData ¶
func (s GraphSchemaExtension) AuditData() AuditData
func (GraphSchemaExtension) TableName ¶
func (GraphSchemaExtension) TableName() string
type GraphSchemaExtensions ¶
type GraphSchemaExtensions []GraphSchemaExtension
type GraphSchemaKindInfo ¶
type GraphSchemaKindInfo struct {
ID int32
KindID int32
NodeKindID *int32
RelationshipKindID *int32
InfoKey string
Title string
Position int32
Content json.RawMessage
CreatedAt null.Time
UpdatedAt null.Time
}
GraphSchemaKindInfo is the storage-layer shape of an entity panel
type GraphSchemaNodeKind ¶
type GraphSchemaNodeKind struct {
Serial
KindId int32 // DAWGS kind table ID
Name string
SchemaExtensionId int32 // indicates which extension this node kind belongs to
DisplayName string // can be different from name but usually isn't other than Base/Entity
Description string // human-readable description of the node kind
IsDisplayKind bool // indicates if this kind should supersede others and be displayed
Icon string // font-awesome icon for the registered node kind
IconColor string // icon hex color
}
GraphSchemaNodeKind - represents a node kind for an extension
func (GraphSchemaNodeKind) TableName ¶
func (GraphSchemaNodeKind) TableName() string
TableName - Retrieve table name
func (GraphSchemaNodeKind) ToKind ¶
func (s GraphSchemaNodeKind) ToKind() graph.Kind
type GraphSchemaNodeKinds ¶
type GraphSchemaNodeKinds []GraphSchemaNodeKind
GraphSchemaNodeKinds - slice of node kinds
type GraphSchemaNodeKindsPayload ¶
type GraphSchemaNodeKindsPayload struct {
Name string `json:"name"`
DisplayName string `json:"display_name"` // can be different from name but usually isn't other than Base/Entity
Description string `json:"description"` // human-readable description of the node kind
IsDisplayKind bool `json:"is_display_kind"` // indicates if this kind should supersede others and be displayed
Icon string `json:"icon"` // font-awesome icon for the registered node kind
IconColor string `json:"color"` // icon hex color
Info map[string]KindInfoPayload `json:"info"`
}
type GraphSchemaProperties ¶
type GraphSchemaProperties []GraphSchemaProperty
GraphSchemaProperties - slice of graph schema properties.
type GraphSchemaProperty ¶
type GraphSchemaProperty struct {
Serial
SchemaExtensionId int32
Name string
DisplayName string
DataType string
Description string
}
GraphSchemaProperty - represents a property that an relationship or node kind can have. Grouped by schema extension.
func (GraphSchemaProperty) TableName ¶
func (GraphSchemaProperty) TableName() string
type GraphSchemaRelationshipKind ¶
type GraphSchemaRelationshipKind struct {
Serial
SchemaExtensionId int32 // indicates which extension this relationship kind belongs to
KindId int32
Name string
Description string
IsTraversable bool // indicates whether the relationship-kind is a traversable path
}
GraphSchemaRelationshipKind - represents an relationship kind for an extension
func (GraphSchemaRelationshipKind) IsStringColumn ¶
func (GraphSchemaRelationshipKind) IsStringColumn(filter string) bool
func (GraphSchemaRelationshipKind) TableName ¶
func (GraphSchemaRelationshipKind) TableName() string
func (GraphSchemaRelationshipKind) ToKind ¶
func (s GraphSchemaRelationshipKind) ToKind() graph.Kind
func (GraphSchemaRelationshipKind) ValidFilters ¶
func (GraphSchemaRelationshipKind) ValidFilters() map[string][]FilterOperator
type GraphSchemaRelationshipKinds ¶
type GraphSchemaRelationshipKinds []GraphSchemaRelationshipKind
GraphSchemaRelationshipKinds - slice of model.GraphSchemaRelationshipKind
type GraphSchemaRelationshipKindsPayload ¶
type GraphSchemaRelationshipKindsPayload struct {
Name string `json:"name"`
Description string `json:"description"`
IsTraversable bool `json:"is_traversable"` // indicates whether the edge-kind is a traversable path
Info map[string]KindInfoPayload `json:"info"`
}
type GraphSchemaRelationshipKindsWithNamedSchema ¶
type GraphSchemaRelationshipKindsWithNamedSchema []GraphSchemaRelationshipKindWithNamedSchema
type IngestJob ¶
type IngestJob struct {
UserID uuid.NullUUID `json:"user_id"`
UserEmailAddress null.String `json:"user_email_address"`
User User `json:"-"`
Status JobStatus `json:"status"`
StatusMessage string `json:"status_message"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
LastIngest time.Time `json:"last_ingest"`
TotalFiles int `json:"total_files"`
FailedFiles int `json:"failed_files"`
PartialFailedFiles int `json:"partial_failed_files"`
BigSerial
}
type IngestJobs ¶
type IngestJobs []IngestJob
func (IngestJobs) GetFilterableColumns ¶
func (s IngestJobs) GetFilterableColumns() []string
func (IngestJobs) GetValidFilterPredicatesAsStrings ¶
func (s IngestJobs) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
func (IngestJobs) IsSortable ¶
func (s IngestJobs) IsSortable(column string) bool
func (IngestJobs) IsString ¶
func (s IngestJobs) IsString(column string) bool
func (IngestJobs) ValidFilters ¶
func (s IngestJobs) ValidFilters() map[string][]FilterOperator
type IngestTask ¶
type IngestTasks ¶
type IngestTasks []IngestTask
type Installation ¶
type Installation struct {
Unique
}
type JobStatus ¶
type JobStatus int
const ( JobStatusInvalid JobStatus = -1 JobStatusReady JobStatus = 0 JobStatusRunning JobStatus = 1 JobStatusComplete JobStatus = 2 JobStatusCanceled JobStatus = 3 JobStatusTimedOut JobStatus = 4 JobStatusFailed JobStatus = 5 JobStatusIngesting JobStatus = 6 JobStatusAnalyzing JobStatus = 7 JobStatusPartiallyComplete JobStatus = 8 )
func GetVisibleJobStatuses ¶
func GetVisibleJobStatuses() []JobStatus
func ParseJobStatus ¶
func (JobStatus) IsValidEndState ¶
type Kind ¶
func (Kind) ValidFilters ¶
func (k Kind) ValidFilters() map[string][]FilterOperator
type KindInfoInput ¶
type KindInfoInput struct {
InfoKey string
Title string
Position int32
Content json.RawMessage
}
KindInfoInput represents one entity panel definition as provided in a user's upload JSON
func (KindInfoInput) MarkdownContent ¶
func (s KindInfoInput) MarkdownContent() (string, error)
MarkdownContent extracts the inner markdown content string from the KindInfoInput's Content JSON ({"markdown":{"content":"..."}}). It returns ErrInvalidKindInfoContent if the content does not match the expected structure.
type KindInfoInputs ¶
type KindInfoInputs []KindInfoInput
represents a slice of entity panel definitions
type KindInfoPayload ¶
type KindInfoPayload struct {
Title string `json:"title"`
Position int `json:"position"`
Markdown json.RawMessage `json:"markdown"` // Raw: {"content": "..."}
}
type LegacyADOU ¶
type LegacyADOU struct {
BaseADEntity
DistinguishedName string `json:"dn"`
Type string `json:"type"`
}
type Migration ¶
type Migration struct {
ID int32 `gorm:"primaryKey"`
UpdatedAt time.Time
Major int32
Minor int32
Patch int32
}
func NewMigration ¶
type NodeInput ¶
type NodeInput struct {
Name string
DisplayName string // human-readable name
Description string // human-readable description of the node kind
IsDisplayKind bool // indicates if this kind should supersede others and be displayed
Icon string // font-awesome icon for the registered node kind
IconColor string // icon hex color
Info KindInfoInputs // entity panel definitions for this node kind
}
type NodesInput ¶
type NodesInput []NodeInput
type OIDCProvider ¶
type OIDCProvider struct {
ClientID string `json:"client_id"`
Issuer string `json:"issuer"`
SSOProviderID int `json:"sso_provider_id"`
Serial
}
OIDCProvider contains the data needed to initiate an OIDC secure login flow
func (OIDCProvider) AuditData ¶
func (s OIDCProvider) AuditData() AuditData
func (OIDCProvider) TableName ¶
func (OIDCProvider) TableName() string
type OUCacheEntry ¶
OUCacheEntry is used to store necessary OU properties for hydration
type PZRuleInput ¶
type PZRulePayload ¶
type PZRulePayload struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Seeds []SelectorSeedPayload `json:"seeds"`
RuleKey string `json:"key"`
Enabled *bool `json:"enabled,omitempty"`
AllowDisable *bool `json:"allow_disable,omitempty"`
}
PZRulePayload is the JSON shape of a single privilege-zone rule (asset group tag selector) within pz_rules.
type PZRulesInput ¶
type PZRulesInput []PZRuleInput
func (PZRulesInput) Validate ¶
func (s PZRulesInput) Validate(extensionNamespace string) error
Validate performs comprehensive validation on a PZRulesInput payload
type PZRulesPayload ¶
type PZRulesPayload []PZRulePayload
PZRulesPayload is the list of privilege-zone rules in the pz_rules component.
type PagedNodeListEntry ¶
type PaginatedResponse ¶
type PaginatedResponse struct {
Count int `json:"count"`
Limit int `json:"limit"`
Skip int `json:"skip"`
Data any `json:"data"`
}
PaginatedResponse has been DEPRECATED as part of V1. Please use api.ResponseWrapper instead
type Permission ¶
func NewPermission ¶
func NewPermission(authority, name string) Permission
func (Permission) Equals ¶
func (s Permission) Equals(other Permission) bool
func (Permission) String ¶
func (s Permission) String() string
func (Permission) URI ¶
func (s Permission) URI() *url.URL
type Permissions ¶
type Permissions []Permission
func (Permissions) Equals ¶
func (s Permissions) Equals(others Permissions) bool
func (Permissions) Has ¶
func (s Permissions) Has(other Permission) bool
type QueryParameterFilter ¶
type QueryParameterFilter struct {
Name string
Operator FilterOperator
Value string
IsStringData bool
SetOperator FilterSetOperator
}
func (QueryParameterFilter) BuildGDBNodeFilter ¶
func (s QueryParameterFilter) BuildGDBNodeFilter() graph.Criteria
type QueryParameterFilterMap ¶
type QueryParameterFilterMap map[string]QueryParameterFilters
func (QueryParameterFilterMap) AddFilter ¶
func (s QueryParameterFilterMap) AddFilter(filter QueryParameterFilter)
func (QueryParameterFilterMap) BuildAliasedSQLFilter ¶
func (QueryParameterFilterMap) BuildGDBNodeFilter ¶
func (s QueryParameterFilterMap) BuildGDBNodeFilter() graph.Criteria
func (QueryParameterFilterMap) BuildSQLFilter ¶
func (s QueryParameterFilterMap) BuildSQLFilter() (SQLFilter, error)
func (QueryParameterFilterMap) FirstFilter ¶
func (s QueryParameterFilterMap) FirstFilter(name string) (QueryParameterFilter, bool)
func (QueryParameterFilterMap) IsFiltered ¶
func (s QueryParameterFilterMap) IsFiltered(name string) bool
func (QueryParameterFilterMap) ToFiltersModel ¶
func (s QueryParameterFilterMap) ToFiltersModel() Filters
ToFiltersModel converts the query parameter filter map model into the newer, more generic filter model. This is useful when accessing newer functions that expect the newer model without having refactor multiple sites all-at-once.
type QueryParameterFilterParser ¶
type QueryParameterFilterParser struct {
// contains filtered or unexported fields
}
func NewQueryParameterFilterParser ¶
func NewQueryParameterFilterParser() QueryParameterFilterParser
func (QueryParameterFilterParser) ParseQueryParameterFilter ¶
func (s QueryParameterFilterParser) ParseQueryParameterFilter(name, value string) (QueryParameterFilter, error)
func (QueryParameterFilterParser) ParseQueryParameterFilters ¶
func (s QueryParameterFilterParser) ParseQueryParameterFilters(request *http.Request) (QueryParameterFilterMap, error)
type QueryParameterFilters ¶
type QueryParameterFilters []QueryParameterFilter
type ReconcileResult ¶
type ReconcileResult[T any] struct { Created []T Updated []T Deleted []T }
ReconcileResult represents the persisted outcome of reconciling a desired input collection against existing records. Slice ordering is not part of the contract.
type RelationshipFindingsInput ¶
type RelationshipFindingsInput []RelationshipFindingInput
type RelationshipFindingsPayload ¶
type RelationshipFindingsPayload struct {
Name string `json:"name"`
DisplayName string `json:"display_name"`
RelationshipKind string `json:"relationship_kind"`
EnvironmentKind string `json:"environment_kind"`
Remediation RemediationPayload `json:"remediation"`
}
type RelationshipInput ¶
type RelationshipInput struct {
Name string
Description string
IsTraversable bool // indicates whether the edge-kind is a traversable path
Info KindInfoInputs // entity panel definitions for this relationship kind
}
type RelationshipsInput ¶
type RelationshipsInput []RelationshipInput
type Remediation ¶
type Remediation struct {
FindingID int32
DisplayName string
ShortDescription string
LongDescription string
ShortRemediation string
LongRemediation string
}
func (Remediation) TableName ¶
func (Remediation) TableName() string
type RemediationInput ¶
type RemediationPayload ¶
type ReservedKindError ¶
ReservedKindError indicates that a node or edge kind uses a namespace that is reserved for internal use. Callers can render it as a string via Error() or type-assert to inspect the offending kind and namespace.
func (*ReservedKindError) Error ¶
func (s *ReservedKindError) Error() string
type Role ¶
type Role struct {
Name string `json:"name"`
Description string `json:"description"`
Permissions Permissions `json:"permissions" gorm:"many2many:roles_permissions"`
Serial
}
type Roles ¶
type Roles []Role
func (Roles) FindByPermissions ¶
func (s Roles) FindByPermissions(permissions Permissions) (Role, bool)
func (Roles) GetFilterableColumns ¶
func (Roles) GetValidFilterPredicatesAsStrings ¶
func (Roles) IsSortable ¶
func (Roles) Permissions ¶
func (s Roles) Permissions() Permissions
func (Roles) RemoveByName ¶
func (Roles) ValidFilters ¶
func (s Roles) ValidFilters() map[string][]FilterOperator
type SAMLProvider ¶
type SAMLProvider struct {
Name string `json:"name" gorm:"unique;index"`
DisplayName string `json:"display_name"`
IssuerURI string `json:"idp_issuer_uri"`
SingleSignOnURI string `json:"idp_sso_uri"`
MetadataXML []byte `json:"-"`
RootURIVersion SAMLRootURIVersion `json:"root_uri_version"`
// PrincipalAttributeMapping is an array of OID or XML Namespace element mapping strings that can be used to map a
// SAML assertion to a user in the database.
//
// For example: ["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", "urn:oid:0.9.2342.19200300.100.1.3"]
PrincipalAttributeMappings []string `json:"principal_attribute_mappings" gorm:"type:text[];column:ous"`
// The below values generated values that point a client to SAML related resources hosted on the BloodHound instance
// and should not be persisted to the database due to the fact that the URLs rely on the Host header that the user is
// using to communicate to the API
ServiceProviderIssuerURI serde.URL `json:"sp_issuer_uri" gorm:"-"`
ServiceProviderInitiationURI serde.URL `json:"sp_sso_uri" gorm:"-"`
ServiceProviderMetadataURI serde.URL `json:"sp_metadata_uri" gorm:"-"`
ServiceProviderACSURI serde.URL `json:"sp_acs_uri" gorm:"-"`
SSOProviderID null.Int32 `json:"sso_provider_id"`
Serial
}
func (SAMLProvider) AuditData ¶
func (s SAMLProvider) AuditData() AuditData
func (*SAMLProvider) FormatSAMLProviderURLs ¶
func (s *SAMLProvider) FormatSAMLProviderURLs(hostUrl url.URL)
func (SAMLProvider) GetSAMLUserGivenNameFromAssertion ¶
func (s SAMLProvider) GetSAMLUserGivenNameFromAssertion(assertion *saml.Assertion) (string, error)
func (SAMLProvider) GetSAMLUserPrincipalNameFromAssertion ¶
func (s SAMLProvider) GetSAMLUserPrincipalNameFromAssertion(assertion *saml.Assertion) (string, error)
func (SAMLProvider) GetSAMLUserRolesFromAssertion ¶
func (s SAMLProvider) GetSAMLUserRolesFromAssertion(assertion *saml.Assertion) (roles []string)
GetSAMLUserRolesFromAssertion May be empty if not present
func (SAMLProvider) GetSAMLUserSurnameFromAssertion ¶
func (s SAMLProvider) GetSAMLUserSurnameFromAssertion(assertion *saml.Assertion) (string, error)
func (SAMLProvider) TableName ¶
func (SAMLProvider) TableName() string
type SAMLProviders ¶
type SAMLProviders []SAMLProvider
type SAMLRootURIVersion ¶
type SAMLRootURIVersion int
SAMLRootURIVersion is required for payloads to match the ACS / Callback url configured on IDPs While the DB column root_uri_version has a default of 2, it is also hardcoded in the db method CreateSAMLIdentityProvider
var ( SAMLRootURIVersion1 SAMLRootURIVersion = 1 SAMLRootURIVersion2 SAMLRootURIVersion = 2 SAMLRootURIVersionMap = map[SAMLRootURIVersion]string{ SAMLRootURIVersion1: "/api/v1/login/saml", SAMLRootURIVersion2: "/api/v2/sso", } )
type SSOProvider ¶
type SSOProvider struct {
Type SessionAuthProvider `json:"type" gorm:"column:type"`
Name string `json:"name"`
Slug string `json:"slug"`
OIDCProvider *OIDCProvider `json:"oidc_provider,omitempty" gorm:"foreignKey:SSOProviderID"`
SAMLProvider *SAMLProvider `json:"saml_provider,omitempty" gorm:"foreignKey:SSOProviderID"`
Config SSOProviderConfig `json:"config" gorm:"type:jsonb column:config"`
Serial
}
SSOProvider is the common representation of an SSO provider that can be used to display high level information about that provider
func (SSOProvider) AuditData ¶
func (s SSOProvider) AuditData() AuditData
AuditData returns the fields to log in the audit log
type SSOProviderConfig ¶
type SSOProviderConfig struct {
AutoProvision SSOProviderAutoProvisionConfig `json:"auto_provision"`
}
func (*SSOProviderConfig) Scan ¶
func (cfg *SSOProviderConfig) Scan(value interface{}) error
Implement the sql.Scanner interface so that GORM can scan the jsonb column from the database into a golang struct
type SavedQueries ¶
type SavedQueries []SavedQuery
func (SavedQueries) GetFilterableColumns ¶
func (s SavedQueries) GetFilterableColumns() []string
func (SavedQueries) GetValidFilterPredicatesAsStrings ¶
func (s SavedQueries) GetValidFilterPredicatesAsStrings(column string) ([]string, error)
func (SavedQueries) IsSortable ¶
func (s SavedQueries) IsSortable(column string) bool
func (SavedQueries) IsString ¶
func (s SavedQueries) IsString(column string) bool
func (SavedQueries) ValidFilters ¶
func (s SavedQueries) ValidFilters() map[string][]FilterOperator
type SavedQueriesInput ¶
type SavedQueriesInput []SavedQueryInput
func (SavedQueriesInput) Validate ¶
func (s SavedQueriesInput) Validate() error
type SavedQueriesPayload ¶
type SavedQueriesPayload []SavedQueryPayload
type SavedQueriesPermissions ¶
type SavedQueriesPermissions struct {
QueryID int64 `json:"query_id"`
Public bool `json:"public"`
BigSerial
}
SavedQueriesPermissions represents the database model which allows users to share saved cypher queries
type SavedQuery ¶
type SavedQuery struct {
UserID string `json:"user_id" gorm:"index:,unique,composite:compositeIndex"`
Name string `json:"name" gorm:"index:,unique,composite:compositeIndex"`
Query string `json:"query"`
Description string `json:"description"`
Category string `json:"category,omitempty" gorm:"column:category"`
SchemaExtensionID *int32 `` /* 144-byte string literal not displayed */
QueryKey *string `json:"-" gorm:"column:query_key;index:,unique,composite:extensionQueryKey"`
BigSerial
}
type SavedQueryInput ¶
type SavedQueryPayload ¶
type SavedQueryScope ¶
type SavedQueryScope string
const ( SavedQueryScopeOwned SavedQueryScope = "owned" SavedQueryScopePublic SavedQueryScope = "public" SavedQueryScopeAll SavedQueryScope = "all" )
type SchemaEnvironment ¶
type SchemaEnvironment struct {
Serial
SchemaExtensionId int32
SchemaExtensionDisplayName string
EnvironmentKindId int32
EnvironmentKindName string
EnvironmentKindDisplayName string
SourceKindId int32
}
func (SchemaEnvironment) TableName ¶
func (SchemaEnvironment) TableName() string
type SchemaEnvironmentPrincipalKind ¶
type SchemaEnvironmentPrincipalKind struct {
EnvironmentId int32
PrincipalKind int32
CreatedAt time.Time
}
func (SchemaEnvironmentPrincipalKind) TableName ¶
func (SchemaEnvironmentPrincipalKind) TableName() string
type SchemaEnvironmentPrincipalKinds ¶
type SchemaEnvironmentPrincipalKinds []SchemaEnvironmentPrincipalKind
type SchemaFinding ¶
type SchemaFinding struct {
ID int32
Type SchemaFindingType
SchemaExtensionId int32
// EnvironmentId stores the environment kind ID (DAWGs `kind` table)
EnvironmentId int32
KindId int32
Name string
DisplayName string
// PZ Variant Display Title
PZDisplayName null.String
CreatedAt time.Time
// This is the kind that the finding is associated with based on the kind_id, it is enriched by db getters
Kind graph.Kind `gorm:"-"`
// This is the subtypes a finding is associated with, it is enriched by the db getters
Subtypes []string `gorm:"-"`
// This is the extension a finding is associated with, it is enriched by the db getters
Extension GraphSchemaExtension `gorm:"-"`
}
SchemaFinding represents an individual finding (e.g., T0WriteOwner, T0ADCSESC1, T0DCSync)
func (SchemaFinding) FindingKind ¶
func (s SchemaFinding) FindingKind() graph.Kind
func (SchemaFinding) GetDisplayName ¶
func (s SchemaFinding) GetDisplayName() string
func (SchemaFinding) GetExtensionName ¶
func (s SchemaFinding) GetExtensionName() string
func (SchemaFinding) GetPZDisplayName ¶
func (s SchemaFinding) GetPZDisplayName() string
func (SchemaFinding) GetSubtypes ¶
func (s SchemaFinding) GetSubtypes() []string
func (SchemaFinding) GetType ¶
func (s SchemaFinding) GetType() SchemaFindingType
func (SchemaFinding) IsSortable ¶
func (s SchemaFinding) IsSortable(column string) bool
func (SchemaFinding) IsSubtype ¶
func (s SchemaFinding) IsSubtype(subtype string) bool
func (SchemaFinding) IsType ¶
func (s SchemaFinding) IsType(findingType SchemaFindingType) bool
func (SchemaFinding) String ¶
func (s SchemaFinding) String() string
func (SchemaFinding) TableName ¶
func (SchemaFinding) TableName() string
func (SchemaFinding) ValidFilters ¶
func (SchemaFinding) ValidFilters() map[string][]FilterOperator
type SchemaFindingType ¶
type SchemaFindingType int
const ( SchemaFindingTypeRelationship SchemaFindingType = 1 SchemaFindingTypeList SchemaFindingType = 2 )
func (SchemaFindingType) String ¶
func (s SchemaFindingType) String() string
type SchemaFindingsSubtype ¶
func (SchemaFindingsSubtype) TableName ¶
func (SchemaFindingsSubtype) TableName() string
type ScopedSavedQuery ¶
type ScopedSavedQuery struct {
SavedQuery
Scope string `json:"scope"`
}
type SearchResult ¶
type SelectorAutoCertifyMethod ¶
type SelectorAutoCertifyMethod int
const ( SelectorAutoCertifyMethodDisabled SelectorAutoCertifyMethod = 0 SelectorAutoCertifyMethodAllMembers SelectorAutoCertifyMethod = 1 SelectorAutoCertifyMethodSeedsOnly SelectorAutoCertifyMethod = 2 )
type SelectorSeed ¶
type SelectorSeed struct {
SelectorId int `json:"-"`
Type SelectorType `json:"type"`
Value string `json:"value"`
}
func (SelectorSeed) AuditData ¶
func (s SelectorSeed) AuditData() AuditData
func (SelectorSeed) TableName ¶
func (SelectorSeed) TableName() string
func (SelectorSeed) ValidFilters ¶
func (s SelectorSeed) ValidFilters() map[string][]FilterOperator
type SelectorSeedInput ¶
type SelectorSeedInput struct {
Type SelectorType
Value string
}
type SelectorSeedPayload ¶
type SelectorSeedPayload struct {
Type SelectorType `json:"type"`
Value string `json:"value"`
}
SelectorSeedPayload is the JSON shape of a single privilege-zone selector seed within pz_rules.
type SelectorSeeds ¶
type SelectorSeeds []SelectorSeed
type SelectorType ¶
type SelectorType int
const ( SelectorTypeObjectId SelectorType = 1 SelectorTypeCypher SelectorType = 2 )
type Serial ¶
Serial is a struct which includes the following basic fields: ID, CreatedAt, UpdatedAt, DeletedAt. This was chosen over the default gorm model so that ID retains the bare int type. We do this because uint has no meaning with regards to the underlying database storage engine - at least where postgresql is concerned. To avoid type gnashing and unexpected pain with sql.NullInt32 the bare int type is a better choice all around.
See: https://www.postgresql.org/docs/current/datatype-numeric.html
type SessionAuthProvider ¶
type SessionAuthProvider int
const ( SessionAuthProviderSecret SessionAuthProvider = 0 SessionAuthProviderSAML SessionAuthProvider = 1 SessionAuthProviderOIDC SessionAuthProvider = 2 SessionAuthProviderBearerToken SessionAuthProvider = 3 )
func (SessionAuthProvider) String ¶
func (s SessionAuthProvider) String() string
type SessionFlagKey ¶
type SessionFlagKey string
const (
SessionFlagFedEULAAccepted SessionFlagKey = "fed_eula_accepted" // INFO: The FedEULA is only applicable to select enterprise installations
)
type SortDirection ¶
type SortDirection int
const ( InvalidSortDirection SortDirection = iota AscendingSortDirection DescendingSortDirection )
type SortItem ¶
type SortItem struct {
Direction SortDirection
Column string
}
type SourceKind ¶
func (SourceKind) TableName ¶
func (s SourceKind) TableName() string
func (SourceKind) ToKind ¶
func (s SourceKind) ToKind() graph.Kind
type UnifiedEdge ¶
type UnifiedEdge struct {
ID string `json:"id"`
Source string `json:"source"`
Target string `json:"target"`
Label string `json:"label"`
Kind string `json:"kind"`
LastSeen time.Time `json:"lastSeen"`
Properties map[string]any `json:"properties,omitempty"`
}
UnifiedEdge represents a single path segment in a graph containing a minimal set of attributes for graph rendering
type UnifiedGraph ¶
type UnifiedGraph struct {
Nodes map[string]UnifiedNode `json:"nodes"`
Edges []UnifiedEdge `json:"edges"`
Literals graph.Literals `json:"literals"`
}
UnifiedGraph represents a single, generic and minimalistic graph
func NewUnifiedGraph ¶
func NewUnifiedGraph() UnifiedGraph
NewUnifiedGraph returns a new UnifiedGraph struct with the Nodes field initialized to an empty map
func (*UnifiedGraph) AddNode ¶
func (s *UnifiedGraph) AddNode(primaryDisplayKinds graphschema.PrimaryDisplayKinds, node *graph.Node, includeProperties bool)
func (*UnifiedGraph) AddPathSet ¶
func (s *UnifiedGraph) AddPathSet(primaryDisplayKinds graphschema.PrimaryDisplayKinds, paths graph.PathSet, includeProperties bool)
func (*UnifiedGraph) AddRelationship ¶
func (s *UnifiedGraph) AddRelationship(rel *graph.Relationship, includeProperties bool)
type UnifiedGraphWPropertyKeys ¶
type UnifiedGraphWPropertyKeys struct {
NodeKeys []string `json:"node_keys,omitempty"`
EdgeKeys []string `json:"edge_keys,omitempty"`
Edges []UnifiedEdge `json:"edges"`
Nodes map[string]UnifiedNode `json:"nodes"`
Literals graph.Literals `json:"literals"`
}
UnifiedGraphWPropertyKeys
type UnifiedNode ¶
type UnifiedNode struct {
Label string `json:"label"`
Kind string `json:"kind"`
Kinds []string `json:"kinds"`
ObjectId string `json:"objectId"`
IsTierZero bool `json:"isTierZero"`
IsOwnedObject bool `json:"isOwnedObject"`
LastSeen time.Time `json:"lastSeen"`
Properties map[string]any `json:"properties,omitempty"`
Hidden bool `json:"hidden,omitempty"`
}
UnifiedNode represents a single node in a graph containing a minimal set of attributes for graph rendering
func FromDAWGSNode ¶
func FromDAWGSNode(primaryDisplayKinds graphschema.PrimaryDisplayKinds, node *graph.Node, includeProperties bool) UnifiedNode
type Unique ¶
Unique is a struct is a struct which includes the following basic fields: ID, CreatedAt, UpdatedAt, DeletedAt.
type UpdatedAssetGroupSelectors ¶
type UpdatedAssetGroupSelectors struct {
Added AssetGroupSelectors `json:"added_selectors"`
Removed AssetGroupSelectors `json:"removed_selectors"`
}
type User ¶
type User struct {
SSOProvider *SSOProvider `json:"-" `
SSOProviderID null.Int32 `json:"sso_provider_id,omitempty"`
AuthSecret *AuthSecret `gorm:"constraint:OnDelete:CASCADE;"`
AuthTokens AuthTokens `json:"-" gorm:"constraint:OnDelete:CASCADE;"`
Roles Roles `json:"roles" gorm:"many2many:users_roles"`
FirstName null.String `json:"first_name"`
LastName null.String `json:"last_name"`
EmailAddress null.String `json:"email_address"`
PrincipalName string `json:"principal_name" gorm:"unique;index"`
LastLogin time.Time `json:"last_login"`
IsDisabled bool `json:"is_disabled"`
AllEnvironments bool `json:"all_environments"`
EnvironmentTargetedAccessControl []EnvironmentTargetedAccessControl `json:"environment_targeted_access_control"`
// SupportAccount should never be settable by a user. It is used to determine if a user is a support account.
SupportAccount bool `json:"-"`
// EULA Acceptance does not pertain to Bloodhound Community Edition; this flag is used for Bloodhound Enterprise users.
// This value is automatically set to true for Bloodhound Community Edition in the patchEULAAcceptance and CreateUser functions.
EULAAccepted bool `json:"eula_accepted"`
Unique
}
func (*User) HasAllEnvironments ¶
func (*User) RemoveRole ¶
func (*User) SSOProviderHasRoleProvisionEnabled ¶
type UserSession ¶
type UserSession struct {
User User `gorm:"constraint:OnDelete:CASCADE;"`
UserID uuid.UUID
AuthProviderType SessionAuthProvider
AuthProviderID int32 // If SSO Session, this will be the child saml or oidc provider id
ExpiresAt time.Time
Flags types.JSONBBoolObject `json:"flags"`
BigSerial
}
func (UserSession) Expired ¶
func (s UserSession) Expired() bool
Expired returns true if the user session has expired, false otherwise
func (UserSession) GetFlag ¶
func (s UserSession) GetFlag(key SessionFlagKey) bool
corresponding set function is cmd/api/src/database/auth.go:SetUserSessionFlag()
type Users ¶
type Users []User
func (Users) GetFilterableColumns ¶
func (Users) GetValidFilterPredicatesAsStrings ¶
func (Users) IsSortable ¶
func (Users) ValidFilters ¶
func (s Users) ValidFilters() map[string][]FilterOperator
type ValidFilters ¶
type ValidFilters map[string][]FilterOperator
Source Files
¶
- adquality.go
- agi.go
- analysisrequest.go
- assetgrouphistory.go
- assetgrouptags.go
- audit.go
- auth.go
- azurequality.go
- cache.go
- completedtask.go
- composition.go
- csv.go
- customnode.go
- datapipestatus.go
- dataqualitystats.go
- etac.go
- filter.go
- graph_migration.go
- graphschema.go
- ingest.go
- jobs.go
- kind.go
- metrics.go
- migration.go
- model.go
- oidc_provider.go
- pagination.go
- reconcile.go
- samlprovider.go
- saved_queries.go
- saved_queries_permissions.go
- search.go
- sourcekinds.go
- sso_provider.go
- unified_graph.go