repositories

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Copyright (C) 2024 Tim Bastin, l3montree GmbH

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var CleanupOrphanedRecordsSQL = `` /* 1736-byte string literal not displayed */
View Source
var Module = fx.Options(
	fx.Provide(fx.Annotate(NewPATRepository, fx.As(new(shared.PersonalAccessTokenRepository)))),
	fx.Provide(fx.Annotate(NewFrameworkControlRepository, fx.As(new(shared.FrameworkControlRepository)))),
	fx.Provide(fx.Annotate(NewAssetRepository, fx.As(new(shared.AssetRepository)))),
	fx.Provide(fx.Annotate(NewArtifactRiskHistoryRepository, fx.As(new(shared.ArtifactRiskHistoryRepository)))),
	fx.Provide(fx.Annotate(NewAssetVersionRepository, fx.As(new(shared.AssetVersionRepository)))),
	fx.Provide(fx.Annotate(NewStatisticsRepository, fx.As(new(shared.StatisticsRepository)))),
	fx.Provide(fx.Annotate(NewReleaseRepository, fx.As(new(shared.ReleaseRepository)))),
	fx.Provide(fx.Annotate(NewProjectRepository, fx.As(new(shared.ProjectRepository)))),
	fx.Provide(fx.Annotate(NewComponentRepository, fx.As(new(shared.ComponentRepository)))),
	fx.Provide(fx.Annotate(NewVulnEventRepository, fx.As(new(shared.VulnEventRepository)))),
	fx.Provide(fx.Annotate(NewOrgRepository, fx.As(new(shared.OrganizationRepository)))),
	fx.Provide(fx.Annotate(NewCVERepository, fx.As(new(shared.CveRepository)))),
	fx.Provide(fx.Annotate(NewCWERepository, fx.As(new(shared.CweRepository)))),
	fx.Provide(fx.Annotate(NewExploitRepository, fx.As(new(shared.ExploitRepository)))),
	fx.Provide(fx.Annotate(NewAffectedComponentRepository, fx.As(new(shared.AffectedComponentRepository)))),
	fx.Provide(fx.Annotate(NewDependencyVulnRepository, fx.As(new(shared.DependencyVulnRepository)))),
	fx.Provide(fx.Annotate(NewFirstPartyVulnerabilityRepository, fx.As(new(shared.FirstPartyVulnRepository)))),
	fx.Provide(fx.Annotate(NewInTotoLinkRepository, fx.As(new(shared.InTotoLinkRepository)))),
	fx.Provide(fx.Annotate(NewSupplyChainRepository, fx.As(new(shared.SupplyChainRepository)))),
	fx.Provide(fx.Annotate(NewAttestationRepository, fx.As(new(shared.AttestationRepository)))),
	fx.Provide(fx.Annotate(NewPolicyRepository, fx.As(new(shared.PolicyRepository)))),
	fx.Provide(fx.Annotate(NewLicenseRiskRepository, fx.As(new(shared.LicenseRiskRepository)))),
	fx.Provide(fx.Annotate(NewWebhookRepository, fx.As(new(shared.WebhookIntegrationRepository)))),
	fx.Provide(fx.Annotate(NewArtifactRepository, fx.As(new(shared.ArtifactRepository)))),
	fx.Provide(fx.Annotate(NewInvitationRepository, fx.As(new(shared.InvitationRepository)))),
	fx.Provide(fx.Annotate(NewExternalUserRepository, fx.As(new(shared.ExternalUserRepository)))),
	fx.Provide(fx.Annotate(NewComponentProjectRepository, fx.As(new(shared.ComponentProjectRepository)))),
	fx.Provide(fx.Annotate(NewGitLabIntegrationRepository, fx.As(new(shared.GitlabIntegrationRepository)))),
	fx.Provide(fx.Annotate(NewGitlabOauth2TokenRepository, fx.As(new(shared.GitLabOauth2TokenRepository)))),
	fx.Provide(fx.Annotate(NewAggregatedVulnRepository, fx.As(new(shared.VulnRepository)))),
	fx.Provide(fx.Annotate(NewGithubAppInstallationRepository, fx.As(new(shared.GithubAppInstallationRepository)))),
	fx.Provide(fx.Annotate(NewJiraIntegrationRepository, fx.As(new(shared.JiraIntegrationRepository)))),
	fx.Provide(fx.Annotate(NewCveRelationshipRepository, fx.As(new(shared.CVERelationshipRepository)))),
	fx.Provide(fx.Annotate(NewVEXRuleRepository, fx.As(new(shared.VEXRuleRepository)))),
	fx.Provide(fx.Annotate(NewExternalReferenceRepository, fx.As(new(shared.ExternalReferenceRepository)))),
	fx.Provide(fx.Annotate(NewTrustedEntityRepository, fx.As(new(shared.TrustedEntityRepository)))),
	fx.Provide(fx.Annotate(NewDependencyProxyRepository, fx.As(new(shared.DependencyProxySecretRepository)))),
	fx.Provide(fx.Annotate(NewAdminRepository, fx.As(new(shared.AdminRepository)))),
	fx.Provide(fx.Annotate(NewAdvisoryRepository, fx.As(new(shared.AdvisoryRepository)))),
	fx.Provide(fx.Annotate(NewCompliancePostureRepository, fx.As(new(shared.CompliancePostureRepository)))),
	fx.Provide(fx.Annotate(NewComplianceComponentRepository, fx.As(new(shared.ComplianceComponentRepository)))),
)

