Documentation
¶
Overview ¶
Copyright 2025 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2025 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2026 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2026 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2026 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright 2026 Specter Ops, Inc.
Licensed under the Apache License, Version 2.0 you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func 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(connection string) (*gorm.DB, error)
- 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, assetGroupTagId int, user model.User, name string, ...) (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) CreateEnvironment(ctx context.Context, extensionId int32, environmentKindId int32, ...) (model.SchemaEnvironment, 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) 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) 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) CreateSchemaRelationshipFinding(ctx context.Context, extensionId int32, relationshipKindId int32, ...) (model.SchemaRelationshipFinding, 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) DeactivateSourceKindsByName(ctx context.Context, kinds graph.Kinds) 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) 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) 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) DeleteSchemaRelationshipFinding(ctx context.Context, findingId int32) error
- func (s *BloodhoundDB) DeleteSelectorNodesByNodeId(ctx context.Context, selectorId int, nodeId graph.ID) error
- func (s *BloodhoundDB) DeleteSelectorNodesBySelectorIds(ctx context.Context, selectorIds ...int) 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) 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) GetAllPermissions(ctx context.Context, order string, filter model.SQLFilter) (model.Permissions, 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) 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) GetDatapipeStatus(ctx context.Context) (model.DatapipeStatusWrapper, error)
- func (s *BloodhoundDB) GetEnvironmentById(ctx context.Context, environmentId int32) (model.SchemaEnvironment, error)
- func (s *BloodhoundDB) GetEnvironmentByKinds(ctx context.Context, environmentKindId, sourceKindId int32) (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) 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) 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) 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) GetKindById(ctx context.Context, id int32) (model.Kind, error)
- func (s *BloodhoundDB) GetKindByName(ctx context.Context, name 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) GetPrincipalKindsByEnvironmentId(ctx context.Context, environmentId int32) (model.SchemaEnvironmentPrincipalKinds, 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) 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) GetSchemaRelationshipFindingById(ctx context.Context, findingId int32) (model.SchemaRelationshipFinding, error)
- func (s *BloodhoundDB) GetSchemaRelationshipFindingByName(ctx context.Context, name string) (model.SchemaRelationshipFinding, error)
- func (s *BloodhoundDB) GetSchemaRelationshipFindingsBySchemaExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaRelationshipFinding, error)
- func (s *BloodhoundDB) GetScopeForSavedQuery(ctx context.Context, queryID int64, userID uuid.UUID) (SavedQueryScopeMap, 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) (SourceKind, error)
- func (s *BloodhoundDB) GetSourceKindByName(ctx context.Context, name string) (SourceKind, error)
- func (s *BloodhoundDB) GetSourceKinds(ctx context.Context) ([]SourceKind, error)
- func (s *BloodhoundDB) GetTimeRangedAssetGroupCollections(ctx context.Context, assetGroupID int32, from int64, to int64, order string) (model.AssetGroupCollections, 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) InsertSelectorNode(ctx context.Context, assetGroupTagId, selectorId int, nodeId graph.ID, ...) 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) 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) error
- func (s *BloodhoundDB) RequestCollectedGraphDataDeletion(ctx context.Context, request model.AnalysisRequest) 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) SetUserSessionFlag(ctx context.Context, userSession *model.UserSession, key model.SessionFlagKey, ...) error
- func (s *BloodhoundDB) SweepAssetGroupCollections(ctx context.Context)
- 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) UpdateCertificationBySelectorNode(ctx context.Context, inputs []UpdateCertificationBySelectorNodeInput) error
- func (s *BloodhoundDB) UpdateCustomNodeKind(ctx context.Context, customNodeKind model.CustomNodeKind) (model.CustomNodeKind, 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) 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) UpdateLastAnalysisCompleteTime(ctx context.Context) error
- func (s *BloodhoundDB) UpdateOIDCProvider(ctx context.Context, ssoProvider model.SSOProvider) (model.OIDCProvider, 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) UpdateSelectorNodesByNodeId(ctx context.Context, assetGroupTagId, selectorId int, nodeId graph.ID, ...) 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) UpsertFinding(ctx context.Context, extensionId int32, ...) (model.SchemaRelationshipFinding, error)
- func (s *BloodhoundDB) UpsertOpenGraphExtension(ctx context.Context, graphExtensionInput model.GraphExtensionInput) (bool, error)
- func (s *BloodhoundDB) UpsertRemediation(ctx context.Context, findingId int32, ...) error
- func (s *BloodhoundDB) UpsertSchemaEnvironmentWithPrincipalKinds(ctx context.Context, schemaExtensionId int32, environmentKind string, ...) error
- func (s *BloodhoundDB) Wipe(ctx context.Context) error
- type CustomNodeKindData
- 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 SAMLProviderData
- type SSOProviderData
- type SavedQueriesData
- type SavedQueriesPermissionsData
- type SavedQueryScopeMap
- type ScopeFunc
- type SourceKind
- type SourceKindsData
- type UpdateCertificationBySelectorNodeInput
Constants ¶
const (
DuplicateKeyValueErrorString = "duplicate key value violates unique constraint"
)
const (
ETACTable = "environment_targeted_access_control"
)
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") 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") )
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 (...)
Types ¶
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) 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, assetGroupTagId int, user model.User, name string, description string, isDefault bool, allowDisable bool, autoCertify model.SelectorAutoCertifyMethod, seeds []model.SelectorSeed) (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)
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)
}
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 {
InsertSelectorNode(ctx context.Context, assetGroupTagId, selectorId int, nodeId graph.ID, certified model.AssetGroupCertification, certifiedBy null.String, source model.AssetGroupSelectorNodeSource, primaryKind, environmentId, objectId, name string) error
UpdateSelectorNodesByNodeId(ctx context.Context, assetGroupTagId, selectorId int, nodeId graph.ID, certified model.AssetGroupCertification, certifiedBy null.String, primaryKind, environmentId, objectId, name string) error
UpdateCertificationBySelectorNode(ctx context.Context, input []UpdateCertificationBySelectorNodeInput) error
DeleteSelectorNodesByNodeId(ctx context.Context, selectorId int, nodeId graph.ID) 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, idResolver auth.IdentityResolver) *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, assetGroupTagId int, user model.User, name string, description string, isDefault bool, allowDisable bool, autoCertify model.SelectorAutoCertifyMethod, seeds []model.SelectorSeed) (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) CreateEnvironment ¶
func (s *BloodhoundDB) CreateEnvironment(ctx context.Context, extensionId int32, environmentKindId int32, sourceKindId int32) (model.SchemaEnvironment, error)
CreateEnvironment - creates a new schema_environment.
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) 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) 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) CreateSchemaRelationshipFinding ¶
func (s *BloodhoundDB) CreateSchemaRelationshipFinding(ctx context.Context, extensionId int32, relationshipKindId int32, environmentId int32, name string, displayName string) (model.SchemaRelationshipFinding, error)
CreateSchemaRelationshipFinding - creates a new schema relationship finding.
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) DeactivateSourceKindsByName ¶
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) 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. Source Kinds are deactivated only if they don't reference any other extensions environment.
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) 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) DeleteSchemaRelationshipFinding ¶
func (s *BloodhoundDB) DeleteSchemaRelationshipFinding(ctx context.Context, findingId int32) error
DeleteSchemaRelationshipFinding - deletes a schema relationship finding by id.
func (*BloodhoundDB) DeleteSelectorNodesByNodeId ¶
func (*BloodhoundDB) DeleteSelectorNodesBySelectorIds ¶
func (s *BloodhoundDB) DeleteSelectorNodesBySelectorIds(ctx context.Context, selectorIds ...int) 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) 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) GetAllPermissions ¶
func (s *BloodhoundDB) GetAllPermissions(ctx context.Context, order string, filter model.SQLFilter) (model.Permissions, error)
GetAllPermissions retrieves all rows from the Permissions table SELECT * FROM permissions
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) 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) GetDatapipeStatus ¶
func (s *BloodhoundDB) GetDatapipeStatus(ctx context.Context) (model.DatapipeStatusWrapper, error)
func (*BloodhoundDB) GetEnvironmentById ¶
func (s *BloodhoundDB) GetEnvironmentById(ctx context.Context, environmentId int32) (model.SchemaEnvironment, error)
GetEnvironmentById - retrieves a schema environment by id.
func (*BloodhoundDB) GetEnvironmentByKinds ¶
func (s *BloodhoundDB) GetEnvironmentByKinds(ctx context.Context, environmentKindId, sourceKindId int32) (model.SchemaEnvironment, error)
GetEnvironmentByKinds - retrieves an environment by its environment kind and source kind.
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) 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) 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) 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) GetKindById ¶
func (*BloodhoundDB) GetKindByName ¶
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) 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) 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) 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) GetSchemaRelationshipFindingById ¶
func (s *BloodhoundDB) GetSchemaRelationshipFindingById(ctx context.Context, findingId int32) (model.SchemaRelationshipFinding, error)
GetSchemaRelationshipFindingById - retrieves a schema relationship finding by id.
func (*BloodhoundDB) GetSchemaRelationshipFindingByName ¶
func (s *BloodhoundDB) GetSchemaRelationshipFindingByName(ctx context.Context, name string) (model.SchemaRelationshipFinding, error)
GetSchemaRelationshipFindingByName - retrieves a schema relationship finding by finding name.
func (*BloodhoundDB) GetSchemaRelationshipFindingsBySchemaExtensionId ¶
func (s *BloodhoundDB) GetSchemaRelationshipFindingsBySchemaExtensionId(ctx context.Context, extensionId int32) ([]model.SchemaRelationshipFinding, error)
GetSchemaRelationshipFindingsBySchemaExtensionId - returns all findings by extension id.
func (*BloodhoundDB) GetScopeForSavedQuery ¶
func (s *BloodhoundDB) GetScopeForSavedQuery(ctx context.Context, queryID int64, userID uuid.UUID) (SavedQueryScopeMap, error)
GetScopeForSavedQuery will return a map of the possible scopes given a query id and a user id
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) (SourceKind, error)
GetSourceKindByID - retrieves source_kind by source_kind table id
func (*BloodhoundDB) GetSourceKindByName ¶
func (s *BloodhoundDB) GetSourceKindByName(ctx context.Context, name string) (SourceKind, error)
func (*BloodhoundDB) GetSourceKinds ¶
func (s *BloodhoundDB) GetSourceKinds(ctx context.Context) ([]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) 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, User and Installation entries based on the input provided
func (*BloodhoundDB) InsertSelectorNode ¶
func (s *BloodhoundDB) InsertSelectorNode(ctx context.Context, assetGroupTagId, selectorId int, nodeId graph.ID, certified model.AssetGroupCertification, certifiedBy null.String, source model.AssetGroupSelectorNodeSource, primaryKind, environmentId, objectId, displayName string) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) 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) UpdateSelectorNodesByNodeId ¶
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) UpsertFinding ¶
func (s *BloodhoundDB) UpsertFinding(ctx context.Context, extensionId int32, sourceKindName, relationshipKindName, environmentKind string, name, displayName string) (model.SchemaRelationshipFinding, error)
UpsertFinding validates and upserts a finding. If a finding with the same name exists, it will be deleted and re-created.
func (*BloodhoundDB) UpsertOpenGraphExtension ¶
func (s *BloodhoundDB) UpsertOpenGraphExtension(ctx context.Context, graphExtensionInput model.GraphExtensionInput) (bool, 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.
During development, it was decided to push the upsert logic down to the database layer due to difficulties of decoupling the database and service layers while still providing transactional guarantees. The following functions use models intended for the service layer and call the database public methods directly, rather than using an interface.
func (*BloodhoundDB) UpsertRemediation ¶
func (s *BloodhoundDB) UpsertRemediation(ctx context.Context, findingId int32, shortDescription, longDescription, shortRemediation, longRemediation string) error
UpsertRemediation validates and upserts a remediation. If the remediation exists for the finding ID, it is updated. If it doesn't already exist, it is created. Findings information must be inserted first before inserting remediation information.
func (*BloodhoundDB) UpsertSchemaEnvironmentWithPrincipalKinds ¶
func (s *BloodhoundDB) UpsertSchemaEnvironmentWithPrincipalKinds(ctx context.Context, schemaExtensionId int32, environmentKind string, sourceKind string, principalKinds []string) error
UpsertSchemaEnvironmentWithPrincipalKinds creates or updates an environment with its principal kinds. If an environment with the same environment kind and source kind exists, it will be replaced.
type CustomNodeKindData ¶
type CustomNodeKindData interface {
CreateCustomNodeKinds(ctx context.Context, customNodeKind model.CustomNodeKinds) (model.CustomNodeKinds, 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 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
agi.AgiData
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
SweepAssetGroupCollections(ctx context.Context)
GetAssetGroupCollections(ctx context.Context, assetGroupID int32, order string, filter model.SQLFilter) (model.AssetGroupCollections, 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
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)
// Permissions
GetAllPermissions(ctx context.Context, order string, filter model.SQLFilter) (model.Permissions, 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
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)
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
// 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
dataquality.DataQualityData
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)
GetADDataQualityAggregations(ctx context.Context, start time.Time, end time.Time, sort_by string, limit int, skip int) (model.ADDataQualityAggregations, int, error)
GetAzureDataQualityStats(ctx context.Context, tenantId string, start time.Time, end time.Time, sort_by string, limit int, skip int) (model.AzureDataQualityStats, int, error)
GetAzureDataQualityAggregations(ctx context.Context, start time.Time, end time.Time, sort_by string, limit int, skip int) (model.AzureDataQualityAggregations, int, error)
DeleteAllDataQuality(ctx context.Context) error
// 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 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)
UpdateGraphSchemaNodeKind(ctx context.Context, schemaNodeKind model.GraphSchemaNodeKind) (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
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)
GetEnvironmentByKinds(ctx context.Context, environmentKindId, sourceKindId int32) (model.SchemaEnvironment, error)
GetEnvironmentById(ctx context.Context, environmentId int32) (model.SchemaEnvironment, error)
GetEnvironments(ctx context.Context) ([]model.SchemaEnvironment, error)
DeleteEnvironment(ctx context.Context, environmentId int32) error
CreateSchemaRelationshipFinding(ctx context.Context, extensionId int32, relationshipKindId int32, environmentId int32, name string, displayName string) (model.SchemaRelationshipFinding, error)
GetSchemaRelationshipFindingById(ctx context.Context, findingId int32) (model.SchemaRelationshipFinding, error)
GetSchemaRelationshipFindingByName(ctx context.Context, name string) (model.SchemaRelationshipFinding, error)
DeleteSchemaRelationshipFinding(ctx context.Context, findingId int32) 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)
GetPrincipalKindsByEnvironmentId(ctx context.Context, environmentId int32) (model.SchemaEnvironmentPrincipalKinds, error)
DeletePrincipalKind(ctx context.Context, environmentId int32, principalKind int32) error
}
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)
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) (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) (SavedQueryScopeMap, error)
IsSavedQueryPublic(ctx context.Context, savedQueryID int64) (bool, error)
}
SavedQueriesPermissionsData methods representing the database interactions pertaining to the saved_queries_permissions model
type SavedQueryScopeMap ¶
type SavedQueryScopeMap map[model.SavedQueryScope]bool
SavedQueryScopeMap holds the information of a saved query's scope [IE: owned, shared, public]
type SourceKind ¶
type SourceKindsData ¶
type SourceKindsData interface {
GetSourceKinds(ctx context.Context) ([]SourceKind, error)
DeactivateSourceKindsByName(ctx context.Context, kinds graph.Kinds) error
RegisterSourceKind(ctx context.Context) func(sourceKind graph.Kind) error
GetSourceKindByName(ctx context.Context, name string) (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
- 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
- upsert_schema_remediation.go
Directories
¶
| Path | Synopsis |
|---|---|
|
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. |