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 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 CheckError(tx *gorm.DB) error
- func IsUnexpectedDatabaseError(err error) bool
- func NewClientAuthToken(ownerID uuid.UUID, hmacMethod string) (model.AuthToken, error)
- func NullUUID(value uuid.UUID) uuid.NullUUID
- func OpenDatabase(cfg config.DatabaseConfiguration) (*gorm.DB, *pgxpool.Pool, error)
- type AgiData
- type AnalysisRequestData
- type AssetGroupHistoryData
- type AssetGroupTagData
- type AssetGroupTagSelectorData
- type AssetGroupTagSelectorNodeData
- type BloodhoundDB
- func (s *BloodhoundDB) AppendAuditLog(ctx context.Context, entry model.AuditEntry) error
- func (s *BloodhoundDB) AuditableTransaction(ctx context.Context, auditEntry model.AuditEntry, f func(tx *gorm.DB) error, ...) error
- func (s *BloodhoundDB) CancelAllIngestJobs(ctx context.Context) error
- func (s *BloodhoundDB) Close(ctx context.Context)
- func (s *BloodhoundDB) CountAllIngestTasks(ctx context.Context) (int64, error)
- func (s *BloodhoundDB) CreateADDataQualityAggregation(ctx context.Context, aggregation model.ADDataQualityAggregation) (model.ADDataQualityAggregation, error)
- func (s *BloodhoundDB) CreateADDataQualityStats(ctx context.Context, stats model.ADDataQualityStats) (model.ADDataQualityStats, error)
- func (s *BloodhoundDB) CreateAssetGroup(ctx context.Context, name, tag string, systemGroup bool) (model.AssetGroup, error)
- func (s *BloodhoundDB) CreateAssetGroupCollection(ctx context.Context, collection model.AssetGroupCollection, ...) error
- func (s *BloodhoundDB) CreateAssetGroupHistoryRecord(ctx context.Context, actorId, emailAddress string, target string, ...) error
- func (s *BloodhoundDB) CreateAssetGroupTag(ctx context.Context, tagType model.AssetGroupTagType, user model.User, ...) (model.AssetGroupTag, error)
- func (s *BloodhoundDB) CreateAssetGroupTagSelector(ctx context.Context, user model.User, selector model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
- func (s *BloodhoundDB) CreateAuditLog(ctx context.Context, auditLog model.AuditLog) error
- func (s *BloodhoundDB) CreateAuthSecret(ctx context.Context, authSecret model.AuthSecret) (model.AuthSecret, error)
- func (s *BloodhoundDB) CreateAuthToken(ctx context.Context, authToken model.AuthToken) (model.AuthToken, error)
- func (s *BloodhoundDB) CreateAzureDataQualityAggregation(ctx context.Context, aggregation model.AzureDataQualityAggregation) (model.AzureDataQualityAggregation, error)
- func (s *BloodhoundDB) CreateAzureDataQualityStats(ctx context.Context, stats model.AzureDataQualityStats) (model.AzureDataQualityStats, error)
- func (s *BloodhoundDB) CreateCompletedTask(ctx context.Context, task model.CompletedTask) (model.CompletedTask, error)
- func (s *BloodhoundDB) CreateCompositionInfo(ctx context.Context, nodes model.EdgeCompositionNodes, ...) (model.EdgeCompositionNodes, model.EdgeCompositionEdges, error)
- func (s *BloodhoundDB) CreateCustomNodeKinds(ctx context.Context, customNodeKinds model.CustomNodeKinds) (model.CustomNodeKinds, error)
- func (s *BloodhoundDB) CreateDataQualityAggregations(ctx context.Context, aggregations model.DataQualityAggregations) (model.DataQualityAggregations, error)
- func (s *BloodhoundDB) CreateDataQualityStats(ctx context.Context, stats model.DataQualityStats) (model.DataQualityStats, error)
- func (s *BloodhoundDB) CreateEnvironment(ctx context.Context, extensionId int32, environmentKindId int32, ...) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) CreateEnvironmentWithPrincipalKinds(ctx context.Context, extensionId int32, input model.EnvironmentInput) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) CreateFindingWithRemediation(ctx context.Context, extensionId int32, input model.RelationshipFindingInput) (model.SchemaFinding, error)
- func (s *BloodhoundDB) CreateGraphSchemaExtension(ctx context.Context, name string, displayName string, version string, ...) (model.GraphSchemaExtension, error)
- func (s *BloodhoundDB) CreateGraphSchemaNodeKind(ctx context.Context, name string, extensionId int32, displayName string, ...) (model.GraphSchemaNodeKind, error)
- func (s *BloodhoundDB) CreateGraphSchemaProperty(ctx context.Context, extensionId int32, name string, displayName string, ...) (model.GraphSchemaProperty, error)
- func (s *BloodhoundDB) CreateGraphSchemaRelationshipKind(ctx context.Context, name string, schemaExtensionId int32, description string, ...) (model.GraphSchemaRelationshipKind, error)
- func (s *BloodhoundDB) CreateIngestJob(ctx context.Context, job model.IngestJob) (model.IngestJob, error)
- func (s *BloodhoundDB) CreateIngestTask(ctx context.Context, ingestTask model.IngestTask) (model.IngestTask, error)
- func (s *BloodhoundDB) CreateInstallation(ctx context.Context) (model.Installation, error)
- func (s *BloodhoundDB) CreateKindInfo(ctx context.Context, kindID int32, nodeKindID, relationshipKindID *int32, ...) (model.GraphSchemaKindInfo, error)
- func (s *BloodhoundDB) CreateOIDCProvider(ctx context.Context, name, issuer, clientID string, ...) (model.OIDCProvider, error)
- func (s *BloodhoundDB) CreatePrincipalKind(ctx context.Context, environmentId int32, principalKind int32) (model.SchemaEnvironmentPrincipalKind, error)
- func (s *BloodhoundDB) CreateRemediation(ctx context.Context, findingId int32, shortDescription string, ...) (model.Remediation, error)
- func (s *BloodhoundDB) CreateSAMLConsumedIdentifiers(ctx context.Context, ssoProviderID int32, ...) error
- func (s *BloodhoundDB) CreateSAMLIdentityProvider(ctx context.Context, samlProvider model.SAMLProvider, ...) (model.SAMLProvider, error)
- func (s *BloodhoundDB) CreateSSOProvider(ctx context.Context, name string, authProvider model.SessionAuthProvider, ...) (model.SSOProvider, error)
- func (s *BloodhoundDB) CreateSavedQueries(ctx context.Context, savedQueries model.SavedQueries) error
- func (s *BloodhoundDB) CreateSavedQuery(ctx context.Context, userID uuid.UUID, name string, query string, ...) (model.SavedQuery, error)
- func (s *BloodhoundDB) CreateSavedQueryPermissionToPublic(ctx context.Context, queryID int64) (model.SavedQueriesPermissions, error)
- func (s *BloodhoundDB) CreateSavedQueryPermissionsToUsers(ctx context.Context, queryID int64, userIDs ...uuid.UUID) ([]model.SavedQueriesPermissions, error)
- func (s *BloodhoundDB) CreateSchemaFinding(ctx context.Context, findingType model.SchemaFindingType, extensionId int32, ...) (model.SchemaFinding, error)
- func (s *BloodhoundDB) CreateSchemaFindingSubtype(ctx context.Context, findingId int32, subtype string) error
- func (s *BloodhoundDB) CreateUser(ctx context.Context, user model.User) (model.User, error)
- func (s *BloodhoundDB) CreateUserSession(ctx context.Context, userSession model.UserSession) (model.UserSession, error)
- func (s *BloodhoundDB) DeleteAllAuthTokens(ctx context.Context) error
- func (s *BloodhoundDB) DeleteAllDataQuality(ctx context.Context) error
- func (s *BloodhoundDB) DeleteAllIngestJobs(ctx context.Context) error
- func (s *BloodhoundDB) DeleteAllIngestTasks(ctx context.Context) error
- func (s *BloodhoundDB) DeleteAnalysisRequest(ctx context.Context) error
- func (s *BloodhoundDB) DeleteAssetGroup(ctx context.Context, assetGroup model.AssetGroup) error
- func (s *BloodhoundDB) DeleteAssetGroupHistoryRecordsByCreatedDate(ctx context.Context, createdAt time.Time) (int64, error)
- func (s *BloodhoundDB) DeleteAssetGroupSelector(ctx context.Context, selector model.AssetGroupSelector) error
- func (s *BloodhoundDB) DeleteAssetGroupSelectorsForAssetGroups(ctx context.Context, assetGroupIds []int) error
- func (s *BloodhoundDB) DeleteAssetGroupTag(ctx context.Context, user model.User, assetGroupTag model.AssetGroupTag) error
- func (s *BloodhoundDB) DeleteAssetGroupTagSelector(ctx context.Context, user model.User, selector model.AssetGroupTagSelector) error
- func (s *BloodhoundDB) DeleteAuthSecret(ctx context.Context, authSecret model.AuthSecret) error
- func (s *BloodhoundDB) DeleteAuthToken(ctx context.Context, authToken model.AuthToken) error
- func (s *BloodhoundDB) DeleteCustomNodeKind(ctx context.Context, kindName string) error
- func (s *BloodhoundDB) DeleteEnvironment(ctx context.Context, environmentId int32) error
- func (s *BloodhoundDB) DeleteEnvironmentTargetedAccessControlForUser(ctx context.Context, user model.User) error
- func (s *BloodhoundDB) DeleteExpiredAuthTokens(ctx context.Context) error
- func (s *BloodhoundDB) DeleteGraphSchemaExtension(ctx context.Context, extensionId int32) error
- func (s *BloodhoundDB) DeleteGraphSchemaNodeKind(ctx context.Context, schemaNodeKindId int32) error
- func (s *BloodhoundDB) DeleteGraphSchemaProperty(ctx context.Context, propertyID int32) error
- func (s *BloodhoundDB) DeleteGraphSchemaRelationshipKind(ctx context.Context, schemaRelationshipKindId int32) error
- func (s *BloodhoundDB) DeleteIngestTask(ctx context.Context, ingestTask model.IngestTask) error
- func (s *BloodhoundDB) DeleteKindInfo(ctx context.Context, kindInfoID int32) error
- func (s *BloodhoundDB) DeletePrincipalKind(ctx context.Context, environmentId int32, principalKind int32) error
- func (s *BloodhoundDB) DeleteRemediation(ctx context.Context, findingId int32) error
- func (s *BloodhoundDB) DeleteSSOProvider(ctx context.Context, id int) error
- func (s *BloodhoundDB) DeleteSavedQuery(ctx context.Context, savedQueryID int64) error
- func (s *BloodhoundDB) DeleteSavedQueryPermissionsForUsers(ctx context.Context, queryID int64, userIDs ...uuid.UUID) error
- func (s *BloodhoundDB) DeleteSchemaFinding(ctx context.Context, findingId int32) error
- func (s *BloodhoundDB) DeleteSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
- func (s *BloodhoundDB) DeleteSelectorNodesBySelectorIds(ctx context.Context, selectorIds ...int) error
- func (s *BloodhoundDB) DeleteSourceKindsByName(ctx context.Context, names ...string) error
- func (s *BloodhoundDB) DeleteUser(ctx context.Context, user model.User) error
- func (s *BloodhoundDB) EndUserSession(ctx context.Context, userSession model.UserSession)
- func (s *BloodhoundDB) EnsureStubbedCustomNodeKindForIngest(ctx context.Context, name string) error
- func (s *BloodhoundDB) GetADDataQualityAggregations(ctx context.Context, start time.Time, end time.Time, order string, limit int, ...) (model.ADDataQualityAggregations, int, error)
- func (s *BloodhoundDB) GetADDataQualityStats(ctx context.Context, domainSid string, start time.Time, end time.Time, ...) (model.ADDataQualityStats, int, error)
- func (s *BloodhoundDB) GetAggregateADDataQualityStats(ctx context.Context, domainSIDs []string, start time.Time, end time.Time) (model.ADDataQualityStats, error)
- func (s *BloodhoundDB) GetAggregatedSelectorNodesCertification(ctx context.Context, sqlFilter model.SQLFilter, skip, limit int) ([]model.AssetGroupSelectorNodeExpanded, int, error)
- func (s *BloodhoundDB) GetAllAssetGroups(ctx context.Context, order string, filter model.SQLFilter) (model.AssetGroups, error)
- func (s *BloodhoundDB) GetAllAuthTokens(ctx context.Context, order string, filter model.SQLFilter) (model.AuthTokens, error)
- func (s *BloodhoundDB) GetAllConfigurationParameters(ctx context.Context) (appcfg.Parameters, error)
- func (s *BloodhoundDB) GetAllFlags(ctx context.Context) ([]appcfg.FeatureFlag, error)
- func (s *BloodhoundDB) GetAllIngestJobs(ctx context.Context, skip int, limit int, order string, filter model.SQLFilter) ([]model.IngestJob, int, error)
- func (s *BloodhoundDB) GetAllIngestTasks(ctx context.Context) (model.IngestTasks, error)
- func (s *BloodhoundDB) GetAllRoles(ctx context.Context, order string, filter model.SQLFilter) (model.Roles, error)
- func (s *BloodhoundDB) GetAllSAMLProviders(ctx context.Context) (model.SAMLProviders, error)
- func (s *BloodhoundDB) GetAllSSOProviders(ctx context.Context, order string, sqlFilter model.SQLFilter) ([]model.SSOProvider, error)
- func (s *BloodhoundDB) GetAllSavedQueriesByUser(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
- func (s *BloodhoundDB) GetAllUsers(ctx context.Context, order string, filter model.SQLFilter) (model.Users, error)
- func (s *BloodhoundDB) GetAnalysisRequest(ctx context.Context) (model.AnalysisRequest, error)
- func (s *BloodhoundDB) GetAssetGroup(ctx context.Context, id int32) (model.AssetGroup, error)
- func (s *BloodhoundDB) GetAssetGroupCollections(ctx context.Context, assetGroupID int32, order string, filter model.SQLFilter) (model.AssetGroupCollections, error)
- func (s *BloodhoundDB) GetAssetGroupHistoryRecords(ctx context.Context, sqlFilter model.SQLFilter, sortItems model.Sort, ...) ([]model.AssetGroupHistory, int, error)
- func (s *BloodhoundDB) GetAssetGroupSelector(ctx context.Context, id int32) (model.AssetGroupSelector, error)
- func (s *BloodhoundDB) GetAssetGroupSelectorNodeExpandedOrderedByIdAndPosition(ctx context.Context, nodeIds ...int) ([]model.AssetGroupSelectorNodeExpanded, error)
- func (s *BloodhoundDB) GetAssetGroupTag(ctx context.Context, assetGroupTagId int) (model.AssetGroupTag, error)
- func (s *BloodhoundDB) GetAssetGroupTagForSelection(ctx context.Context) ([]model.AssetGroupTag, error)
- func (s *BloodhoundDB) GetAssetGroupTagSelectorBySelectorId(ctx context.Context, assetGroupTagSelectorId int) (model.AssetGroupTagSelector, error)
- func (s *BloodhoundDB) GetAssetGroupTagSelectorCounts(ctx context.Context, tagIds []int) (model.AssetGroupTagCountsMap, error)
- func (s *BloodhoundDB) GetAssetGroupTagSelectors(ctx context.Context, sqlFilter model.SQLFilter, limit int) (model.AssetGroupTagSelectors, error)
- func (s *BloodhoundDB) GetAssetGroupTagSelectorsByExtensionId(ctx context.Context, extensionId int32) (model.AssetGroupTagSelectors, error)
- func (s *BloodhoundDB) GetAssetGroupTagSelectorsByTagId(ctx context.Context, assetGroupTagId int) (model.AssetGroupTagSelectors, int, error)
- func (s *BloodhoundDB) GetAssetGroupTagSelectorsByTagIdFilteredAndPaginated(ctx context.Context, assetGroupTagId int, ...) (model.AssetGroupTagSelectors, int, error)
- func (s *BloodhoundDB) GetAssetGroupTags(ctx context.Context, sqlFilter model.SQLFilter) (model.AssetGroupTags, error)
- func (s *BloodhoundDB) GetAuthSecret(ctx context.Context, id int32) (model.AuthSecret, error)
- func (s *BloodhoundDB) GetAuthToken(ctx context.Context, id uuid.UUID) (model.AuthToken, error)
- func (s *BloodhoundDB) GetAzureDataQualityAggregations(ctx context.Context, start time.Time, end time.Time, order string, limit int, ...) (model.AzureDataQualityAggregations, int, error)
- func (s *BloodhoundDB) GetAzureDataQualityStats(ctx context.Context, tenantId string, start time.Time, end time.Time, ...) (model.AzureDataQualityStats, int, error)
- func (s *BloodhoundDB) GetCompletedTasks(ctx context.Context, ingestJobId int64) ([]model.CompletedTask, error)
- func (s *BloodhoundDB) GetConfigurationParameter(ctx context.Context, parameterKey appcfg.ParameterKey) (appcfg.Parameter, error)
- func (s *BloodhoundDB) GetCustomAssetGroupTagSelectorsToMigrate(ctx context.Context) (model.AssetGroupTagSelectors, error)
- func (s *BloodhoundDB) GetCustomNodeKind(ctx context.Context, kindName string) (model.CustomNodeKind, error)
- func (s *BloodhoundDB) GetCustomNodeKinds(ctx context.Context) ([]model.CustomNodeKind, error)
- func (s *BloodhoundDB) GetDataQualityAggregations(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.DataQualityAggregations, int, error)
- func (s *BloodhoundDB) GetDataQualityStats(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.DataQualityStats, int, error)
- func (s *BloodhoundDB) GetDatapipeStatus(ctx context.Context) (model.DatapipeStatusWrapper, error)
- func (s *BloodhoundDB) GetEnvironmentByEnvironmentKindId(ctx context.Context, environmentKindId int32) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) GetEnvironmentById(ctx context.Context, environmentId int32) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) GetEnvironmentKindName(ctx context.Context, kindName string) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) GetEnvironmentTargetedAccessControlForUser(ctx context.Context, user model.User) ([]model.EnvironmentTargetedAccessControl, error)
- func (s *BloodhoundDB) GetEnvironments(ctx context.Context) ([]model.SchemaEnvironment, error)
- func (s *BloodhoundDB) GetEnvironmentsByExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaEnvironment, error)
- func (s *BloodhoundDB) GetEnvironmentsFiltered(ctx context.Context, filters model.Filters) ([]model.SchemaEnvironment, error)
- func (s *BloodhoundDB) GetFlag(ctx context.Context, id int32) (appcfg.FeatureFlag, error)
- func (s *BloodhoundDB) GetFlagByKey(ctx context.Context, key string) (appcfg.FeatureFlag, error)
- func (s *BloodhoundDB) GetGraphSchemaExtensionById(ctx context.Context, extensionId int32) (model.GraphSchemaExtension, error)
- func (s *BloodhoundDB) GetGraphSchemaExtensions(ctx context.Context, extensionFilters model.Filters, sort model.Sort, ...) (model.GraphSchemaExtensions, int, error)
- func (s *BloodhoundDB) GetGraphSchemaNodeKindById(ctx context.Context, schemaNodeKindId int32) (model.GraphSchemaNodeKind, error)
- func (s *BloodhoundDB) GetGraphSchemaNodeKinds(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaNodeKinds, int, error)
- func (s *BloodhoundDB) GetGraphSchemaNodeKindsByExtensionId(ctx context.Context, extensionId int32) (model.GraphSchemaNodeKinds, error)
- func (s *BloodhoundDB) GetGraphSchemaProperties(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaProperties, int, error)
- func (s *BloodhoundDB) GetGraphSchemaPropertyById(ctx context.Context, extensionPropertyId int32) (model.GraphSchemaProperty, error)
- func (s *BloodhoundDB) GetGraphSchemaRelationshipKindById(ctx context.Context, schemaRelationshipKindId int32) (model.GraphSchemaRelationshipKind, error)
- func (s *BloodhoundDB) GetGraphSchemaRelationshipKinds(ctx context.Context, relationshipKindFilters model.Filters, sort model.Sort, ...) (model.GraphSchemaRelationshipKinds, int, error)
- func (s *BloodhoundDB) GetGraphSchemaRelationshipKindsByExtensionId(ctx context.Context, extensionId int32) (model.GraphSchemaRelationshipKinds, error)
- func (s *BloodhoundDB) GetGraphSchemaRelationshipKindsWithSchemaName(ctx context.Context, relationshipKindFilters model.Filters, sort model.Sort, ...) (model.GraphSchemaRelationshipKindsWithNamedSchema, int, error)
- func (s *BloodhoundDB) GetIngestJob(ctx context.Context, id int64) (model.IngestJob, error)
- func (s *BloodhoundDB) GetIngestJobsWithStatus(ctx context.Context, status model.JobStatus) ([]model.IngestJob, error)
- func (s *BloodhoundDB) GetIngestTasksForJob(ctx context.Context, jobID int64) (model.IngestTasks, error)
- func (s *BloodhoundDB) GetInstallation(ctx context.Context) (model.Installation, error)
- func (s *BloodhoundDB) GetKindInfos(ctx context.Context, kindID int32) ([]model.GraphSchemaKindInfo, error)
- func (s *BloodhoundDB) GetKindsByIDs(ctx context.Context, ids ...int32) ([]model.Kind, error)
- func (s *BloodhoundDB) GetKindsByNames(ctx context.Context, names ...string) ([]model.Kind, error)
- func (s *BloodhoundDB) GetLatestAssetGroupCollection(ctx context.Context, assetGroupID int32) (model.AssetGroupCollection, error)
- func (s *BloodhoundDB) GetOrderedAssetGroupTagTiers(ctx context.Context) ([]model.AssetGroupTag, error)
- func (s *BloodhoundDB) GetPermission(ctx context.Context, id int) (model.Permission, error)
- func (s *BloodhoundDB) GetPrimaryDisplayKinds(ctx context.Context) (graphschema.PrimaryDisplayKinds, error)
- func (s *BloodhoundDB) GetPrincipalKindsByEnvironmentId(ctx context.Context, environmentId int32) (model.SchemaEnvironmentPrincipalKinds, error)
- func (s *BloodhoundDB) GetPrincipalKindsGraphKinds(ctx context.Context) (graph.Kinds, error)
- func (s *BloodhoundDB) GetPublicSavedQueries(ctx context.Context) (model.SavedQueries, error)
- func (s *BloodhoundDB) GetRemediationByFindingId(ctx context.Context, findingId int32) (model.Remediation, error)
- func (s *BloodhoundDB) GetRemediationByFindingName(ctx context.Context, findingName string) (model.Remediation, error)
- func (s *BloodhoundDB) GetRole(ctx context.Context, id int32) (model.Role, error)
- func (s *BloodhoundDB) GetRoles(ctx context.Context, ids []int32) (model.Roles, error)
- func (s *BloodhoundDB) GetSAMLProvider(ctx context.Context, id int32) (model.SAMLProvider, error)
- func (s *BloodhoundDB) GetSAMLProviderUsers(ctx context.Context, id int32) (model.Users, error)
- func (s *BloodhoundDB) GetSSOProviderById(ctx context.Context, id int32) (model.SSOProvider, error)
- func (s *BloodhoundDB) GetSSOProviderBySlug(ctx context.Context, slug string) (model.SSOProvider, error)
- func (s *BloodhoundDB) GetSSOProviderUsers(ctx context.Context, id int) (model.Users, error)
- func (s *BloodhoundDB) GetSavedQueriesByExtensionID(ctx context.Context, schemaExtensionID int32) (model.SavedQueries, error)
- func (s *BloodhoundDB) GetSavedQueriesOwnedBy(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
- func (s *BloodhoundDB) GetSavedQuery(ctx context.Context, savedQueryID int64) (model.SavedQuery, error)
- func (s *BloodhoundDB) GetSavedQueryPermissions(ctx context.Context, queryID int64) ([]model.SavedQueriesPermissions, error)
- func (s *BloodhoundDB) GetSchemaFindingById(ctx context.Context, findingId int32) (model.SchemaFinding, error)
- func (s *BloodhoundDB) GetSchemaFindingByName(ctx context.Context, name string) (model.SchemaFinding, error)
- func (s *BloodhoundDB) GetSchemaFindings(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) ([]model.SchemaFinding, int, error)
- func (s *BloodhoundDB) GetSchemaFindingsByExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaFinding, error)
- func (s *BloodhoundDB) GetScopeForSavedQuery(ctx context.Context, queryID int64, userID uuid.UUID) (SavedQueryScopes, error)
- func (s *BloodhoundDB) GetSelectorNodesBySelectorIds(ctx context.Context, selectorIds ...int) ([]model.AssetGroupSelectorNode, error)
- func (s *BloodhoundDB) GetSelectorNodesBySelectorIdsFilteredAndPaginated(ctx context.Context, sqlFilter model.SQLFilter, sort model.Sort, ...) ([]model.AssetGroupSelectorNode, int, error)
- func (s *BloodhoundDB) GetSelectorsByMemberId(ctx context.Context, memberId int, assetGroupTagId int) (model.AssetGroupTagSelectors, error)
- func (s *BloodhoundDB) GetSharedSavedQueries(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
- func (s *BloodhoundDB) GetSourceKindByID(ctx context.Context, id int) (model.SourceKind, error)
- func (s *BloodhoundDB) GetSourceKindByName(ctx context.Context, name string) (model.SourceKind, error)
- func (s *BloodhoundDB) GetSourceKinds(ctx context.Context) ([]model.SourceKind, error)
- func (s *BloodhoundDB) GetSourceKindsByIDs(ctx context.Context, ids ...int) ([]model.SourceKind, error)
- func (s *BloodhoundDB) GetTimeRangedAssetGroupCollections(ctx context.Context, assetGroupID int32, from int64, to int64, order string) (model.AssetGroupCollections, error)
- func (s *BloodhoundDB) GetTraversableRelationshipKindsByExtensionID(ctx context.Context, extensionID int32) (model.GraphSchemaRelationshipKinds, error)
- func (s *BloodhoundDB) GetUser(ctx context.Context, id uuid.UUID) (model.User, error)
- func (s *BloodhoundDB) GetUserSession(ctx context.Context, id int64) (model.UserSession, error)
- func (s *BloodhoundDB) GetUserToken(ctx context.Context, userId, tokenId uuid.UUID) (model.AuthToken, error)
- func (s *BloodhoundDB) HasAnalysisRequest(ctx context.Context) bool
- func (s *BloodhoundDB) HasCollectedGraphDataDeletionRequest(ctx context.Context) (model.AnalysisRequest, bool)
- func (s *BloodhoundDB) HasInstallation(ctx context.Context) (bool, error)
- func (s *BloodhoundDB) InitializeSecretAuth(ctx context.Context, adminUser model.User, authSecret model.AuthSecret) (model.Installation, error)
- func (s *BloodhoundDB) InsertSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
- func (s *BloodhoundDB) IsEnabled(ctx context.Context, key string) (bool, error)
- func (s *BloodhoundDB) IsSavedQueryPublic(ctx context.Context, queryID int64) (bool, error)
- func (s *BloodhoundDB) IsSavedQuerySharedToUser(ctx context.Context, queryID int64, userID uuid.UUID) (bool, error)
- func (s *BloodhoundDB) IsSavedQuerySharedToUserOrPublic(ctx context.Context, queryID int64, userID uuid.UUID) (bool, error)
- func (s *BloodhoundDB) ListAuditLogs(ctx context.Context, before, after time.Time, offset, limit int, order string, ...) (model.AuditLogs, int, error)
- func (s *BloodhoundDB) ListSavedQueries(ctx context.Context, scope string, userID uuid.UUID, order string, ...) ([]model.ScopedSavedQuery, int, error)
- func (s *BloodhoundDB) LookupActiveSessionsByUser(ctx context.Context, user model.User) ([]model.UserSession, error)
- func (s *BloodhoundDB) LookupUser(ctx context.Context, name string) (model.User, error)
- func (s *BloodhoundDB) MaybeAuditableTransaction(ctx context.Context, auditDisabled bool, auditEntry model.AuditEntry, ...) error
- func (s *BloodhoundDB) Migrate(ctx context.Context) error
- func (s *BloodhoundDB) Pool() *pgxpool.Pool
- func (s *BloodhoundDB) PopulateExtensionData(ctx context.Context) error
- func (s *BloodhoundDB) RawDelete(value any) error
- func (s *BloodhoundDB) RegisterSourceKind(ctx context.Context) func(sourceKind graph.Kind) error
- func (s *BloodhoundDB) RequestAnalysis(ctx context.Context, requestedBy string, analysisMode model.AnalysisMode) error
- func (s *BloodhoundDB) RequestCollectedGraphDataDeletion(ctx context.Context, request model.AnalysisRequest) error
- func (s *BloodhoundDB) ResetLastGraphOptimizeTime(ctx context.Context) error
- func (s *BloodhoundDB) SQLDB() (*sql.DB, error)
- func (s *BloodhoundDB) SanitizeUpdateAssetGroupTagRequireCertify(tag *model.AssetGroupTag)
- func (s *BloodhoundDB) SavedQueryBelongsToUser(ctx context.Context, userID uuid.UUID, savedQueryID int64) (bool, error)
- func (s *BloodhoundDB) Scope(scopeFuncs ...ScopeFunc) *gorm.DB
- func (s *BloodhoundDB) SetConfigurationParameter(ctx context.Context, parameter appcfg.Parameter) error
- func (s *BloodhoundDB) SetDatapipeStatus(ctx context.Context, status model.DatapipeStatus) error
- func (s *BloodhoundDB) SetFlag(ctx context.Context, flag appcfg.FeatureFlag) error
- func (s *BloodhoundDB) SetLastAnalysisStartTime(ctx context.Context) error
- func (s *BloodhoundDB) SetLastGraphOptimizeTime(ctx context.Context) error
- func (s *BloodhoundDB) SetNextScheduledAnalysisStartTime(ctx context.Context, time null.Time) error
- func (s *BloodhoundDB) SetUserSessionFlag(ctx context.Context, userSession *model.UserSession, key model.SessionFlagKey, ...) error
- func (s *BloodhoundDB) SweepAssetGroupCollections(ctx context.Context)
- func (s *BloodhoundDB) SweepSAMLConsumedIdentifiers(ctx context.Context) error
- func (s *BloodhoundDB) SweepSessions(ctx context.Context)
- func (s *BloodhoundDB) TerminateUserSessionsBySSOProvider(ctx context.Context, ssoProvider model.SSOProvider) error
- func (s *BloodhoundDB) Transaction(ctx context.Context, fn func(tx *BloodhoundDB) error, opts ...*sql.TxOptions) error
- func (s *BloodhoundDB) UpdateAssetGroup(ctx context.Context, assetGroup model.AssetGroup) error
- func (s *BloodhoundDB) UpdateAssetGroupSelectors(ctx context.Context, assetGroup model.AssetGroup, ...) (model.UpdatedAssetGroupSelectors, error)
- func (s *BloodhoundDB) UpdateAssetGroupTag(ctx context.Context, user model.User, tag model.AssetGroupTag) (model.AssetGroupTag, error)
- func (s *BloodhoundDB) UpdateAssetGroupTagSelector(ctx context.Context, actorId, emailAddress string, ...) (model.AssetGroupTagSelector, error)
- func (s *BloodhoundDB) UpdateAuthSecret(ctx context.Context, authSecret model.AuthSecret) error
- func (s *BloodhoundDB) UpdateAuthToken(ctx context.Context, authToken model.AuthToken) error
- func (s *BloodhoundDB) UpdateAuthTokenExpiration(ctx context.Context) error
- func (s *BloodhoundDB) UpdateCertificationBySelectorNode(ctx context.Context, inputs []UpdateCertificationBySelectorNodeInput) error
- func (s *BloodhoundDB) UpdateCustomNodeKind(ctx context.Context, customNodeKind model.CustomNodeKind) (model.CustomNodeKind, error)
- func (s *BloodhoundDB) UpdateEnvironment(ctx context.Context, environment model.SchemaEnvironment) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) UpdateEnvironmentWithPrincipalKinds(ctx context.Context, existing model.SchemaEnvironment, ...) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) UpdateFindingWithRemediation(ctx context.Context, existing model.SchemaFinding, ...) (model.SchemaFinding, error)
- func (s *BloodhoundDB) UpdateGraphSchemaExtension(ctx context.Context, extension model.GraphSchemaExtension) (model.GraphSchemaExtension, error)
- func (s *BloodhoundDB) UpdateGraphSchemaNodeKind(ctx context.Context, schemaNodeKind model.GraphSchemaNodeKind) (model.GraphSchemaNodeKind, error)
- func (s *BloodhoundDB) UpdateGraphSchemaNodeKindIconById(ctx context.Context, id int32, icon graphschema.DisplayNodeIcon) (model.GraphSchemaNodeKind, error)
- func (s *BloodhoundDB) UpdateGraphSchemaProperty(ctx context.Context, property model.GraphSchemaProperty) (model.GraphSchemaProperty, error)
- func (s *BloodhoundDB) UpdateGraphSchemaRelationshipKind(ctx context.Context, schemaRelationshipKind model.GraphSchemaRelationshipKind) (model.GraphSchemaRelationshipKind, error)
- func (s *BloodhoundDB) UpdateIngestJob(ctx context.Context, job model.IngestJob) error
- func (s *BloodhoundDB) UpdateKindInfo(ctx context.Context, kindInfo model.GraphSchemaKindInfo) (model.GraphSchemaKindInfo, error)
- func (s *BloodhoundDB) UpdateLastAnalysisCompleteTime(ctx context.Context) error
- func (s *BloodhoundDB) UpdateOIDCProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.OIDCProvider, error)
- func (s *BloodhoundDB) UpdateOpenGraphAssetGroupTagSelector(ctx context.Context, extensionId int32, input model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
- func (s *BloodhoundDB) UpdateRemediation(ctx context.Context, findingId int32, shortDescription string, ...) (model.Remediation, error)
- func (s *BloodhoundDB) UpdateSAMLIdentityProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.SAMLProvider, error)
- func (s *BloodhoundDB) UpdateSSOProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.SSOProvider, error)
- func (s *BloodhoundDB) UpdateSavedQuery(ctx context.Context, savedQuery model.SavedQuery) (model.SavedQuery, error)
- func (s *BloodhoundDB) UpdateSchemaFinding(ctx context.Context, finding model.SchemaFinding) (model.SchemaFinding, error)
- func (s *BloodhoundDB) UpdateSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
- func (s *BloodhoundDB) UpdateTierPositions(ctx context.Context, user model.User, orderedTags model.AssetGroupTags, ...) error
- func (s *BloodhoundDB) UpdateUser(ctx context.Context, user model.User) error
- func (s *BloodhoundDB) UpsertKind(ctx context.Context, name string) (model.Kind, error)
- func (s *BloodhoundDB) UpsertOpenGraphExtension(ctx context.Context, graphExtensionInput model.GraphExtensionInput) (model.GraphExtensionUpsertResult, error)
- func (s *BloodhoundDB) Wipe(ctx context.Context) error
- type CustomNodeKindData
- type DataQualityData
- type Databasedeprecated
- type DatapipeStatusData
- type EnvironmentTargetedAccessControlData
- type FilterAndPagination
- type GormLogAdapter
- func (s *GormLogAdapter) Error(ctx context.Context, msg string, data ...any)
- func (s *GormLogAdapter) Info(ctx context.Context, msg string, data ...any)
- func (s *GormLogAdapter) LogMode(level logger.LogLevel) logger.Interface
- func (s *GormLogAdapter) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (s *GormLogAdapter) Warn(ctx context.Context, msg string, data ...any)
- type Kind
- type OIDCProviderData
- type OpenGraphSchema
- type SAMLConsumedData
- type SAMLProviderData
- type SSOProviderData
- type SavedQueriesData
- type SavedQueriesPermissionsData
- type SavedQueryScopes
- type ScopeFunc
- type SourceKindsData
- type UpdateCertificationBySelectorNodeInput
Constants ¶
const CustomNodeIconType = "font-awesome"
const (
DuplicateKeyValueErrorString = "duplicate key value violates unique constraint"
)
const (
ETACTable = "environment_targeted_access_control"
)
const (
// PostgresUniqueViolationCode is the SQLSTATE code for unique constraint violations.
PostgresUniqueViolationCode = "23505"
)
Variables ¶
var ( ErrDuplicateAGName = errors.New("duplicate asset group name") ErrDuplicateAGTag = errors.New("duplicate asset group tag") ErrDuplicateAGTagSelectorName = errors.New("duplicate asset group tag selector name") ErrDuplicateAGTagSelectorRuleKey = errors.New("duplicate asset group tag selector rule key") ErrDuplicateSSOProviderName = errors.New("duplicate sso provider name") ErrDuplicateUserPrincipal = errors.New("duplicate user principal name") ErrDuplicateEmail = errors.New("duplicate user email address") ErrDuplicateCustomNodeKindName = errors.New("duplicate custom node kind name") ErrDuplicateKindName = errors.New("duplicate kind name") ErrDuplicateGlyph = errors.New("duplicate glyph") ErrPositionOutOfRange = errors.New("position out of range") ErrSAMLIdentifierAlreadyConsumed = errors.New("SAMLResponse or assertion has already been consumed") )
var CustomNodeKindStubConfig = model.CustomNodeKindConfig{ Icon: graphschema.DisplayNodeIcon{ Name: "question", Type: graphschema.DisplayNodeTypeFontAwesome, Color: "#FFFFFF", }, }
CustomNodeKindStubConfig is the default display config used when a node kind is encountered during ingest but has no display configuration yet. custom_node_kinds was originally scoped to OpenGraph extension kinds but now serves as the runtime display registry for any non-built-in, non-framework kind.
var (
ErrAuthContextInvalid = errors.New("auth context is invalid")
)
var ErrInvalidSortDirection = errors.New("invalid sort direction")
var (
ErrNotFound = errors.New("entity not found")
)
Functions ¶
func CheckError ¶
func NewClientAuthToken ¶
NewClientAuthToken creates a new Client AuthToken row using the details provided INSERT INTO auth_tokens (client_id, hmac_method, last_access) VALUES (...)
func OpenDatabase ¶
Types ¶
type AgiData ¶
type AgiData interface {
CreateAssetGroup(ctx context.Context, name, tag string, systemGroup bool) (model.AssetGroup, error)
UpdateAssetGroup(ctx context.Context, assetGroup model.AssetGroup) error
DeleteAssetGroup(ctx context.Context, assetGroup model.AssetGroup) error
GetAllAssetGroups(ctx context.Context, order string, filter model.SQLFilter) (model.AssetGroups, error)
GetAssetGroup(ctx context.Context, id int32) (model.AssetGroup, error)
SweepAssetGroupCollections(ctx context.Context)
GetAssetGroupCollections(ctx context.Context, assetGroupID int32, order string, filter model.SQLFilter) (model.AssetGroupCollections, error)
CreateAssetGroupCollection(ctx context.Context, collection model.AssetGroupCollection, entries model.AssetGroupCollectionEntries) error
GetLatestAssetGroupCollection(ctx context.Context, assetGroupID int32) (model.AssetGroupCollection, error)
GetTimeRangedAssetGroupCollections(ctx context.Context, assetGroupID int32, from int64, to int64, order string) (model.AssetGroupCollections, error)
GetAssetGroupSelector(ctx context.Context, id int32) (model.AssetGroupSelector, error)
DeleteAssetGroupSelector(ctx context.Context, selector model.AssetGroupSelector) error
UpdateAssetGroupSelectors(ctx context.Context, assetGroup model.AssetGroup, selectorSpecs []model.AssetGroupSelectorSpec, systemSelector bool) (model.UpdatedAssetGroupSelectors, error)
DeleteAssetGroupSelectorsForAssetGroups(ctx context.Context, assetGroupIds []int) error
}
type AnalysisRequestData ¶
type AnalysisRequestData interface {
DeleteAnalysisRequest(ctx context.Context) error
GetAnalysisRequest(ctx context.Context) (model.AnalysisRequest, error)
HasAnalysisRequest(ctx context.Context) bool
HasCollectedGraphDataDeletionRequest(ctx context.Context) (model.AnalysisRequest, bool)
RequestAnalysis(ctx context.Context, requester string, analysisMode model.AnalysisMode) error
RequestCollectedGraphDataDeletion(ctx context.Context, request model.AnalysisRequest) error
}
type AssetGroupHistoryData ¶
type AssetGroupHistoryData interface {
CreateAssetGroupHistoryRecord(ctx context.Context, actorId, email string, target string, action model.AssetGroupHistoryAction, assetGroupTagId int, environmentId, note null.String) error
GetAssetGroupHistoryRecords(ctx context.Context, sqlFilter model.SQLFilter, sortItems model.Sort, skip, limit int) ([]model.AssetGroupHistory, int, error)
DeleteAssetGroupHistoryRecordsByCreatedDate(ctx context.Context, createdAt time.Time) (int64, error)
}
AssetGroupHistoryData defines the methods required to interact with the asset_group_history table
type AssetGroupTagData ¶
type AssetGroupTagData interface {
CreateAssetGroupTag(ctx context.Context, tagType model.AssetGroupTagType, user model.User, name string, description string, position null.Int32, requireCertify null.Bool, glyph null.String) (model.AssetGroupTag, error)
UpdateAssetGroupTag(ctx context.Context, user model.User, tag model.AssetGroupTag) (model.AssetGroupTag, error)
SanitizeUpdateAssetGroupTagRequireCertify(tag *model.AssetGroupTag)
DeleteAssetGroupTag(ctx context.Context, user model.User, assetGroupTag model.AssetGroupTag) error
GetAssetGroupTag(ctx context.Context, assetGroupTagId int) (model.AssetGroupTag, error)
GetAssetGroupTags(ctx context.Context, sqlFilter model.SQLFilter) (model.AssetGroupTags, error)
GetOrderedAssetGroupTagTiers(ctx context.Context) ([]model.AssetGroupTag, error)
GetAssetGroupTagForSelection(ctx context.Context) ([]model.AssetGroupTag, error)
}
AssetGroupTagData defines the methods required to interact with the asset_group_tags table
type AssetGroupTagSelectorData ¶
type AssetGroupTagSelectorData interface {
CreateAssetGroupTagSelector(ctx context.Context, user model.User, selector model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
GetAssetGroupTagSelectorBySelectorId(ctx context.Context, assetGroupTagSelectorId int) (model.AssetGroupTagSelector, error)
UpdateAssetGroupTagSelector(ctx context.Context, actorId, email string, selector model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
UpdateOpenGraphAssetGroupTagSelector(ctx context.Context, extensionId int32, input model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
DeleteAssetGroupTagSelector(ctx context.Context, user model.User, selector model.AssetGroupTagSelector) error
GetAssetGroupTagSelectorCounts(ctx context.Context, tagIds []int) (model.AssetGroupTagCountsMap, error)
GetAssetGroupTagSelectorsByTagId(ctx context.Context, assetGroupTagId int) (model.AssetGroupTagSelectors, int, error)
GetAssetGroupTagSelectorsByTagIdFilteredAndPaginated(ctx context.Context, assetGroupTagId int, selectorSqlFilter, selectorSeedSqlFilter model.SQLFilter, sort model.Sort, skip, limit int) (model.AssetGroupTagSelectors, int, error)
GetCustomAssetGroupTagSelectorsToMigrate(ctx context.Context) (model.AssetGroupTagSelectors, error)
GetAssetGroupTagSelectors(ctx context.Context, sqlFilter model.SQLFilter, limit int) (model.AssetGroupTagSelectors, error)
GetAssetGroupTagSelectorsByExtensionId(ctx context.Context, extensionId int32) (model.AssetGroupTagSelectors, error)
}
AssetGroupTagSelectorData defines the methods required to interact with the asset_group_tag_selectors and asset_group_tag_selector_seeds tables
type AssetGroupTagSelectorNodeData ¶
type AssetGroupTagSelectorNodeData interface {
InsertSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
UpdateSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
UpdateCertificationBySelectorNode(ctx context.Context, input []UpdateCertificationBySelectorNodeInput) error
DeleteSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
DeleteSelectorNodesBySelectorIds(ctx context.Context, selectorId ...int) error
GetSelectorNodesBySelectorIds(ctx context.Context, selectorIds ...int) ([]model.AssetGroupSelectorNode, error)
GetSelectorNodesBySelectorIdsFilteredAndPaginated(ctx context.Context, sqlFilter model.SQLFilter, sort model.Sort, skip, limit int, selectorIds ...int) ([]model.AssetGroupSelectorNode, int, error)
GetSelectorsByMemberId(ctx context.Context, memberId int, assetGroupTagId int) (model.AssetGroupTagSelectors, error)
GetAssetGroupSelectorNodeExpandedOrderedByIdAndPosition(ctx context.Context, nodeIds ...int) ([]model.AssetGroupSelectorNodeExpanded, error)
GetAggregatedSelectorNodesCertification(ctx context.Context, sqlFilter model.SQLFilter, skip, limit int) ([]model.AssetGroupSelectorNodeExpanded, int, error)
}
AssetGroupTagSelectorNodeData defines the methods required to interact with the asset_group_tag_selector_nodes table
type BloodhoundDB ¶
type BloodhoundDB struct {
// contains filtered or unexported fields
}
func NewBloodhoundDB ¶
func NewBloodhoundDB(db *gorm.DB, pool *pgxpool.Pool, idResolver auth.IdentityResolver, cfg config.Configuration) *BloodhoundDB
func (*BloodhoundDB) AppendAuditLog ¶
func (s *BloodhoundDB) AppendAuditLog(ctx context.Context, entry model.AuditEntry) error
func (*BloodhoundDB) AuditableTransaction ¶
func (*BloodhoundDB) CancelAllIngestJobs ¶
func (s *BloodhoundDB) CancelAllIngestJobs(ctx context.Context) error
func (*BloodhoundDB) Close ¶
func (s *BloodhoundDB) Close(ctx context.Context)
func (*BloodhoundDB) CountAllIngestTasks ¶
func (s *BloodhoundDB) CountAllIngestTasks(ctx context.Context) (int64, error)
func (*BloodhoundDB) CreateADDataQualityAggregation ¶
func (s *BloodhoundDB) CreateADDataQualityAggregation(ctx context.Context, aggregation model.ADDataQualityAggregation) (model.ADDataQualityAggregation, error)
func (*BloodhoundDB) CreateADDataQualityStats ¶
func (s *BloodhoundDB) CreateADDataQualityStats(ctx context.Context, stats model.ADDataQualityStats) (model.ADDataQualityStats, error)
func (*BloodhoundDB) CreateAssetGroup ¶
func (s *BloodhoundDB) CreateAssetGroup(ctx context.Context, name, tag string, systemGroup bool) (model.AssetGroup, error)
func (*BloodhoundDB) CreateAssetGroupCollection ¶
func (s *BloodhoundDB) CreateAssetGroupCollection(ctx context.Context, collection model.AssetGroupCollection, entries model.AssetGroupCollectionEntries) error
func (*BloodhoundDB) CreateAssetGroupHistoryRecord ¶
func (*BloodhoundDB) CreateAssetGroupTag ¶
func (*BloodhoundDB) CreateAssetGroupTagSelector ¶
func (s *BloodhoundDB) CreateAssetGroupTagSelector(ctx context.Context, user model.User, selector model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
func (*BloodhoundDB) CreateAuditLog ¶
func (*BloodhoundDB) CreateAuthSecret ¶
func (s *BloodhoundDB) CreateAuthSecret(ctx context.Context, authSecret model.AuthSecret) (model.AuthSecret, error)
CreateAuthSecret creates a new AuthSecret row INSERT INTO auth_secrets (...) VALUES (....)
func (*BloodhoundDB) CreateAuthToken ¶
func (s *BloodhoundDB) CreateAuthToken(ctx context.Context, authToken model.AuthToken) (model.AuthToken, error)
CreateAuthToken creates a new AuthToken row using the provided struct INSERT INTO auth_tokens (...) VALUES (....)
func (*BloodhoundDB) CreateAzureDataQualityAggregation ¶
func (s *BloodhoundDB) CreateAzureDataQualityAggregation(ctx context.Context, aggregation model.AzureDataQualityAggregation) (model.AzureDataQualityAggregation, error)
func (*BloodhoundDB) CreateAzureDataQualityStats ¶
func (s *BloodhoundDB) CreateAzureDataQualityStats(ctx context.Context, stats model.AzureDataQualityStats) (model.AzureDataQualityStats, error)
func (*BloodhoundDB) CreateCompletedTask ¶
func (s *BloodhoundDB) CreateCompletedTask(ctx context.Context, task model.CompletedTask) (model.CompletedTask, error)
func (*BloodhoundDB) CreateCompositionInfo ¶
func (s *BloodhoundDB) CreateCompositionInfo(ctx context.Context, nodes model.EdgeCompositionNodes, edges model.EdgeCompositionEdges) (model.EdgeCompositionNodes, model.EdgeCompositionEdges, error)
func (*BloodhoundDB) CreateCustomNodeKinds ¶
func (s *BloodhoundDB) CreateCustomNodeKinds(ctx context.Context, customNodeKinds model.CustomNodeKinds) (model.CustomNodeKinds, error)
func (*BloodhoundDB) CreateDataQualityAggregations ¶
func (s *BloodhoundDB) CreateDataQualityAggregations(ctx context.Context, aggregations model.DataQualityAggregations) (model.DataQualityAggregations, error)
CreateDataQualityAggregations batch-inserts the given slice of model.DataQualityAggregation.
func (*BloodhoundDB) CreateDataQualityStats ¶
func (s *BloodhoundDB) CreateDataQualityStats(ctx context.Context, stats model.DataQualityStats) (model.DataQualityStats, error)
func (*BloodhoundDB) CreateEnvironment ¶
func (s *BloodhoundDB) CreateEnvironment(ctx context.Context, extensionId int32, environmentKindId int32, sourceKindId int32) (model.SchemaEnvironment, error)
CreateEnvironment - creates a new schema_environment. Uses a CTE to JOIN the kinds table against the RETURNING clause so that EnvironmentKindName is populated in the returned struct without a separate re-fetch.
func (*BloodhoundDB) CreateEnvironmentWithPrincipalKinds ¶
func (s *BloodhoundDB) CreateEnvironmentWithPrincipalKinds(ctx context.Context, extensionId int32, input model.EnvironmentInput) (model.SchemaEnvironment, error)
CreateEnvironmentWithPrincipalKinds translates FK names, creates the environment row, and reconciles its principal kinds.
func (*BloodhoundDB) CreateFindingWithRemediation ¶
func (s *BloodhoundDB) CreateFindingWithRemediation(ctx context.Context, extensionId int32, input model.RelationshipFindingInput) (model.SchemaFinding, error)
CreateFindingWithRemediation translates FK names, creates the finding, and creates its 1:1 remediation.
func (*BloodhoundDB) CreateGraphSchemaExtension ¶
func (s *BloodhoundDB) CreateGraphSchemaExtension(ctx context.Context, name string, displayName string, version string, namespace string) (model.GraphSchemaExtension, error)
CreateGraphSchemaExtension creates a new row in the extensions table. A GraphSchemaExtension struct is returned, populated with the value as it stands in the database.
func (*BloodhoundDB) CreateGraphSchemaNodeKind ¶
func (s *BloodhoundDB) CreateGraphSchemaNodeKind(ctx context.Context, name string, extensionId int32, displayName string, description string, isDisplayKind bool, icon, iconColor string) (model.GraphSchemaNodeKind, error)
CreateGraphSchemaNodeKind - creates a new row in the schema_node_kinds table. A model.GraphSchemaNodeKind struct is returned, populated with the value as it stands in the database. This will also create a kind in the DAWGS kind table if the kind does not already exist.
Since this inserts directly into the kinds table, the business logic calling this func must also call the DAWGS RefreshKinds function to ensure the kinds are reloaded into the in memory kind map.
func (*BloodhoundDB) CreateGraphSchemaProperty ¶
func (s *BloodhoundDB) CreateGraphSchemaProperty(ctx context.Context, extensionId int32, name string, displayName string, dataType string, description string) (model.GraphSchemaProperty, error)
CreateGraphSchemaProperty creates a new row in the schema_properties table. A GraphSchemaProperty struct is returned, populated with the value as it stands in the database.
func (*BloodhoundDB) CreateGraphSchemaRelationshipKind ¶
func (s *BloodhoundDB) CreateGraphSchemaRelationshipKind(ctx context.Context, name string, schemaExtensionId int32, description string, isTraversable bool) (model.GraphSchemaRelationshipKind, error)
CreateGraphSchemaRelationshipKind - creates a new row in the schema_relationship_kinds table. A model.GraphSchemaRelationshipKind struct is returned, populated with the value as it stands in the database. This will also create a kind in the DAWGS kind table if the kind does not already exist.
Since this inserts directly into the kinds table, the business logic calling this func must also call the DAWGS RefreshKinds function to ensure the kinds are reloaded into the in memory kind map.
func (*BloodhoundDB) CreateIngestJob ¶
func (*BloodhoundDB) CreateIngestTask ¶
func (s *BloodhoundDB) CreateIngestTask(ctx context.Context, ingestTask model.IngestTask) (model.IngestTask, error)
func (*BloodhoundDB) CreateInstallation ¶
func (s *BloodhoundDB) CreateInstallation(ctx context.Context) (model.Installation, error)
CreateInstallation creates a new Installation row INSERT INTO installations(....) VALUES (...)
func (*BloodhoundDB) CreateKindInfo ¶
func (s *BloodhoundDB) CreateKindInfo(ctx context.Context, kindID int32, nodeKindID, relationshipKindID *int32, kindInfo model.KindInfoInput) (model.GraphSchemaKindInfo, error)
func (*BloodhoundDB) CreateOIDCProvider ¶
func (s *BloodhoundDB) CreateOIDCProvider(ctx context.Context, name, issuer, clientID string, config model.SSOProviderConfig) (model.OIDCProvider, error)
CreateOIDCProvider creates a new entry for an OIDC provider as well as the associated SSO provider
func (*BloodhoundDB) CreatePrincipalKind ¶
func (s *BloodhoundDB) CreatePrincipalKind(ctx context.Context, environmentId int32, principalKind int32) (model.SchemaEnvironmentPrincipalKind, error)
func (*BloodhoundDB) CreateRemediation ¶
func (*BloodhoundDB) CreateSAMLConsumedIdentifiers ¶
func (s *BloodhoundDB) CreateSAMLConsumedIdentifiers(ctx context.Context, ssoProviderID int32, idpIssuer, responseID, assertionID string, expiresAt time.Time) error
CreateSAMLConsumedIdentifiers inserts the SAMLResponse and assertion from a single SAML login so they cannot be replayed. Both identifiers are inserted together or not at all. If either identifier has already been consumed, it returns ErrSAMLIdentifierAlreadyConsumed and no records are written.
func (*BloodhoundDB) CreateSAMLIdentityProvider ¶
func (s *BloodhoundDB) CreateSAMLIdentityProvider(ctx context.Context, samlProvider model.SAMLProvider, config model.SSOProviderConfig) (model.SAMLProvider, error)
CreateSAMLIdentityProvider creates a new saml_providers row using the data in the input struct This also creates the corresponding sso_provider entry INSERT INTO saml_identity_providers (...) VALUES (...)
func (*BloodhoundDB) CreateSSOProvider ¶
func (s *BloodhoundDB) CreateSSOProvider(ctx context.Context, name string, authProvider model.SessionAuthProvider, config model.SSOProviderConfig) (model.SSOProvider, error)
CreateSSOProvider creates an entry in the sso_providers table A slug will be created for the SSO Provider using the name argument as a base. The name will be lower cased and all spaces are replaced with `-`
func (*BloodhoundDB) CreateSavedQueries ¶
func (s *BloodhoundDB) CreateSavedQueries(ctx context.Context, savedQueries model.SavedQueries) error
CreateSavedQueries - inserts saved queries records in batches
func (*BloodhoundDB) CreateSavedQuery ¶
func (*BloodhoundDB) CreateSavedQueryPermissionToPublic ¶
func (s *BloodhoundDB) CreateSavedQueryPermissionToPublic(ctx context.Context, queryID int64) (model.SavedQueriesPermissions, error)
CreateSavedQueryPermissionToPublic creates a new entry to the SavedQueriesPermissions table granting public read permissions to all users
func (*BloodhoundDB) CreateSavedQueryPermissionsToUsers ¶
func (s *BloodhoundDB) CreateSavedQueryPermissionsToUsers(ctx context.Context, queryID int64, userIDs ...uuid.UUID) ([]model.SavedQueriesPermissions, error)
CreateSavedQueryPermissionsToUsers - attempts to save the given saved query permissions in batches of 100 in a transaction. This will remove previously shared with users and replace it with the incoming user ids.
func (*BloodhoundDB) CreateSchemaFinding ¶
func (s *BloodhoundDB) CreateSchemaFinding(ctx context.Context, findingType model.SchemaFindingType, extensionId int32, kindId int32, environmentId int32, name string, displayName string, pzDisplayName string) (model.SchemaFinding, error)
CreateSchemaFinding - creates a new schema finding.
func (*BloodhoundDB) CreateSchemaFindingSubtype ¶
func (*BloodhoundDB) CreateUser ¶
CreateUser creates a new user INSERT INTO users (...) VALUES (...)
func (*BloodhoundDB) CreateUserSession ¶
func (s *BloodhoundDB) CreateUserSession(ctx context.Context, userSession model.UserSession) (model.UserSession, error)
CreateUserSession creates a new UserSession row INSERT INTO user_sessions (...) VALUES (..)
func (*BloodhoundDB) DeleteAllAuthTokens ¶
func (s *BloodhoundDB) DeleteAllAuthTokens(ctx context.Context) error
DeleteAllAuthTokens deletes all tokens at startup if the APITokens parameter is disabled (enabled=false). An audit log is created for this action.
func (*BloodhoundDB) DeleteAllDataQuality ¶
func (s *BloodhoundDB) DeleteAllDataQuality(ctx context.Context) error
func (*BloodhoundDB) DeleteAllIngestJobs ¶
func (s *BloodhoundDB) DeleteAllIngestJobs(ctx context.Context) error
func (*BloodhoundDB) DeleteAllIngestTasks ¶
func (s *BloodhoundDB) DeleteAllIngestTasks(ctx context.Context) error
func (*BloodhoundDB) DeleteAnalysisRequest ¶
func (s *BloodhoundDB) DeleteAnalysisRequest(ctx context.Context) error
func (*BloodhoundDB) DeleteAssetGroup ¶
func (s *BloodhoundDB) DeleteAssetGroup(ctx context.Context, assetGroup model.AssetGroup) error
func (*BloodhoundDB) DeleteAssetGroupHistoryRecordsByCreatedDate ¶
func (*BloodhoundDB) DeleteAssetGroupSelector ¶
func (s *BloodhoundDB) DeleteAssetGroupSelector(ctx context.Context, selector model.AssetGroupSelector) error
func (*BloodhoundDB) DeleteAssetGroupSelectorsForAssetGroups ¶
func (s *BloodhoundDB) DeleteAssetGroupSelectorsForAssetGroups(ctx context.Context, assetGroupIds []int) error
func (*BloodhoundDB) DeleteAssetGroupTag ¶
func (s *BloodhoundDB) DeleteAssetGroupTag(ctx context.Context, user model.User, assetGroupTag model.AssetGroupTag) error
func (*BloodhoundDB) DeleteAssetGroupTagSelector ¶
func (s *BloodhoundDB) DeleteAssetGroupTagSelector(ctx context.Context, user model.User, selector model.AssetGroupTagSelector) error
func (*BloodhoundDB) DeleteAuthSecret ¶
func (s *BloodhoundDB) DeleteAuthSecret(ctx context.Context, authSecret model.AuthSecret) error
DeleteAuthSecret deletes the auth secret row corresponding to the struct specified DELETE FROM auth_secrets WHERE user_id = ...
func (*BloodhoundDB) DeleteAuthToken ¶
DeleteAuthToken deletes the provided AuthToken row DELETE FROM auth_tokens WHERE id = ...
func (*BloodhoundDB) DeleteCustomNodeKind ¶
func (s *BloodhoundDB) DeleteCustomNodeKind(ctx context.Context, kindName string) error
func (*BloodhoundDB) DeleteEnvironment ¶
func (s *BloodhoundDB) DeleteEnvironment(ctx context.Context, environmentId int32) error
DeleteEnvironment - deletes a schema environment by id.
func (*BloodhoundDB) DeleteEnvironmentTargetedAccessControlForUser ¶
func (s *BloodhoundDB) DeleteEnvironmentTargetedAccessControlForUser(ctx context.Context, user model.User) error
DeleteEnvironmentTargetedAccessControlForUser will remove all rows associated with a user in the environment_targeted_access_control table
func (*BloodhoundDB) DeleteExpiredAuthTokens ¶
func (s *BloodhoundDB) DeleteExpiredAuthTokens(ctx context.Context) error
func (*BloodhoundDB) DeleteGraphSchemaExtension ¶
func (s *BloodhoundDB) DeleteGraphSchemaExtension(ctx context.Context, extensionId int32) error
DeleteGraphSchemaExtension deletes an existing Graph Schema Extension based on the extension ID. It returns an error if the extension does not exist. Built-In Extensions will return an error if there is an attempt to delete it.
func (*BloodhoundDB) DeleteGraphSchemaNodeKind ¶
func (s *BloodhoundDB) DeleteGraphSchemaNodeKind(ctx context.Context, schemaNodeKindId int32) error
DeleteGraphSchemaNodeKind - deletes a schema_node_kinds row based on the provided id. Will return an error if that id does not exist.
func (*BloodhoundDB) DeleteGraphSchemaProperty ¶
func (s *BloodhoundDB) DeleteGraphSchemaProperty(ctx context.Context, propertyID int32) error
DeleteGraphSchemaProperty - deletes a schema_properties row based on the provided id. It will return an error if that id does not exist.
func (*BloodhoundDB) DeleteGraphSchemaRelationshipKind ¶
func (s *BloodhoundDB) DeleteGraphSchemaRelationshipKind(ctx context.Context, schemaRelationshipKindId int32) error
DeleteGraphSchemaRelationshipKind - deletes a schema_relationship_kind row based on the provided id. It will return an error if that id does not exist.
func (*BloodhoundDB) DeleteIngestTask ¶
func (s *BloodhoundDB) DeleteIngestTask(ctx context.Context, ingestTask model.IngestTask) error
func (*BloodhoundDB) DeleteKindInfo ¶
func (s *BloodhoundDB) DeleteKindInfo(ctx context.Context, kindInfoID int32) error
func (*BloodhoundDB) DeletePrincipalKind ¶
func (*BloodhoundDB) DeleteRemediation ¶
func (s *BloodhoundDB) DeleteRemediation(ctx context.Context, findingId int32) error
func (*BloodhoundDB) DeleteSSOProvider ¶
func (s *BloodhoundDB) DeleteSSOProvider(ctx context.Context, id int) error
DeleteSSOProvider deletes a sso_provider entry with a matching id
func (*BloodhoundDB) DeleteSavedQuery ¶
func (s *BloodhoundDB) DeleteSavedQuery(ctx context.Context, savedQueryID int64) error
func (*BloodhoundDB) DeleteSavedQueryPermissionsForUsers ¶
func (s *BloodhoundDB) DeleteSavedQueryPermissionsForUsers(ctx context.Context, queryID int64, userIDs ...uuid.UUID) error
DeleteSavedQueryPermissionsForUsers batch deletes permissions associated with a query id and a list of users If no user ids are supplied, all records for query id are deleted
func (*BloodhoundDB) DeleteSchemaFinding ¶
func (s *BloodhoundDB) DeleteSchemaFinding(ctx context.Context, findingId int32) error
DeleteSchemaFinding - deletes a schema finding by id.
func (*BloodhoundDB) DeleteSelectorNodes ¶
func (s *BloodhoundDB) DeleteSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
func (*BloodhoundDB) DeleteSelectorNodesBySelectorIds ¶
func (s *BloodhoundDB) DeleteSelectorNodesBySelectorIds(ctx context.Context, selectorIds ...int) error
func (*BloodhoundDB) DeleteSourceKindsByName ¶
func (s *BloodhoundDB) DeleteSourceKindsByName(ctx context.Context, names ...string) error
func (*BloodhoundDB) DeleteUser ¶
DeleteUser removes all roles for a given user, thereby revoking all permissions UPDATE users SET roles = nil WHERE user_id = ....
func (*BloodhoundDB) EndUserSession ¶
func (s *BloodhoundDB) EndUserSession(ctx context.Context, userSession model.UserSession)
EndUserSession terminates the provided session UPDATE user_sessions SET expires_at = <now> WHERE user_id = ...
func (*BloodhoundDB) EnsureStubbedCustomNodeKindForIngest ¶
func (s *BloodhoundDB) EnsureStubbedCustomNodeKindForIngest(ctx context.Context, name string) error
func (*BloodhoundDB) GetADDataQualityAggregations ¶
func (*BloodhoundDB) GetADDataQualityStats ¶
func (*BloodhoundDB) GetAggregateADDataQualityStats ¶
func (s *BloodhoundDB) GetAggregateADDataQualityStats(ctx context.Context, domainSIDs []string, start time.Time, end time.Time) (model.ADDataQualityStats, error)
GetAggregateADDataQualityStats will aggregate AD Quality stats by summing the maximum asset counts per environment per day. Due to session and group completeness being percentages, it will return the single maximum value of all environments per day.
func (*BloodhoundDB) GetAggregatedSelectorNodesCertification ¶
func (s *BloodhoundDB) GetAggregatedSelectorNodesCertification(ctx context.Context, sqlFilter model.SQLFilter, skip, limit int) ([]model.AssetGroupSelectorNodeExpanded, int, error)
func (*BloodhoundDB) GetAllAssetGroups ¶
func (s *BloodhoundDB) GetAllAssetGroups(ctx context.Context, order string, filter model.SQLFilter) (model.AssetGroups, error)
func (*BloodhoundDB) GetAllAuthTokens ¶
func (s *BloodhoundDB) GetAllAuthTokens(ctx context.Context, order string, filter model.SQLFilter) (model.AuthTokens, error)
func (*BloodhoundDB) GetAllConfigurationParameters ¶
func (s *BloodhoundDB) GetAllConfigurationParameters(ctx context.Context) (appcfg.Parameters, error)
func (*BloodhoundDB) GetAllFlags ¶
func (s *BloodhoundDB) GetAllFlags(ctx context.Context) ([]appcfg.FeatureFlag, error)
func (*BloodhoundDB) GetAllIngestJobs ¶
func (*BloodhoundDB) GetAllIngestTasks ¶
func (s *BloodhoundDB) GetAllIngestTasks(ctx context.Context) (model.IngestTasks, error)
func (*BloodhoundDB) GetAllRoles ¶
func (s *BloodhoundDB) GetAllRoles(ctx context.Context, order string, filter model.SQLFilter) (model.Roles, error)
GetAllRoles retrieves all available roles in the db SELECT * FROM roles
func (*BloodhoundDB) GetAllSAMLProviders ¶
func (s *BloodhoundDB) GetAllSAMLProviders(ctx context.Context) (model.SAMLProviders, error)
GetAllSAMLProviders returns all SAML providers SELECT * FROM saml_providers
func (*BloodhoundDB) GetAllSSOProviders ¶
func (s *BloodhoundDB) GetAllSSOProviders(ctx context.Context, order string, sqlFilter model.SQLFilter) ([]model.SSOProvider, error)
func (*BloodhoundDB) GetAllSavedQueriesByUser ¶
func (s *BloodhoundDB) GetAllSavedQueriesByUser(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
GetAllSavedQueriesByUser - Returns queries that are public, owned by, or shared to the user.
func (*BloodhoundDB) GetAllUsers ¶
func (*BloodhoundDB) GetAnalysisRequest ¶
func (s *BloodhoundDB) GetAnalysisRequest(ctx context.Context) (model.AnalysisRequest, error)
func (*BloodhoundDB) GetAssetGroup ¶
func (s *BloodhoundDB) GetAssetGroup(ctx context.Context, id int32) (model.AssetGroup, error)
func (*BloodhoundDB) GetAssetGroupCollections ¶
func (s *BloodhoundDB) GetAssetGroupCollections(ctx context.Context, assetGroupID int32, order string, filter model.SQLFilter) (model.AssetGroupCollections, error)
func (*BloodhoundDB) GetAssetGroupHistoryRecords ¶
func (*BloodhoundDB) GetAssetGroupSelector ¶
func (s *BloodhoundDB) GetAssetGroupSelector(ctx context.Context, id int32) (model.AssetGroupSelector, error)
func (*BloodhoundDB) GetAssetGroupSelectorNodeExpandedOrderedByIdAndPosition ¶
func (s *BloodhoundDB) GetAssetGroupSelectorNodeExpandedOrderedByIdAndPosition(ctx context.Context, nodeIds ...int) ([]model.AssetGroupSelectorNodeExpanded, error)
func (*BloodhoundDB) GetAssetGroupTag ¶
func (s *BloodhoundDB) GetAssetGroupTag(ctx context.Context, assetGroupTagId int) (model.AssetGroupTag, error)
func (*BloodhoundDB) GetAssetGroupTagForSelection ¶
func (s *BloodhoundDB) GetAssetGroupTagForSelection(ctx context.Context) ([]model.AssetGroupTag, error)
func (*BloodhoundDB) GetAssetGroupTagSelectorBySelectorId ¶
func (s *BloodhoundDB) GetAssetGroupTagSelectorBySelectorId(ctx context.Context, assetGroupTagSelectorId int) (model.AssetGroupTagSelector, error)
func (*BloodhoundDB) GetAssetGroupTagSelectorCounts ¶
func (s *BloodhoundDB) GetAssetGroupTagSelectorCounts(ctx context.Context, tagIds []int) (model.AssetGroupTagCountsMap, error)
func (*BloodhoundDB) GetAssetGroupTagSelectors ¶
func (s *BloodhoundDB) GetAssetGroupTagSelectors(ctx context.Context, sqlFilter model.SQLFilter, limit int) (model.AssetGroupTagSelectors, error)
func (*BloodhoundDB) GetAssetGroupTagSelectorsByExtensionId ¶
func (s *BloodhoundDB) GetAssetGroupTagSelectorsByExtensionId(ctx context.Context, extensionId int32) (model.AssetGroupTagSelectors, error)
func (*BloodhoundDB) GetAssetGroupTagSelectorsByTagId ¶
func (s *BloodhoundDB) GetAssetGroupTagSelectorsByTagId(ctx context.Context, assetGroupTagId int) (model.AssetGroupTagSelectors, int, error)
func (*BloodhoundDB) GetAssetGroupTagSelectorsByTagIdFilteredAndPaginated ¶
func (*BloodhoundDB) GetAssetGroupTags ¶
func (s *BloodhoundDB) GetAssetGroupTags(ctx context.Context, sqlFilter model.SQLFilter) (model.AssetGroupTags, error)
func (*BloodhoundDB) GetAuthSecret ¶
func (s *BloodhoundDB) GetAuthSecret(ctx context.Context, id int32) (model.AuthSecret, error)
GetAuthSecret retrieves the AuthSecret row associated with the provided ID SELECT * FROM auth_secrets WHERE id = ....
func (*BloodhoundDB) GetAuthToken ¶
GetAuthToken retrieves the AuthToken row associated with the provided ID SELECT * FROM auth_tokens WHERE id = ....
func (*BloodhoundDB) GetAzureDataQualityAggregations ¶
func (*BloodhoundDB) GetAzureDataQualityStats ¶
func (*BloodhoundDB) GetCompletedTasks ¶
func (s *BloodhoundDB) GetCompletedTasks(ctx context.Context, ingestJobId int64) ([]model.CompletedTask, error)
func (*BloodhoundDB) GetConfigurationParameter ¶
func (s *BloodhoundDB) GetConfigurationParameter(ctx context.Context, parameterKey appcfg.ParameterKey) (appcfg.Parameter, error)
func (*BloodhoundDB) GetCustomAssetGroupTagSelectorsToMigrate ¶
func (s *BloodhoundDB) GetCustomAssetGroupTagSelectorsToMigrate(ctx context.Context) (model.AssetGroupTagSelectors, error)
func (*BloodhoundDB) GetCustomNodeKind ¶
func (s *BloodhoundDB) GetCustomNodeKind(ctx context.Context, kindName string) (model.CustomNodeKind, error)
func (*BloodhoundDB) GetCustomNodeKinds ¶
func (s *BloodhoundDB) GetCustomNodeKinds(ctx context.Context) ([]model.CustomNodeKind, error)
func (*BloodhoundDB) GetDataQualityAggregations ¶
func (s *BloodhoundDB) GetDataQualityAggregations(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.DataQualityAggregations, int, error)
GetDataQualityAggregations returns filtered, paginated model.DataQualityAggregations and the total count of matching rows, excluding soft-deleted rows. When no sort is provided, results default to created_at descending with id ascending as a tiebreaker.
func (*BloodhoundDB) GetDataQualityStats ¶
func (s *BloodhoundDB) GetDataQualityStats(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.DataQualityStats, int, error)
GetDataQualityStats gets all rows from the Data Quality Stats table that match the given SQL Filter. If no sorting is provided, it will sort rows by the CreatedAt date in descending order with id ascending as a tiebreaker.
func (*BloodhoundDB) GetDatapipeStatus ¶
func (s *BloodhoundDB) GetDatapipeStatus(ctx context.Context) (model.DatapipeStatusWrapper, error)
func (*BloodhoundDB) GetEnvironmentByEnvironmentKindId ¶
func (s *BloodhoundDB) GetEnvironmentByEnvironmentKindId(ctx context.Context, environmentKindId int32) (model.SchemaEnvironment, error)
GetEnvironmentByEnvironmentKindId - retrieves a schema environment by environment_kind_id.
func (*BloodhoundDB) GetEnvironmentById ¶
func (s *BloodhoundDB) GetEnvironmentById(ctx context.Context, environmentId int32) (model.SchemaEnvironment, error)
GetEnvironmentById - retrieves a schema environment by id.
func (*BloodhoundDB) GetEnvironmentKindName ¶
func (s *BloodhoundDB) GetEnvironmentKindName(ctx context.Context, kindName string) (model.SchemaEnvironment, error)
GetEnvironmentKindName - retrieves the schema environment whose environment kind has the given name.
func (*BloodhoundDB) GetEnvironmentTargetedAccessControlForUser ¶
func (s *BloodhoundDB) GetEnvironmentTargetedAccessControlForUser(ctx context.Context, user model.User) ([]model.EnvironmentTargetedAccessControl, error)
GetEnvironmentTargetedAccessControlForUser given a user's id, this will return all access control list rows for the user
func (*BloodhoundDB) GetEnvironments ¶
func (s *BloodhoundDB) GetEnvironments(ctx context.Context) ([]model.SchemaEnvironment, error)
GetEnvironments - retrieves list of schema environments.
func (*BloodhoundDB) GetEnvironmentsByExtensionId ¶
func (s *BloodhoundDB) GetEnvironmentsByExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaEnvironment, error)
GetEnvironmentsByExtensionId - retrieves a slice of model.SchemaEnvironment by extension id.
func (*BloodhoundDB) GetEnvironmentsFiltered ¶
func (s *BloodhoundDB) GetEnvironmentsFiltered(ctx context.Context, filters model.Filters) ([]model.SchemaEnvironment, error)
GetEnvironmentsFiltered - retrieves schema environments filtered by the given criteria. This is the core implementation that all other GetEnvironment* methods delegate to. Common use case: filter by schema_extension_id to get all environments for a specific extension. Example: filters := model.Filters{"se.schema_extension_id": []model.Filter{{Operator: model.Equals, Value: "1"}}}
func (*BloodhoundDB) GetFlag ¶
func (s *BloodhoundDB) GetFlag(ctx context.Context, id int32) (appcfg.FeatureFlag, error)
func (*BloodhoundDB) GetFlagByKey ¶
func (s *BloodhoundDB) GetFlagByKey(ctx context.Context, key string) (appcfg.FeatureFlag, error)
func (*BloodhoundDB) GetGraphSchemaExtensionById ¶
func (s *BloodhoundDB) GetGraphSchemaExtensionById(ctx context.Context, extensionId int32) (model.GraphSchemaExtension, error)
GetGraphSchemaExtensionById gets a row from the extensions table by id. It returns a GraphSchemaExtension struct populated with the data, or an error if that id does not exist.
func (*BloodhoundDB) GetGraphSchemaExtensions ¶
func (s *BloodhoundDB) GetGraphSchemaExtensions(ctx context.Context, extensionFilters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaExtensions, int, error)
GetGraphSchemaExtensions gets all the rows from the extensions table that match the given SQLFilter. It returns a slice of GraphSchemaExtension structs populated with the data, as well as an integer giving the total number of rows returned by the query (excluding any given pagination)
func (*BloodhoundDB) GetGraphSchemaNodeKindById ¶
func (s *BloodhoundDB) GetGraphSchemaNodeKindById(ctx context.Context, schemaNodeKindId int32) (model.GraphSchemaNodeKind, error)
GetGraphSchemaNodeKindById - gets a row from the schema_node_kinds table by id. It returns a model.GraphSchemaNodeKind struct populated with the data, or an error if that id does not exist.
func (*BloodhoundDB) GetGraphSchemaNodeKinds ¶
func (s *BloodhoundDB) GetGraphSchemaNodeKinds(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaNodeKinds, int, error)
GetGraphSchemaNodeKinds - returns all rows from the schema_node_kinds table that matches the given model.Filters. It returns a slice of model.GraphSchemaNodeKinds structs populated with data, as well as an integer indicating the total number of rows returned by the query (excluding any given pagination).
func (*BloodhoundDB) GetGraphSchemaNodeKindsByExtensionId ¶
func (s *BloodhoundDB) GetGraphSchemaNodeKindsByExtensionId(ctx context.Context, extensionId int32) (model.GraphSchemaNodeKinds, error)
GetGraphSchemaNodeKindsByExtensionId - retrieves all node kinds belonging to the given extension.
func (*BloodhoundDB) GetGraphSchemaProperties ¶
func (s *BloodhoundDB) GetGraphSchemaProperties(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaProperties, int, error)
GetGraphSchemaProperties - returns all rows from the schema_properties table that matches the given model.Filters. It returns a slice of model.GraphSchemaProperties structs populated with data, as well as an integer indicating the total number of rows returned by the query (excluding any given pagination).
func (*BloodhoundDB) GetGraphSchemaPropertyById ¶
func (s *BloodhoundDB) GetGraphSchemaPropertyById(ctx context.Context, extensionPropertyId int32) (model.GraphSchemaProperty, error)
GetGraphSchemaPropertyById gets a row from the schema_properties table by id. It returns a GraphSchemaProperty struct populated with the data, or an error if that id does not exist.
func (*BloodhoundDB) GetGraphSchemaRelationshipKindById ¶
func (s *BloodhoundDB) GetGraphSchemaRelationshipKindById(ctx context.Context, schemaRelationshipKindId int32) (model.GraphSchemaRelationshipKind, error)
GetGraphSchemaRelationshipKindById - retrieves a row from the schema_relationship_kinds table
func (*BloodhoundDB) GetGraphSchemaRelationshipKinds ¶
func (s *BloodhoundDB) GetGraphSchemaRelationshipKinds(ctx context.Context, relationshipKindFilters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaRelationshipKinds, int, error)
GetGraphSchemaRelationshipKinds - returns all rows from the schema_relationship_kinds table that matches the given model.Filters. It returns a slice of model.GraphSchemaRelationshipKinds populated with data, as well as an integer indicating the total number of rows returned by the query (excluding any given pagination).
func (*BloodhoundDB) GetGraphSchemaRelationshipKindsByExtensionId ¶
func (s *BloodhoundDB) GetGraphSchemaRelationshipKindsByExtensionId(ctx context.Context, extensionId int32) (model.GraphSchemaRelationshipKinds, error)
GetGraphSchemaRelationshipKindsByExtensionId - retrieves all relationship kinds belonging to the given extension.
func (*BloodhoundDB) GetGraphSchemaRelationshipKindsWithSchemaName ¶
func (*BloodhoundDB) GetIngestJob ¶
func (*BloodhoundDB) GetIngestJobsWithStatus ¶
func (*BloodhoundDB) GetIngestTasksForJob ¶
func (s *BloodhoundDB) GetIngestTasksForJob(ctx context.Context, jobID int64) (model.IngestTasks, error)
func (*BloodhoundDB) GetInstallation ¶
func (s *BloodhoundDB) GetInstallation(ctx context.Context) (model.Installation, error)
GetInstallation retrieves the first row from installations SELECT TOP 1 * FROM installations
func (*BloodhoundDB) GetKindInfos ¶
func (s *BloodhoundDB) GetKindInfos(ctx context.Context, kindID int32) ([]model.GraphSchemaKindInfo, error)
func (*BloodhoundDB) GetKindsByIDs ¶
func (*BloodhoundDB) GetKindsByNames ¶
func (*BloodhoundDB) GetLatestAssetGroupCollection ¶
func (s *BloodhoundDB) GetLatestAssetGroupCollection(ctx context.Context, assetGroupID int32) (model.AssetGroupCollection, error)
func (*BloodhoundDB) GetOrderedAssetGroupTagTiers ¶
func (s *BloodhoundDB) GetOrderedAssetGroupTagTiers(ctx context.Context) ([]model.AssetGroupTag, error)
func (*BloodhoundDB) GetPermission ¶
func (s *BloodhoundDB) GetPermission(ctx context.Context, id int) (model.Permission, error)
GetPermission retrieves a row in the Permissions table corresponding to the ID provided SELECT * FROM permissions WHERE permission_id = ...
func (*BloodhoundDB) GetPrimaryDisplayKinds ¶
func (s *BloodhoundDB) GetPrimaryDisplayKinds(ctx context.Context) (graphschema.PrimaryDisplayKinds, error)
GetPrimaryDisplayKinds - returns a map of all node kinds that are display kinds. custom_node_kinds is the source of truth for display node kinds. This includes schema-backed display kinds (mirrored on extension upsert), schemaless kinds encountered during ingest, and synthetic node kinds created by analysis (e.g. Zone).
Source kinds (from the source_kinds registry, e.g. Base, AZBase, or an OpenGraph source kind like GithubBase) are also included in the map and flagged with IsSourceKind. This allows PrimaryDisplayKind to generically treat any source kind as a base/fallback kind rather than relying on hardcoded knowledge of the built-in AD and Azure base kinds.
func (*BloodhoundDB) GetPrincipalKindsByEnvironmentId ¶
func (s *BloodhoundDB) GetPrincipalKindsByEnvironmentId(ctx context.Context, environmentId int32) (model.SchemaEnvironmentPrincipalKinds, error)
GetPrincipalKindsByEnvironmentID - retrieves a schema environments principal kind by environment id.
func (*BloodhoundDB) GetPrincipalKindsGraphKinds ¶
func (*BloodhoundDB) GetPublicSavedQueries ¶
func (s *BloodhoundDB) GetPublicSavedQueries(ctx context.Context) (model.SavedQueries, error)
GetPublicSavedQueries returns all the queries that were shared publicly
func (*BloodhoundDB) GetRemediationByFindingId ¶
func (s *BloodhoundDB) GetRemediationByFindingId(ctx context.Context, findingId int32) (model.Remediation, error)
func (*BloodhoundDB) GetRemediationByFindingName ¶
func (s *BloodhoundDB) GetRemediationByFindingName(ctx context.Context, findingName string) (model.Remediation, error)
func (*BloodhoundDB) GetRole ¶
GetRole retrieves the role associated with the provided ID SELECT * FROM roles WHERE role_id = ....
func (*BloodhoundDB) GetRoles ¶
GetRoles retrieves all rows in the Roles table corresponding to the provided list of IDs SELECT * FROM roles where ID in (...)
func (*BloodhoundDB) GetSAMLProvider ¶
func (s *BloodhoundDB) GetSAMLProvider(ctx context.Context, id int32) (model.SAMLProvider, error)
GetSAMLProvider returns a SAML provider corresponding to the ID provided SELECT * FOM saml_providers WHERE id = ..
func (*BloodhoundDB) GetSAMLProviderUsers ¶
GetSAMLProviderUsers returns all users that are bound to the SAML provider ID provided SELECT * FROM users WHERE saml_provider_id = ..
func (*BloodhoundDB) GetSSOProviderById ¶
func (s *BloodhoundDB) GetSSOProviderById(ctx context.Context, id int32) (model.SSOProvider, error)
func (*BloodhoundDB) GetSSOProviderBySlug ¶
func (s *BloodhoundDB) GetSSOProviderBySlug(ctx context.Context, slug string) (model.SSOProvider, error)
func (*BloodhoundDB) GetSSOProviderUsers ¶
GetSSOProviderUsers returns all the users associated with a given sso provider
func (*BloodhoundDB) GetSavedQueriesByExtensionID ¶
func (s *BloodhoundDB) GetSavedQueriesByExtensionID(ctx context.Context, schemaExtensionID int32) (model.SavedQueries, error)
func (*BloodhoundDB) GetSavedQueriesOwnedBy ¶
func (s *BloodhoundDB) GetSavedQueriesOwnedBy(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
func (*BloodhoundDB) GetSavedQuery ¶
func (s *BloodhoundDB) GetSavedQuery(ctx context.Context, savedQueryID int64) (model.SavedQuery, error)
func (*BloodhoundDB) GetSavedQueryPermissions ¶
func (s *BloodhoundDB) GetSavedQueryPermissions(ctx context.Context, queryID int64) ([]model.SavedQueriesPermissions, error)
GetSavedQueryPermissions - returns permission data if the user owns the query or the query is public
func (*BloodhoundDB) GetSchemaFindingById ¶
func (s *BloodhoundDB) GetSchemaFindingById(ctx context.Context, findingId int32) (model.SchemaFinding, error)
GetSchemaFindingById - retrieves a schema finding by id.
func (*BloodhoundDB) GetSchemaFindingByName ¶
func (s *BloodhoundDB) GetSchemaFindingByName(ctx context.Context, name string) (model.SchemaFinding, error)
GetSchemaFindingByName - retrieves a schema finding by finding name.
func (*BloodhoundDB) GetSchemaFindings ¶
func (s *BloodhoundDB) GetSchemaFindings(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) ([]model.SchemaFinding, int, error)
GetSchemaFindings - retrieves schema findings filtered and sorted by the given criteria. If sorting is not provided, it will default to name ascending.
func (*BloodhoundDB) GetSchemaFindingsByExtensionId ¶
func (s *BloodhoundDB) GetSchemaFindingsByExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaFinding, error)
GetSchemaFindingsByExtensionId - returns all findings by extension id.
func (*BloodhoundDB) GetScopeForSavedQuery ¶
func (s *BloodhoundDB) GetScopeForSavedQuery(ctx context.Context, queryID int64, userID uuid.UUID) (SavedQueryScopes, error)
GetScopeForSavedQuery returns the possible scopes for a query and user.
func (*BloodhoundDB) GetSelectorNodesBySelectorIds ¶
func (s *BloodhoundDB) GetSelectorNodesBySelectorIds(ctx context.Context, selectorIds ...int) ([]model.AssetGroupSelectorNode, error)
func (*BloodhoundDB) GetSelectorNodesBySelectorIdsFilteredAndPaginated ¶
func (*BloodhoundDB) GetSelectorsByMemberId ¶
func (s *BloodhoundDB) GetSelectorsByMemberId(ctx context.Context, memberId int, assetGroupTagId int) (model.AssetGroupTagSelectors, error)
func (*BloodhoundDB) GetSharedSavedQueries ¶
func (s *BloodhoundDB) GetSharedSavedQueries(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
GetSharedSavedQueries returns all the saved queries that the given userID has access to, including global queries
func (*BloodhoundDB) GetSourceKindByID ¶
func (s *BloodhoundDB) GetSourceKindByID(ctx context.Context, id int) (model.SourceKind, error)
GetSourceKindByID - retrieves source_kind by source_kind table id
func (*BloodhoundDB) GetSourceKindByName ¶
func (s *BloodhoundDB) GetSourceKindByName(ctx context.Context, name string) (model.SourceKind, error)
func (*BloodhoundDB) GetSourceKinds ¶
func (s *BloodhoundDB) GetSourceKinds(ctx context.Context) ([]model.SourceKind, error)
func (*BloodhoundDB) GetSourceKindsByIDs ¶
func (s *BloodhoundDB) GetSourceKindsByIDs(ctx context.Context, ids ...int) ([]model.SourceKind, error)
func (*BloodhoundDB) GetTimeRangedAssetGroupCollections ¶
func (s *BloodhoundDB) GetTimeRangedAssetGroupCollections(ctx context.Context, assetGroupID int32, from int64, to int64, order string) (model.AssetGroupCollections, error)
func (*BloodhoundDB) GetTraversableRelationshipKindsByExtensionID ¶
func (s *BloodhoundDB) GetTraversableRelationshipKindsByExtensionID(ctx context.Context, extensionID int32) (model.GraphSchemaRelationshipKinds, error)
GetTraversableRelationshipKindsByExtensionID returns all traversable relationship kinds for a given schema extension. This is a purpose-built query for the analysis pipeline that needs traversable edges for graph traversal.
func (*BloodhoundDB) GetUser ¶
GetUser returns the user associated with the provided ID SELECT * FROM users WHERE id = ...
func (*BloodhoundDB) GetUserSession ¶
func (s *BloodhoundDB) GetUserSession(ctx context.Context, id int64) (model.UserSession, error)
GetUserSession retrieves the UserSession row associated with the provided ID SELECT * FROM user_sessions WHERE id = ...
func (*BloodhoundDB) GetUserToken ¶
func (*BloodhoundDB) HasAnalysisRequest ¶
func (s *BloodhoundDB) HasAnalysisRequest(ctx context.Context) bool
func (*BloodhoundDB) HasCollectedGraphDataDeletionRequest ¶
func (s *BloodhoundDB) HasCollectedGraphDataDeletionRequest(ctx context.Context) (model.AnalysisRequest, bool)
func (*BloodhoundDB) HasInstallation ¶
func (s *BloodhoundDB) HasInstallation(ctx context.Context) (bool, error)
HasInstallation checks if an installation exists SELECT CASE WHEN EXISTS (SELECT 1 FROM installations) THEN true ELSE false END
func (*BloodhoundDB) InitializeSecretAuth ¶
func (s *BloodhoundDB) InitializeSecretAuth(ctx context.Context, adminUser model.User, authSecret model.AuthSecret) (model.Installation, error)
InitializeSecretAuth creates new AuthSecret and User entries based on the input provided
func (*BloodhoundDB) InsertSelectorNodes ¶
func (s *BloodhoundDB) InsertSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
func (*BloodhoundDB) IsSavedQueryPublic ¶
IsSavedQueryPublic returns true or false whether a provided saved query is public
func (*BloodhoundDB) IsSavedQuerySharedToUser ¶
func (s *BloodhoundDB) IsSavedQuerySharedToUser(ctx context.Context, queryID int64, userID uuid.UUID) (bool, error)
IsSavedQuerySharedToUser returns true or false whether a provided saved query is shared with a provided user
func (*BloodhoundDB) IsSavedQuerySharedToUserOrPublic ¶
func (*BloodhoundDB) ListAuditLogs ¶
func (*BloodhoundDB) ListSavedQueries ¶
func (*BloodhoundDB) LookupActiveSessionsByUser ¶
func (s *BloodhoundDB) LookupActiveSessionsByUser(ctx context.Context, user model.User) ([]model.UserSession, error)
func (*BloodhoundDB) LookupUser ¶
LookupUser retrieves the User row associated with the provided name. The name is matched against both the principal_name and email address fields of a user.
SELECT * FROM users WHERE lower(principal_name) = ... or lower(email_address) = ...
func (*BloodhoundDB) MaybeAuditableTransaction ¶
func (*BloodhoundDB) Pool ¶
func (s *BloodhoundDB) Pool() *pgxpool.Pool
Pool returns the underlying pgx connection pool.
func (*BloodhoundDB) PopulateExtensionData ¶
func (s *BloodhoundDB) PopulateExtensionData(ctx context.Context) error
func (*BloodhoundDB) RawDelete ¶
func (s *BloodhoundDB) RawDelete(value any) error
func (*BloodhoundDB) RegisterSourceKind ¶
RegisterSourceKind returns a function that inserts a source kind by name, using the provided context. The returned function can be called later with just the name. The function is curried in this way because it is primarily used in datapipe during ingest decoding when there is no ctx in scope.
Since this function inserts into the kinds table, the business logic calling this func must also call the DAWGS RefreshKinds function to ensure the kinds are reloaded into the in memory kind map.
func (*BloodhoundDB) RequestAnalysis ¶
func (s *BloodhoundDB) RequestAnalysis(ctx context.Context, requestedBy string, analysisMode model.AnalysisMode) error
RequestAnalysis will request an analysis be executed, as long as there isn't an existing analysis request or collected graph data deletion request, then it no-ops
func (*BloodhoundDB) RequestCollectedGraphDataDeletion ¶
func (s *BloodhoundDB) RequestCollectedGraphDataDeletion(ctx context.Context, request model.AnalysisRequest) error
RequestCollectedGraphDataDeletion will request collected graph data be deleted, if an analysis request is present, it will overwrite that.
func (*BloodhoundDB) ResetLastGraphOptimizeTime ¶
func (s *BloodhoundDB) ResetLastGraphOptimizeTime(ctx context.Context) error
func (*BloodhoundDB) SQLDB ¶
func (s *BloodhoundDB) SQLDB() (*sql.DB, error)
SQLDB returns the underlying *sql.DB handle managed by GORM.
func (*BloodhoundDB) SanitizeUpdateAssetGroupTagRequireCertify ¶
func (s *BloodhoundDB) SanitizeUpdateAssetGroupTagRequireCertify(tag *model.AssetGroupTag)
func (*BloodhoundDB) SavedQueryBelongsToUser ¶
func (*BloodhoundDB) SetConfigurationParameter ¶
func (*BloodhoundDB) SetDatapipeStatus ¶
func (s *BloodhoundDB) SetDatapipeStatus(ctx context.Context, status model.DatapipeStatus) error
func (*BloodhoundDB) SetFlag ¶
func (s *BloodhoundDB) SetFlag(ctx context.Context, flag appcfg.FeatureFlag) error
func (*BloodhoundDB) SetLastAnalysisStartTime ¶
func (s *BloodhoundDB) SetLastAnalysisStartTime(ctx context.Context) error
This should be called at the start of analysis processing (not every datapipe tick, but start of real work)
func (*BloodhoundDB) SetLastGraphOptimizeTime ¶
func (s *BloodhoundDB) SetLastGraphOptimizeTime(ctx context.Context) error
This should be called after a successful graph storage optimization run
func (*BloodhoundDB) SetNextScheduledAnalysisStartTime ¶
No-op in BHCE
func (*BloodhoundDB) SetUserSessionFlag ¶
func (s *BloodhoundDB) SetUserSessionFlag(ctx context.Context, userSession *model.UserSession, key model.SessionFlagKey, state bool) error
corresponding retrival function is model.UserSession.GetFlag()
func (*BloodhoundDB) SweepAssetGroupCollections ¶
func (s *BloodhoundDB) SweepAssetGroupCollections(ctx context.Context)
func (*BloodhoundDB) SweepSAMLConsumedIdentifiers ¶
func (s *BloodhoundDB) SweepSAMLConsumedIdentifiers(ctx context.Context) error
SweepSAMLConsumedIdentifiers deletes all SAMLResponse and assertion identifiers that have expired
func (*BloodhoundDB) SweepSessions ¶
func (s *BloodhoundDB) SweepSessions(ctx context.Context)
SweepSessions deletes all sessions that have already expired
func (*BloodhoundDB) TerminateUserSessionsBySSOProvider ¶
func (s *BloodhoundDB) TerminateUserSessionsBySSOProvider(ctx context.Context, ssoProvider model.SSOProvider) error
TerminateUserSessionsBySSOProvider terminates all sessions associated with a specific sso provider
func (*BloodhoundDB) Transaction ¶
func (s *BloodhoundDB) Transaction(ctx context.Context, fn func(tx *BloodhoundDB) error, opts ...*sql.TxOptions) error
Transaction executes the given function within a database transaction. The function receives a new BloodhoundDB instance backed by the transaction, allowing all existing methods to participate in the transaction. If the function returns an error, the transaction is rolled back. If the function returns nil, the transaction is committed. Optional sql.TxOptions can be provided to configure isolation level and read-only mode.
func (*BloodhoundDB) UpdateAssetGroup ¶
func (s *BloodhoundDB) UpdateAssetGroup(ctx context.Context, assetGroup model.AssetGroup) error
func (*BloodhoundDB) UpdateAssetGroupSelectors ¶
func (s *BloodhoundDB) UpdateAssetGroupSelectors(ctx context.Context, assetGroup model.AssetGroup, selectorSpecs []model.AssetGroupSelectorSpec, systemSelector bool) (model.UpdatedAssetGroupSelectors, error)
func (*BloodhoundDB) UpdateAssetGroupTag ¶
func (s *BloodhoundDB) UpdateAssetGroupTag(ctx context.Context, user model.User, tag model.AssetGroupTag) (model.AssetGroupTag, error)
func (*BloodhoundDB) UpdateAssetGroupTagSelector ¶
func (s *BloodhoundDB) UpdateAssetGroupTagSelector(ctx context.Context, actorId, emailAddress string, selector model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
func (*BloodhoundDB) UpdateAuthSecret ¶
func (s *BloodhoundDB) UpdateAuthSecret(ctx context.Context, authSecret model.AuthSecret) error
UpdateAuthSecret updates the auth secret with the input struct specified UPDATE auth_secrets SET digest = .., hmac_method = ..., expires_at = ... WHERE user_id = ....
func (*BloodhoundDB) UpdateAuthToken ¶
UpdateAuthToken updates all fields in the AuthToken row as specified in the provided struct UPDATE auth_tokens SET key = ..., hmac_method = ..., last_access = ... WHERE user_id = ... AND client_id = ...
func (*BloodhoundDB) UpdateAuthTokenExpiration ¶
func (s *BloodhoundDB) UpdateAuthTokenExpiration(ctx context.Context) error
Updates all auth tokens expiration field when API key expiration is enabled or disabled
func (*BloodhoundDB) UpdateCertificationBySelectorNode ¶
func (s *BloodhoundDB) UpdateCertificationBySelectorNode(ctx context.Context, inputs []UpdateCertificationBySelectorNodeInput) error
func (*BloodhoundDB) UpdateCustomNodeKind ¶
func (s *BloodhoundDB) UpdateCustomNodeKind(ctx context.Context, customNodeKind model.CustomNodeKind) (model.CustomNodeKind, error)
func (*BloodhoundDB) UpdateEnvironment ¶
func (s *BloodhoundDB) UpdateEnvironment(ctx context.Context, environment model.SchemaEnvironment) (model.SchemaEnvironment, error)
UpdateEnvironment - updates the source_kind_id of an existing schema environment by id. Uses a CTE to JOIN the kinds table against the RETURNING clause so that EnvironmentKindName is populated in the returned struct without a separate re-fetch.
func (*BloodhoundDB) UpdateEnvironmentWithPrincipalKinds ¶
func (s *BloodhoundDB) UpdateEnvironmentWithPrincipalKinds(ctx context.Context, existing model.SchemaEnvironment, input model.EnvironmentInput) (model.SchemaEnvironment, error)
UpdateEnvironmentWithPrincipalKinds translates FK names, updates the environment row if source kind changed, and reconciles its principal kinds.
func (*BloodhoundDB) UpdateFindingWithRemediation ¶
func (s *BloodhoundDB) UpdateFindingWithRemediation(ctx context.Context, existing model.SchemaFinding, input model.RelationshipFindingInput) (model.SchemaFinding, error)
UpdateFindingWithRemediation translates FK names, updates the finding, and updates its 1:1 remediation.
func (*BloodhoundDB) UpdateGraphSchemaExtension ¶
func (s *BloodhoundDB) UpdateGraphSchemaExtension(ctx context.Context, extension model.GraphSchemaExtension) (model.GraphSchemaExtension, error)
UpdateGraphSchemaExtension updates an existing Graph Schema Extension. Only the `name`, `display_name`, and `version` fields are updatable. It returns the updated extension, or an error if the update violates schema constraints or did not succeed.
func (*BloodhoundDB) UpdateGraphSchemaNodeKind ¶
func (s *BloodhoundDB) UpdateGraphSchemaNodeKind(ctx context.Context, schemaNodeKind model.GraphSchemaNodeKind) (model.GraphSchemaNodeKind, error)
UpdateGraphSchemaNodeKind - updates a row in the schema_node_kinds table based on the provided id. It will return an error if the target schema node kind does not exist or if any of the updates violate the schema constraints.
This function does NOT update the DAWGS name column since the schema_node_kinds table FKs to the DAWGS kind table, and that table is append only. A new node kind should be created instead.
func (*BloodhoundDB) UpdateGraphSchemaNodeKindIconById ¶
func (s *BloodhoundDB) UpdateGraphSchemaNodeKindIconById(ctx context.Context, id int32, icon graphschema.DisplayNodeIcon) (model.GraphSchemaNodeKind, error)
UpdateGraphSchemaNodeKindIconByKindId - updates the icon name and color for a row in the schema_node_kinds table based on the provided id. It will return an error if the target schema node kind does not exist.
func (*BloodhoundDB) UpdateGraphSchemaProperty ¶
func (s *BloodhoundDB) UpdateGraphSchemaProperty(ctx context.Context, property model.GraphSchemaProperty) (model.GraphSchemaProperty, error)
UpdateGraphSchemaProperty - updates a row in the schema_properties table based on the provided id. It will return an error if the target property does not exist or if any of the updates violate the schema constraints.
func (*BloodhoundDB) UpdateGraphSchemaRelationshipKind ¶
func (s *BloodhoundDB) UpdateGraphSchemaRelationshipKind(ctx context.Context, schemaRelationshipKind model.GraphSchemaRelationshipKind) (model.GraphSchemaRelationshipKind, error)
UpdateGraphSchemaRelationshipKind - updates a row in the schema_relationship_kinds table based on the provided id. It will return an error if the target schema edge kind does not exist or if any of the updates violate the schema constraints.
This function does NOT update the DAWGS name column since the schema_relationship_kinds table FKs to the DAWGS kind table, and that table is append only. A new edge kind should be created instead.
func (*BloodhoundDB) UpdateIngestJob ¶
func (*BloodhoundDB) UpdateKindInfo ¶
func (s *BloodhoundDB) UpdateKindInfo(ctx context.Context, kindInfo model.GraphSchemaKindInfo) (model.GraphSchemaKindInfo, error)
func (*BloodhoundDB) UpdateLastAnalysisCompleteTime ¶
func (s *BloodhoundDB) UpdateLastAnalysisCompleteTime(ctx context.Context) error
This should be called at the end of a successful analysis run (not always every analysis)
func (*BloodhoundDB) UpdateOIDCProvider ¶
func (s *BloodhoundDB) UpdateOIDCProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.OIDCProvider, error)
UpdateOIDCProvider updates an OIDC provider as well as the associated SSO provider
func (*BloodhoundDB) UpdateOpenGraphAssetGroupTagSelector ¶
func (s *BloodhoundDB) UpdateOpenGraphAssetGroupTagSelector(ctx context.Context, extensionId int32, input model.AssetGroupTagSelector) (model.AssetGroupTagSelector, error)
func (*BloodhoundDB) UpdateRemediation ¶
func (*BloodhoundDB) UpdateSAMLIdentityProvider ¶
func (s *BloodhoundDB) UpdateSAMLIdentityProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.SAMLProvider, error)
CreateSAMLProvider updates a saml_providers row using the data in the input struct UPDATE saml_identity_providers SET (...) VALUES (...) WHERE id = ...
func (*BloodhoundDB) UpdateSSOProvider ¶
func (s *BloodhoundDB) UpdateSSOProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.SSOProvider, error)
UpdateSSOProvider updates an entry in the sso_providers table
func (*BloodhoundDB) UpdateSavedQuery ¶
func (s *BloodhoundDB) UpdateSavedQuery(ctx context.Context, savedQuery model.SavedQuery) (model.SavedQuery, error)
func (*BloodhoundDB) UpdateSchemaFinding ¶
func (s *BloodhoundDB) UpdateSchemaFinding(ctx context.Context, finding model.SchemaFinding) (model.SchemaFinding, error)
UpdateSchemaFinding - updates the type, display_name, pz_display_name, kind_id, and environment_id of an existing schema finding by id. Type is included because findings may transition between SchemaFindingTypeRelationship and SchemaFindingTypeList as extension definitions evolve.
func (*BloodhoundDB) UpdateSelectorNodes ¶
func (s *BloodhoundDB) UpdateSelectorNodes(ctx context.Context, nodes []model.AssetGroupSelectorNode) error
func (*BloodhoundDB) UpdateTierPositions ¶
func (s *BloodhoundDB) UpdateTierPositions(ctx context.Context, user model.User, orderedTags model.AssetGroupTags, ignoredTagIds ...int) error
func (*BloodhoundDB) UpdateUser ¶
UpdateUser updates the roles associated with the user according to the input struct UPDATE users SET roles = ....
func (*BloodhoundDB) UpsertKind ¶
UpsertKind Since this function inserts into the kinds table, the business logic calling this func must also call the DAWGS RefreshKinds function to ensure the kinds are reloaded into the in memory kind map.
func (*BloodhoundDB) UpsertOpenGraphExtension ¶
func (s *BloodhoundDB) UpsertOpenGraphExtension(ctx context.Context, graphExtensionInput model.GraphExtensionInput) (model.GraphExtensionUpsertResult, error)
UpsertOpenGraphExtension - upserts the incoming graph extension by checking to see if the extension exists already, if so, deleting it and inserting the new extension.
Each entity set is diffed against the input: absent rows are deleted, matching rows are updated in place with their IDs preserved, and new rows are created. All mutations run inside a single transaction that rolls back on any error.
Returns the persisted extension and reconciliation results after a successful commit. Returns ErrGraphExtensionBuiltIn if the named extension is a built-in and cannot be modified.
type CustomNodeKindData ¶
type CustomNodeKindData interface {
CreateCustomNodeKinds(ctx context.Context, customNodeKind model.CustomNodeKinds) (model.CustomNodeKinds, error)
EnsureStubbedCustomNodeKindForIngest(ctx context.Context, name string) error
GetCustomNodeKinds(ctx context.Context) ([]model.CustomNodeKind, error)
GetCustomNodeKind(ctx context.Context, kindName string) (model.CustomNodeKind, error)
UpdateCustomNodeKind(ctx context.Context, customNodeKind model.CustomNodeKind) (model.CustomNodeKind, error)
DeleteCustomNodeKind(ctx context.Context, kindName string) error
}
type DataQualityData ¶
type DataQualityData interface {
// Data Quality Stats
CreateADDataQualityStats(ctx context.Context, stats model.ADDataQualityStats) (model.ADDataQualityStats, error)
GetADDataQualityStats(ctx context.Context, domainSid string, start time.Time, end time.Time, sort_by string, limit int, skip int) (model.ADDataQualityStats, int, error)
GetAggregateADDataQualityStats(ctx context.Context, domainSIDs []string, start time.Time, end time.Time) (model.ADDataQualityStats, error)
CreateAzureDataQualityStats(ctx context.Context, stats model.AzureDataQualityStats) (model.AzureDataQualityStats, error)
GetAzureDataQualityStats(ctx context.Context, tenantId string, start time.Time, end time.Time, sort_by string, limit int, skip int) (model.AzureDataQualityStats, int, error)
CreateDataQualityStats(ctx context.Context, stats model.DataQualityStats) (model.DataQualityStats, error)
GetDataQualityStats(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.DataQualityStats, int, error)
// Data Quality Aggregations
CreateADDataQualityAggregation(ctx context.Context, aggregation model.ADDataQualityAggregation) (model.ADDataQualityAggregation, error)
GetADDataQualityAggregations(ctx context.Context, start time.Time, end time.Time, sort_by string, limit int, skip int) (model.ADDataQualityAggregations, int, error)
CreateAzureDataQualityAggregation(ctx context.Context, aggregation model.AzureDataQualityAggregation) (model.AzureDataQualityAggregation, error)
GetAzureDataQualityAggregations(ctx context.Context, start time.Time, end time.Time, sort_by string, limit int, skip int) (model.AzureDataQualityAggregations, int, error)
GetDataQualityAggregations(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.DataQualityAggregations, int, error)
CreateDataQualityAggregations(ctx context.Context, aggregations model.DataQualityAggregations) (model.DataQualityAggregations, error)
DeleteAllDataQuality(ctx context.Context) error
}
type Database
deprecated
type Database interface {
appcfg.ParameterService
appcfg.FeatureFlagService
Close(ctx context.Context)
// Ingest
upload.UploadData
GetAllIngestTasks(ctx context.Context) (model.IngestTasks, error)
CountAllIngestTasks(ctx context.Context) (int64, error)
DeleteIngestTask(ctx context.Context, ingestTask model.IngestTask) error
GetIngestTasksForJob(ctx context.Context, jobID int64) (model.IngestTasks, error)
// Asset Groups
AgiData
Wipe(ctx context.Context) error
Migrate(ctx context.Context) error
PopulateExtensionData(ctx context.Context) error
CreateInstallation(ctx context.Context) (model.Installation, error)
GetInstallation(ctx context.Context) (model.Installation, error)
HasInstallation(ctx context.Context) (bool, error)
// Audit Logs
CreateAuditLog(ctx context.Context, auditLog model.AuditLog) error
AppendAuditLog(ctx context.Context, entry model.AuditEntry) error
ListAuditLogs(ctx context.Context, before, after time.Time, offset, limit int, order string, filter model.SQLFilter) (model.AuditLogs, int, error)
// Roles
GetAllRoles(ctx context.Context, order string, filter model.SQLFilter) (model.Roles, error)
GetRoles(ctx context.Context, ids []int32) (model.Roles, error)
GetRole(ctx context.Context, id int32) (model.Role, error)
GetPermission(ctx context.Context, id int) (model.Permission, error)
// Users
CreateUser(ctx context.Context, user model.User) (model.User, error)
UpdateUser(ctx context.Context, user model.User) error
GetAllUsers(ctx context.Context, order string, filter model.SQLFilter) (model.Users, error)
GetUser(ctx context.Context, id uuid.UUID) (model.User, error)
DeleteUser(ctx context.Context, user model.User) error
LookupUser(ctx context.Context, principalName string) (model.User, error)
// Auth
CreateAuthToken(ctx context.Context, authToken model.AuthToken) (model.AuthToken, error)
UpdateAuthToken(ctx context.Context, authToken model.AuthToken) error
UpdateAuthTokenExpiration(ctx context.Context) error
GetAllAuthTokens(ctx context.Context, order string, filter model.SQLFilter) (model.AuthTokens, error)
GetAuthToken(ctx context.Context, id uuid.UUID) (model.AuthToken, error)
GetUserToken(ctx context.Context, userId, tokenId uuid.UUID) (model.AuthToken, error)
DeleteExpiredAuthTokens(ctx context.Context) error
DeleteAllAuthTokens(ctx context.Context) error
DeleteAuthToken(ctx context.Context, authToken model.AuthToken) error
CreateAuthSecret(ctx context.Context, authSecret model.AuthSecret) (model.AuthSecret, error)
GetAuthSecret(ctx context.Context, id int32) (model.AuthSecret, error)
UpdateAuthSecret(ctx context.Context, authSecret model.AuthSecret) error
DeleteAuthSecret(ctx context.Context, authSecret model.AuthSecret) error
InitializeSecretAuth(ctx context.Context, adminUser model.User, authSecret model.AuthSecret) (model.Installation, error)
// SSO
SSOProviderData
OIDCProviderData
SAMLProviderData
SAMLConsumedData
// Sessions
CreateUserSession(ctx context.Context, userSession model.UserSession) (model.UserSession, error)
SetUserSessionFlag(ctx context.Context, userSession *model.UserSession, key model.SessionFlagKey, state bool) error
LookupActiveSessionsByUser(ctx context.Context, user model.User) ([]model.UserSession, error)
EndUserSession(ctx context.Context, userSession model.UserSession)
GetUserSession(ctx context.Context, id int64) (model.UserSession, error)
SweepSessions(ctx context.Context)
// Data Quality
DataQualityData
// Saved Queries
SavedQueriesData
// Saved Queries Permissions
SavedQueriesPermissionsData
// Analysis Request
AnalysisRequestData
// Datapipe Status
DatapipeStatusData
// Asset Group Tags
AssetGroupHistoryData
AssetGroupTagData
AssetGroupTagSelectorData
AssetGroupTagSelectorNodeData
// Custom Node Kinds
CustomNodeKindData
// Source Kinds
SourceKindsData
// Environment Targeted Access Control
EnvironmentTargetedAccessControlData
// OpenGraph Schema
OpenGraphSchema
// Kind
Kind
}
Database describes the old interface for communicating with the application database
Deprecated: When writing code in the new structure, do not pass this interface. Instead, create an interface containing the methods you wish to use in your service implementation: https://specterops.atlassian.net/wiki/spaces/BE/pages/194412923/Restructure+API+Endpoints+Guide+RFC?atlOrigin=eyJpIjoiZjhkOGI0ZDFlMjEzNDkwMDlkMzRhM2QxYTRjMzlmODYiLCJwIjoiY29uZmx1ZW5jZS1jaGF0cy1pbnQifQ
type DatapipeStatusData ¶
type DatapipeStatusData interface {
SetLastAnalysisStartTime(ctx context.Context) error
UpdateLastAnalysisCompleteTime(ctx context.Context) error
SetLastGraphOptimizeTime(ctx context.Context) error
ResetLastGraphOptimizeTime(ctx context.Context) error
SetDatapipeStatus(ctx context.Context, status model.DatapipeStatus) error
GetDatapipeStatus(ctx context.Context) (model.DatapipeStatusWrapper, error)
SetNextScheduledAnalysisStartTime(ctx context.Context, time null.Time) error
}
type FilterAndPagination ¶
type GormLogAdapter ¶
type GormLogAdapter struct {
SlowQueryWarnThreshold time.Duration
SlowQueryErrorThreshold time.Duration
}
func (*GormLogAdapter) Error ¶
func (s *GormLogAdapter) Error(ctx context.Context, msg string, data ...any)
func (*GormLogAdapter) Info ¶
func (s *GormLogAdapter) Info(ctx context.Context, msg string, data ...any)
func (*GormLogAdapter) LogMode ¶
func (s *GormLogAdapter) LogMode(level logger.LogLevel) logger.Interface
type OIDCProviderData ¶
type OIDCProviderData interface {
CreateOIDCProvider(ctx context.Context, name, issuer, clientID string, config model.SSOProviderConfig) (model.OIDCProvider, error)
UpdateOIDCProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.OIDCProvider, error)
}
OIDCProviderData defines the interface required to interact with the oidc_providers table
type OpenGraphSchema ¶
type OpenGraphSchema interface {
CreateGraphSchemaExtension(ctx context.Context, name string, displayName string, version string, namespace string) (model.GraphSchemaExtension, error)
GetGraphSchemaExtensionById(ctx context.Context, extensionId int32) (model.GraphSchemaExtension, error)
GetGraphSchemaExtensions(ctx context.Context, extensionFilters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaExtensions, int, error)
UpdateGraphSchemaExtension(ctx context.Context, extension model.GraphSchemaExtension) (model.GraphSchemaExtension, error)
DeleteGraphSchemaExtension(ctx context.Context, extensionId int32) error
CreateGraphSchemaNodeKind(ctx context.Context, name string, extensionId int32, displayName string, description string, isDisplayKind bool, icon, iconColor string) (model.GraphSchemaNodeKind, error)
GetGraphSchemaNodeKindById(ctx context.Context, schemaNodeKindID int32) (model.GraphSchemaNodeKind, error)
GetGraphSchemaNodeKinds(ctx context.Context, nodeKindFilters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaNodeKinds, int, error)
GetGraphSchemaNodeKindsByExtensionId(ctx context.Context, extensionId int32) (model.GraphSchemaNodeKinds, error)
UpdateGraphSchemaNodeKind(ctx context.Context, schemaNodeKind model.GraphSchemaNodeKind) (model.GraphSchemaNodeKind, error)
UpdateGraphSchemaNodeKindIconById(ctx context.Context, kindId int32, icon graphschema.DisplayNodeIcon) (model.GraphSchemaNodeKind, error)
DeleteGraphSchemaNodeKind(ctx context.Context, schemaNodeKindId int32) error
CreateGraphSchemaProperty(ctx context.Context, extensionId int32, name string, displayName string, dataType string, description string) (model.GraphSchemaProperty, error)
GetGraphSchemaPropertyById(ctx context.Context, extensionPropertyId int32) (model.GraphSchemaProperty, error)
GetGraphSchemaProperties(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaProperties, int, error)
UpdateGraphSchemaProperty(ctx context.Context, property model.GraphSchemaProperty) (model.GraphSchemaProperty, error)
DeleteGraphSchemaProperty(ctx context.Context, propertyID int32) error
CreateGraphSchemaRelationshipKind(ctx context.Context, name string, schemaExtensionId int32, description string, isTraversable bool) (model.GraphSchemaRelationshipKind, error)
GetGraphSchemaRelationshipKinds(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaRelationshipKinds, int, error)
GetGraphSchemaRelationshipKindById(ctx context.Context, schemaRelationshipKindId int32) (model.GraphSchemaRelationshipKind, error)
UpdateGraphSchemaRelationshipKind(ctx context.Context, schemaRelationshipKind model.GraphSchemaRelationshipKind) (model.GraphSchemaRelationshipKind, error)
DeleteGraphSchemaRelationshipKind(ctx context.Context, schemaRelationshipKindId int32) error
GetTraversableRelationshipKindsByExtensionID(ctx context.Context, extensionID int32) (model.GraphSchemaRelationshipKinds, error)
GetGraphSchemaRelationshipKindsWithSchemaName(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) (model.GraphSchemaRelationshipKindsWithNamedSchema, int, error)
CreateEnvironment(ctx context.Context, extensionId int32, environmentKindId int32, sourceKindId int32) (model.SchemaEnvironment, error)
GetEnvironmentsFiltered(ctx context.Context, filters model.Filters) ([]model.SchemaEnvironment, error)
GetEnvironmentByEnvironmentKindId(ctx context.Context, environmentKindId int32) (model.SchemaEnvironment, error)
GetEnvironmentById(ctx context.Context, environmentId int32) (model.SchemaEnvironment, error)
GetEnvironments(ctx context.Context) ([]model.SchemaEnvironment, error)
GetEnvironmentsByExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaEnvironment, error)
DeleteEnvironment(ctx context.Context, environmentId int32) error
CreateSchemaFinding(ctx context.Context, findingType model.SchemaFindingType, extensionId, kindId, environmentId int32, name, displayName, pzDisplayName string) (model.SchemaFinding, error)
GetSchemaFindings(ctx context.Context, filters model.Filters, sort model.Sort, skip, limit int) ([]model.SchemaFinding, int, error)
GetSchemaFindingsByExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaFinding, error)
GetSchemaFindingById(ctx context.Context, findingId int32) (model.SchemaFinding, error)
GetSchemaFindingByName(ctx context.Context, name string) (model.SchemaFinding, error)
DeleteSchemaFinding(ctx context.Context, findingId int32) error
CreateSchemaFindingSubtype(ctx context.Context, findingId int32, subtype string) error
CreateRemediation(ctx context.Context, findingId int32, shortDescription string, longDescription string, shortRemediation string, longRemediation string) (model.Remediation, error)
GetRemediationByFindingId(ctx context.Context, findingId int32) (model.Remediation, error)
GetRemediationByFindingName(ctx context.Context, findingName string) (model.Remediation, error)
UpdateRemediation(ctx context.Context, findingId int32, shortDescription string, longDescription string, shortRemediation string, longRemediation string) (model.Remediation, error)
DeleteRemediation(ctx context.Context, findingId int32) error
CreatePrincipalKind(ctx context.Context, environmentId int32, principalKind int32) (model.SchemaEnvironmentPrincipalKind, error)
GetPrincipalKindsGraphKinds(ctx context.Context) (graph.Kinds, error)
GetPrincipalKindsByEnvironmentId(ctx context.Context, environmentId int32) (model.SchemaEnvironmentPrincipalKinds, error)
DeletePrincipalKind(ctx context.Context, environmentId int32, principalKind int32) error
GetPrimaryDisplayKinds(ctx context.Context) (graphschema.PrimaryDisplayKinds, error)
// Entity Panels:
CreateKindInfo(ctx context.Context, kindID int32, nodeKindID, relationshipKindID *int32, kindInfo model.KindInfoInput) (model.GraphSchemaKindInfo, error)
UpdateKindInfo(ctx context.Context, kindInfo model.GraphSchemaKindInfo) (model.GraphSchemaKindInfo, error)
GetKindInfos(ctx context.Context, kindID int32) ([]model.GraphSchemaKindInfo, error)
DeleteKindInfo(ctx context.Context, kindInfoID int32) error
}
type SAMLConsumedData ¶
type SAMLConsumedData interface {
CreateSAMLConsumedIdentifiers(ctx context.Context, ssoProviderID int32, idpIssuer, responseID, assertionID string, expiresAt time.Time) error
SweepSAMLConsumedIdentifiers(ctx context.Context) error
}
SAMLConsumedData defines the methods for persisting and deleting SAML identifiers consumed during login, stored in the saml_consumed_identifiers table.
type SAMLProviderData ¶
type SAMLProviderData interface {
CreateSAMLIdentityProvider(ctx context.Context, samlProvider model.SAMLProvider, config model.SSOProviderConfig) (model.SAMLProvider, error)
GetAllSAMLProviders(ctx context.Context) (model.SAMLProviders, error)
GetSAMLProvider(ctx context.Context, id int32) (model.SAMLProvider, error)
GetSAMLProviderUsers(ctx context.Context, id int32) (model.Users, error)
UpdateSAMLIdentityProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.SAMLProvider, error)
}
SAMLProviderData defines the interface required to interact with the oidc_providers table
type SSOProviderData ¶
type SSOProviderData interface {
CreateSSOProvider(ctx context.Context, name string, authProvider model.SessionAuthProvider, config model.SSOProviderConfig) (model.SSOProvider, error)
DeleteSSOProvider(ctx context.Context, id int) error
GetAllSSOProviders(ctx context.Context, order string, sqlFilter model.SQLFilter) ([]model.SSOProvider, error)
GetSSOProviderById(ctx context.Context, id int32) (model.SSOProvider, error)
GetSSOProviderBySlug(ctx context.Context, slug string) (model.SSOProvider, error)
GetSSOProviderUsers(ctx context.Context, id int) (model.Users, error)
TerminateUserSessionsBySSOProvider(ctx context.Context, ssoProvider model.SSOProvider) error
UpdateSSOProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.SSOProvider, error)
}
SSOProviderData defines the methods required to interact with the sso_providers table
type SavedQueriesData ¶
type SavedQueriesData interface {
GetSavedQuery(ctx context.Context, savedQueryID int64) (model.SavedQuery, error)
GetSavedQueriesByExtensionID(ctx context.Context, schemaExtensionID int32) (model.SavedQueries, error)
ListSavedQueries(ctx context.Context, scope string, userID uuid.UUID, order string, filter model.SQLFilter, skip, limit int) ([]model.ScopedSavedQuery, int, error)
CreateSavedQuery(ctx context.Context, userID uuid.UUID, name string, query string, description string, schemaExtensionID *int32, queryKey *string, category string) (model.SavedQuery, error)
UpdateSavedQuery(ctx context.Context, savedQuery model.SavedQuery) (model.SavedQuery, error)
DeleteSavedQuery(ctx context.Context, savedQueryID int64) error
SavedQueryBelongsToUser(ctx context.Context, userID uuid.UUID, savedQueryID int64) (bool, error)
GetPublicSavedQueries(ctx context.Context) (model.SavedQueries, error)
CreateSavedQueries(ctx context.Context, savedQueries model.SavedQueries) error
GetAllSavedQueriesByUser(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
GetSavedQueriesOwnedBy(ctx context.Context, userID uuid.UUID) (model.SavedQueries, error)
}
type SavedQueriesPermissionsData ¶
type SavedQueriesPermissionsData interface {
GetSavedQueryPermissions(ctx context.Context, queryID int64) ([]model.SavedQueriesPermissions, error)
CreateSavedQueryPermissionToPublic(ctx context.Context, queryID int64) (model.SavedQueriesPermissions, error)
CreateSavedQueryPermissionsToUsers(ctx context.Context, queryID int64, userIDs ...uuid.UUID) ([]model.SavedQueriesPermissions, error)
DeleteSavedQueryPermissionsForUsers(ctx context.Context, queryID int64, userIDs ...uuid.UUID) error
GetScopeForSavedQuery(ctx context.Context, queryID int64, userID uuid.UUID) (SavedQueryScopes, error)
IsSavedQueryPublic(ctx context.Context, savedQueryID int64) (bool, error)
}
SavedQueriesPermissionsData methods representing the database interactions pertaining to the saved_queries_permissions model
type SavedQueryScopes ¶
type SourceKindsData ¶
type SourceKindsData interface {
GetSourceKinds(ctx context.Context) ([]model.SourceKind, error)
DeleteSourceKindsByName(ctx context.Context, name ...string) error
RegisterSourceKind(ctx context.Context) func(sourceKind graph.Kind) error
GetSourceKindByName(ctx context.Context, name string) (model.SourceKind, error)
GetSourceKindsByIDs(ctx context.Context, ids ...int) ([]model.SourceKind, error)
GetSourceKindByID(ctx context.Context, id int) (model.SourceKind, error)
}
Source Files
¶
- agi.go
- analysisrequest.go
- assetgrouphistory.go
- assetgrouptags.go
- audit.go
- auth.go
- completedtask.go
- customnode.go
- datapipestatus.go
- dataquality.go
- db.go
- etac.go
- featureflags.go
- graphschema.go
- helper.go
- ingest_job.go
- ingest_task.go
- kind.go
- log.go
- oidc_providers.go
- pagination.go
- parameters.go
- postgres_errors.go
- reconcile.go
- samlconsumedidentifiers.go
- samlproviders.go
- saved_queries.go
- saved_queries_permissions.go
- sourcekinds.go
- sso_providers.go
- upsert_schema_environment.go
- upsert_schema_extension.go
- upsert_schema_finding.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Deprecated: The code in this file supports legacy v8 stepwise migrations for existing customers who may be upgrading from older versions.
|
Deprecated: The code in this file supports legacy v8 stepwise migrations for existing customers who may be upgrading from older versions. |
|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
|
null
Package null contains SQL types that consider zero input and null input as separate values, with convenient support for JSON and text marshaling.
|
Package null contains SQL types that consider zero input and null input as separate values, with convenient support for JSON and text marshaling. |