Module provides all repository constructors as their interfaces

Functions

func BuildQualifierQuery

func BuildQualifierQuery(db *gorm.DB, qualifiers packageurl.Qualifiers, namespace string) *gorm.DB

BuildQualifierQuery creates the database query for qualifier matching

func BuildQueryBasedOnMatchContext

func BuildQueryBasedOnMatchContext(db *gorm.DB, ctx *normalize.PurlMatchContext) *gorm.DB

func NewAffectedComponentRepository

func NewAffectedComponentRepository(db *gorm.DB) *affectedCmpRepository

func NewArtifactRepository

func NewArtifactRepository(db *gorm.DB) *artifactRepository

func NewArtifactRiskHistoryRepository

func NewArtifactRiskHistoryRepository(db *gorm.DB) *artifactRiskHistoryRepository

func NewAssetRepository

func NewAssetRepository(db *gorm.DB) *assetRepository

func NewAssetVersionRepository

func NewAssetVersionRepository(db *gorm.DB, synchronizer utils.FireAndForgetSynchronizer) *assetVersionRepository

func NewAttestationRepository

func NewAttestationRepository(db *gorm.DB) *attestationRepository

func NewCVERepository

func NewCVERepository(db *gorm.DB) *cveRepository

func NewCWERepository

func NewCWERepository(db *gorm.DB) *cweRepository

func NewComponentProjectRepository

func NewComponentProjectRepository(db *gorm.DB) *componentProjectRepository

func NewComponentRepository

func NewComponentRepository(db *gorm.DB) *componentRepository

func NewConfigRepository

func NewConfigRepository(db *gorm.DB) *configRepository

func NewCveRelationshipRepository

func NewCveRelationshipRepository(db *gorm.DB) *cveRelationshipRepository

func NewDependencyProxyRepository added in v1.3.0

func NewDependencyProxyRepository(db *gorm.DB) *dependencyProxySecretRepository

func NewDependencyVulnRepository

func NewDependencyVulnRepository(db *gorm.DB) *dependencyVulnRepository

func NewExploitRepository

func NewExploitRepository(db *gorm.DB) *exploitRepository

func NewExternalReferenceRepository

func NewExternalReferenceRepository(db *gorm.DB) shared.ExternalReferenceRepository

func NewExternalUserRepository

func NewExternalUserRepository(db *gorm.DB) *externalUserRepository

func NewFirstPartyVulnerabilityRepository

func NewFirstPartyVulnerabilityRepository(db *gorm.DB) *firstPartyVulnerabilityRepository

func NewGitLabIntegrationRepository

func NewGitLabIntegrationRepository(db *gorm.DB, encryptionService shared.DBEncryptionService) *gitlabIntegrationRepository

func NewGithubAppInstallationRepository

func NewGithubAppInstallationRepository(db *gorm.DB) *githubAppInstallationRepository

func NewGitlabOauth2TokenRepository

func NewGitlabOauth2TokenRepository(db *gorm.DB, encryptionService shared.DBEncryptionService) *gitlabOauth2TokenRepository

func NewInTotoLinkRepository

func NewInTotoLinkRepository(db *gorm.DB) *inTotoLinkRepository

func NewJiraIntegrationRepository

func NewJiraIntegrationRepository(db *gorm.DB, encryptionService shared.DBEncryptionService) *jiraIntegrationRepository

func NewOrgRepository

func NewOrgRepository(db *gorm.DB) *orgRepository

func NewPATRepository

func NewPATRepository(db *gorm.DB) *gormPatRepository

func NewPolicyRepository

func NewPolicyRepository(db *gorm.DB) *policyRepository

func NewProjectRepository

func NewProjectRepository(db *gorm.DB) *projectRepository

func NewReleaseRepository

func NewReleaseRepository(db *gorm.DB) *releaseRepository

func NewStatisticsRepository

func NewStatisticsRepository(db *gorm.DB) *statisticsRepository

func NewSupplyChainRepository

func NewSupplyChainRepository(db *gorm.DB) *supplyChainRepository

func NewTrustedEntityRepository added in v1.2.0

func NewTrustedEntityRepository(db *gorm.DB) *trustedEntityRepository

func NewVEXRuleRepository

func NewVEXRuleRepository(db *gorm.DB) *vexRuleRepository

func NewVulnEventRepository

func NewVulnEventRepository(db *gorm.DB) *eventRepository

func NewWebhookRepository

func NewWebhookRepository(db *gorm.DB, encryptionService shared.DBEncryptionService) *webhookRepository

Types

type AdminRepository added in v1.6.1

type AdminRepository struct {
	// contains filtered or unexported fields
}

func NewAdminRepository added in v1.6.1

func NewAdminRepository(db *gorm.DB) AdminRepository

func (AdminRepository) GetAllExternalEntityOrganizations added in v1.6.1

func (repository AdminRepository) GetAllExternalEntityOrganizations(ctx context.Context, tx *gorm.DB) ([]models.Org, error)

type AdvisoryRepository added in v1.10.0

type AdvisoryRepository struct {
	utils.Repository[int64, models.Advisory, *gorm.DB]
	// contains filtered or unexported fields
}

func NewAdvisoryRepository added in v1.10.0

func NewAdvisoryRepository(db *gorm.DB) *AdvisoryRepository

func (*AdvisoryRepository) Create added in v1.10.0

func (advisoryRepository *AdvisoryRepository) Create(ctx context.Context, tx *gorm.DB, advisory *models.Advisory) error

func (*AdvisoryRepository) Delete added in v1.10.0

func (advisoryRepository *AdvisoryRepository) Delete(ctx context.Context, tx *gorm.DB, id int64) error

func (*AdvisoryRepository) GetAllAdvisoriesByAssetID added in v1.10.0

func (advisoryRepository *AdvisoryRepository) GetAllAdvisoriesByAssetID(ctx context.Context, tx *gorm.DB, assetID uuid.UUID) ([]models.Advisory, error)

func (*AdvisoryRepository) ReadAdvisory added in v1.10.0

func (advisoryRepository *AdvisoryRepository) ReadAdvisory(ctx context.Context, tx *gorm.DB, id int64) (models.Advisory, error)

func (*AdvisoryRepository) ReadAll added in v1.10.0

func (advisoryRepository *AdvisoryRepository) ReadAll(ctx context.Context, tx *gorm.DB, assetID uuid.UUID, filter []shared.FilterQuery, pagination shared.PageInfo) (shared.Paged[models.Advisory], error)

func (*AdvisoryRepository) Update added in v1.10.0

func (advisoryRepository *AdvisoryRepository) Update(ctx context.Context, tx *gorm.DB, id int64, advisory *models.Advisory) error

type AggregatedVulnRepository

type AggregatedVulnRepository struct {
	// contains filtered or unexported fields
}

func NewAggregatedVulnRepository

func NewAggregatedVulnRepository(db *gorm.DB) *AggregatedVulnRepository

func (AggregatedVulnRepository) ApplyAndSave

func (a AggregatedVulnRepository) ApplyAndSave(ctx context.Context, tx *gorm.DB, vuln models.Vuln, vulnEvent *models.VulnEvent) error

func (AggregatedVulnRepository) FindByTicketID

func (a AggregatedVulnRepository) FindByTicketID(ctx context.Context, tx *gorm.DB, ticketID string) (models.Vuln, error)

func (AggregatedVulnRepository) GetOrgFromVuln

func (a AggregatedVulnRepository) GetOrgFromVuln(ctx context.Context, tx *gorm.DB, vuln models.Vuln) (models.Org, error)

func (AggregatedVulnRepository) Save

func (a AggregatedVulnRepository) Save(ctx context.Context, tx *gorm.DB, vuln *models.Vuln) error

func (AggregatedVulnRepository) Transaction

func (a AggregatedVulnRepository) Transaction(ctx context.Context, txFunc func(tx *gorm.DB) error) error

type ComplianceComponentRepository added in v1.10.0

type ComplianceComponentRepository struct {
	// contains filtered or unexported fields
}

func NewComplianceComponentRepository added in v1.10.0

func NewComplianceComponentRepository(db *gorm.DB) *ComplianceComponentRepository

func (*ComplianceComponentRepository) CreateStatement added in v1.10.0

func (*ComplianceComponentRepository) DeleteStatement added in v1.10.0

func (*ComplianceComponentRepository) GetDB added in v1.10.0

func (*ComplianceComponentRepository) GetDetails added in v1.10.0

func (*ComplianceComponentRepository) ListAll added in v1.10.0

func (*ComplianceComponentRepository) UpdateStatement added in v1.10.0

func (r *ComplianceComponentRepository) UpdateStatement(ctx context.Context, tx *gorm.DB, statementID uuid.UUID, implementationStatus string, description string) (*models.ComplianceComponentImplementsControlStatement, error)

type CompliancePostureRepository added in v1.10.0

type CompliancePostureRepository struct {
	utils.Repository[uuid.UUID, models.CompliancePosture, *gorm.DB]
	// contains filtered or unexported fields
}

func NewCompliancePostureRepository added in v1.10.0

func NewCompliancePostureRepository(db *gorm.DB) *CompliancePostureRepository

func (*CompliancePostureRepository) ApplyAndSave added in v1.10.0

func (*CompliancePostureRepository) FindOrCreate added in v1.10.0

func (*CompliancePostureRepository) GetAllControls added in v1.10.0

func (r *CompliancePostureRepository) GetAllControls(ctx context.Context, tx *gorm.DB, assetVersionName *string, assetID *uuid.UUID, projectID *uuid.UUID, orgID uuid.UUID, search string, filter []shared.FilterQuery, sort []shared.SortQuery) ([]dtos.CompliancePostureWithDetailsDTO, error)

func (*CompliancePostureRepository) GetForAllControlsPaged added in v1.10.0

func (r *CompliancePostureRepository) GetForAllControlsPaged(ctx context.Context, tx *gorm.DB, assetVersionName *string, assetID *uuid.UUID, projectID *uuid.UUID, orgID uuid.UUID, pageInfo shared.PageInfo, search string, filter []shared.FilterQuery, sort []shared.SortQuery) (shared.Paged[dtos.CompliancePostureWithControlDTO], error)

func (*CompliancePostureRepository) GetForControl added in v1.10.0

func (r *CompliancePostureRepository) GetForControl(ctx context.Context, tx *gorm.DB, controlID string, assetVersionName *string, assetID *uuid.UUID, projectID *uuid.UUID, orgID uuid.UUID) (*models.CompliancePosture, error)

func (*CompliancePostureRepository) GetStatsForAllControls added in v1.10.0

func (r *CompliancePostureRepository) GetStatsForAllControls(ctx context.Context, tx *gorm.DB, assetVersionName *string, assetID *uuid.UUID, projectID *uuid.UUID, orgID uuid.UUID, filter []shared.FilterQuery) (dtos.CompliancePostureStatsDTO, error)

type FrameworkControlRepository added in v1.10.0

type FrameworkControlRepository struct {
	utils.Repository[uuid.UUID, models.FrameworkControl, *gorm.DB]
	// contains filtered or unexported fields
}

func NewFrameworkControlRepository added in v1.10.0

func NewFrameworkControlRepository(db *gorm.DB) *FrameworkControlRepository

func (*FrameworkControlRepository) GetAll added in v1.10.0

func (r *FrameworkControlRepository) GetAll(ctx context.Context, tx *gorm.DB, framework *string) ([]models.FrameworkControl, error)

func (*FrameworkControlRepository) ListFrameworkControls added in v1.10.0

func (r *FrameworkControlRepository) ListFrameworkControls(ctx context.Context, tx *gorm.DB) ([]string, error)

ListFrameworkControls returns the unique set of framework names

type GormRepository

type GormRepository[ID comparable, T utils.Tabler] struct {
	// contains filtered or unexported fields
}

func (*GormRepository[ID, T]) Activate

func (g *GormRepository[ID, T]) Activate(ctx context.Context, tx *gorm.DB, id ID) error

func (*GormRepository[ID, T]) All

func (g *GormRepository[ID, T]) All(ctx context.Context, tx *gorm.DB) ([]T, error)

func (*GormRepository[ID, T]) Begin

func (g *GormRepository[ID, T]) Begin(ctx context.Context) *gorm.DB

func (*GormRepository[ID, T]) CleanupOrphanedRecords added in v1.2.0

func (g *GormRepository[ID, T]) CleanupOrphanedRecords(ctx context.Context) error

func (*GormRepository[ID, T]) Create

func (g *GormRepository[ID, T]) Create(ctx context.Context, tx *gorm.DB, t *T) error

func (*GormRepository[ID, T]) CreateBatch

func (g *GormRepository[ID, T]) CreateBatch(ctx context.Context, tx *gorm.DB, ts []T) error

func (*GormRepository[ID, T]) Delete

func (g *GormRepository[ID, T]) Delete(ctx context.Context, tx *gorm.DB, id ID) error

func (*GormRepository[ID, T]) DeleteBatch

func (g *GormRepository[ID, T]) DeleteBatch(ctx context.Context, tx *gorm.DB, m []T) error

func (*GormRepository[ID, T]) GetDB

func (g *GormRepository[ID, T]) GetDB(ctx context.Context, tx *gorm.DB) *gorm.DB

func (*GormRepository[ID, T]) List

func (g *GormRepository[ID, T]) List(ctx context.Context, tx *gorm.DB, ids []ID) ([]T, error)

func (*GormRepository[ID, T]) Read

func (g *GormRepository[ID, T]) Read(ctx context.Context, tx *gorm.DB, id ID) (T, error)

func (*GormRepository[ID, T]) Save

func (g *GormRepository[ID, T]) Save(ctx context.Context, tx *gorm.DB, t *T) error

func (*GormRepository[ID, T]) SaveBatch

func (g *GormRepository[ID, T]) SaveBatch(ctx context.Context, tx *gorm.DB, ts []T) error

func (*GormRepository[ID, T]) SaveBatchBestEffort

func (g *GormRepository[ID, T]) SaveBatchBestEffort(
	ctx context.Context,
	tx *gorm.DB,
	ts []T,
) error

it does not save any associations, so it is the caller's responsibility to save them separately if needed

func (*GormRepository[ID, T]) Transaction

func (g *GormRepository[ID, T]) Transaction(ctx context.Context, f func(tx *gorm.DB) error) error

func (*GormRepository[ID, T]) Upsert

func (g *GormRepository[ID, T]) Upsert(ctx context.Context, tx *gorm.DB, t *[]*T, conflictingColumns []clause.Column, updateOnly []string) error

type InvitationRepository

type InvitationRepository struct {
	utils.Repository[uuid.UUID, models.Invitation, *gorm.DB]
	// contains filtered or unexported fields
}

func NewInvitationRepository

func NewInvitationRepository(db *gorm.DB) *InvitationRepository

func (*InvitationRepository) FindByCode

func (g *InvitationRepository) FindByCode(ctx context.Context, tx *gorm.DB, code string) (models.Invitation, error)

func (*InvitationRepository) FindByOrgID added in v1.9.0

func (g *InvitationRepository) FindByOrgID(ctx context.Context, tx *gorm.DB, orgID string) ([]models.Invitation, error)

func (*InvitationRepository) Save

func (g *InvitationRepository) Save(ctx context.Context, tx *gorm.DB, invitation *models.Invitation) error

type LicenseRiskRepository

type LicenseRiskRepository struct {
	utils.Repository[uuid.UUID, models.LicenseRisk, *gorm.DB]
	// contains filtered or unexported fields
}

func NewLicenseRiskRepository

func NewLicenseRiskRepository(db *gorm.DB) *LicenseRiskRepository

func (*LicenseRiskRepository) ApplyAndSave

func (repository *LicenseRiskRepository) ApplyAndSave(ctx context.Context, tx *gorm.DB, licenseRisk *models.LicenseRisk, vulnEvent *models.VulnEvent) error

func (*LicenseRiskRepository) DeleteByComponentPurl

func (repository *LicenseRiskRepository) DeleteByComponentPurl(ctx context.Context, tx *gorm.DB, assetID uuid.UUID, assetVersionName string, pURL packageurl.PackageURL) error

func (*LicenseRiskRepository) GetAllLicenseRisksForAssetVersion

func (repository *LicenseRiskRepository) GetAllLicenseRisksForAssetVersion(ctx context.Context, tx *gorm.DB, assetID uuid.UUID, assetVersionName string) ([]models.LicenseRisk, error)

func (*LicenseRiskRepository) GetAllLicenseRisksForAssetVersionPaged

func (repository *LicenseRiskRepository) GetAllLicenseRisksForAssetVersionPaged(ctx context.Context, tx *gorm.DB, assetID uuid.UUID, assetVersionName string, pageInfo shared.PageInfo, search string, filter []shared.FilterQuery, sort []shared.SortQuery) (shared.Paged[models.LicenseRisk], error)

func (*LicenseRiskRepository) GetAllOverwrittenLicensesForAssetVersion

func (repository *LicenseRiskRepository) GetAllOverwrittenLicensesForAssetVersion(ctx context.Context, tx *gorm.DB, assetID uuid.UUID, assetVersionName string) ([]models.LicenseRisk, error)

func (*LicenseRiskRepository) GetByAssetID

func (repository *LicenseRiskRepository) GetByAssetID(ctx context.Context, tx *gorm.DB, assetID uuid.UUID) ([]models.LicenseRisk, error)

func (*LicenseRiskRepository) GetLicenseRisksByOtherAssetVersions

func (repository *LicenseRiskRepository) GetLicenseRisksByOtherAssetVersions(ctx context.Context, tx *gorm.DB, assetVersionName string, assetID uuid.UUID) ([]models.LicenseRisk, error)

func (*LicenseRiskRepository) ListByArtifactName

func (repository *LicenseRiskRepository) ListByArtifactName(ctx context.Context, tx *gorm.DB, assetVersionName string, assetID uuid.UUID, artifactName string) ([]models.LicenseRisk, error)

func (*LicenseRiskRepository) MaybeGetLicenseOverwriteForComponent

func (repository *LicenseRiskRepository) MaybeGetLicenseOverwriteForComponent(ctx context.Context, tx *gorm.DB, assetID uuid.UUID, assetVersionName string, pURL packageurl.PackageURL) (models.LicenseRisk, error)

func (*LicenseRiskRepository) Read

func (repository *LicenseRiskRepository) Read(ctx context.Context, tx *gorm.DB, vulnID uuid.UUID) (models.LicenseRisk, error)

type MaliciousPackageRepository

type MaliciousPackageRepository struct {
	// contains filtered or unexported fields
}

func NewMaliciousPackageRepository

func NewMaliciousPackageRepository(db *gorm.DB) *MaliciousPackageRepository

func (*MaliciousPackageRepository) GetDB

func (r *MaliciousPackageRepository) GetDB(ctx context.Context, tx *gorm.DB) *gorm.DB

func (*MaliciousPackageRepository) GetMaliciousAffectedComponents

func (r *MaliciousPackageRepository) GetMaliciousAffectedComponents(ctx context.Context, tx *gorm.DB, purl packageurl.PackageURL) ([]models.MaliciousAffectedComponent, error)

GetMaliciousAffectedComponents finds malicious packages for a given purl (similar to GetAffectedComponents)

func (*MaliciousPackageRepository) GetMaliciousPackageByID added in v1.4.0

func (r *MaliciousPackageRepository) GetMaliciousPackageByID(ctx context.Context, tx *gorm.DB, id string) (models.MaliciousPackage, error)

type VulnStats

type VulnStats struct {
	TotalRisk           float64 `json:"total_risk"`
	AvgRisk             float64 `json:"avg_risk"`
	MaxRisk             float64 `json:"max_risk"`
	DependencyVulnCount int64   `json:"dependencyVuln_count"`
	PackageName         string  `json:"package_name"`
}

type VulnerabilityRepository

type VulnerabilityRepository[T utils.Tabler] struct {
	utils.Repository[uuid.UUID, T, *gorm.DB]
	// contains filtered or unexported fields
}

func NewVulnerabilityRepository

func NewVulnerabilityRepository[T utils.Tabler](db *gorm.DB) *VulnerabilityRepository[T]

func (*VulnerabilityRepository[T]) FindByTicketID

func (r *VulnerabilityRepository[T]) FindByTicketID(ctx context.Context, tx *gorm.DB, ticketID string) (T, error)

func (*VulnerabilityRepository[T]) GetAllByAssetIDAndState

func (r *VulnerabilityRepository[T]) GetAllByAssetIDAndState(
	ctx context.Context,
	tx *gorm.DB,
	assetID uuid.UUID,
	state dtos.VulnState,
	durationSinceStateChange time.Duration,
) ([]T, error)

func (*VulnerabilityRepository[T]) GetAllOpenVulnsByAssetVersionNameAndAssetID

func (r *VulnerabilityRepository[T]) GetAllOpenVulnsByAssetVersionNameAndAssetID(ctx context.Context, tx *gorm.DB, assetVersionName string, assetID uuid.UUID) ([]T, error)

func (*VulnerabilityRepository[T]) GetAllVulnsByAssetID

func (r *VulnerabilityRepository[T]) GetAllVulnsByAssetID(ctx context.Context, tx *gorm.DB, assetID uuid.UUID) ([]T, error)

func (*VulnerabilityRepository[T]) GetByAssetID

func (r *VulnerabilityRepository[T]) GetByAssetID(
	ctx context.Context,
	tx *gorm.DB,
	assetID uuid.UUID,
) ([]T, error)

Jump to

Keyboard shortcuts

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