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 <https://www.gnu.org/licenses/>.
Copyright 2025 l3montree UG (haftungsbeschraenkt). SPDX-License-Identifier: AGPL-3.0-or-later
Index ¶
- Constants
- Variables
- func ApplyVEXRulesToVulns(ctx context.Context, rules []models.VEXRule, vulns []models.DependencyVuln) (updatedVulns []models.DependencyVuln, events []models.VulnEvent, err error)
- func AuthenticateRequestWithToken(token string, req *http.Request) error
- func ComputeVEXRuleRecommendations(ctx context.Context, allVulns []models.DependencyVuln, ...) ([]models.VEXRuleRecommendation, error)
- func CreateYAMLMetadata(organizationName string, assetName string, assetVersionName string) dtos.YamlMetadata
- func DiffVEXRulesForSource(newRules []models.VEXRule, existingRules []models.VEXRule) (rulesToAdd []models.VEXRule, rulesToRemove []models.VEXRule)
- func FetchMembersOfAsset(ctx shared.Context) ([]dtos.UserDTO, error)
- func FetchSbomsFromUpstream(ctx context.Context, artifactName string, ref string, upstreamURLs []string) (boms []*normalize.SBOMGraph, validURLs []string, ...)
- func FetchVexFromUpstream(ctx context.Context, assetID uuid.UUID, string, upstreamURLs []string) ([]models.VEXRule, []models.ExternalReference, []models.ExternalReference)
- func GenerateDocumentTitle(assetName, cveID string) *string
- func GroupRulesByAssetAndSource(rules []models.VEXRule) map[assetAndSource][]models.VEXRule
- func HexPubKeyToECDSA(hexPubKey string) (ecdsa.PublicKey, error)
- func HexTokenToECDSA(hexToken string) (ecdsa.PrivateKey, ecdsa.PublicKey, error)
- func MarkdownTableFromSBOM(outputFile *bytes.Buffer, bom *cdx.BOM) error
- func MatchRulesToVulns(ctx context.Context, rules []models.UpstreamVEXRule, ...) (map[string][]models.DependencyVuln, error)
- func MatchingSessionAccessibleRules(ctx context.Context, vulns []models.DependencyVuln, vexRules []models.VEXRule, ...) (map[uuid.UUID]models.VEXRule, error)
- func NewAssetService(assetRepository shared.AssetRepository, ...) *assetService
- func NewAssetVersionService(assetVersionRepository shared.AssetVersionRepository, ...) *assetVersionService
- func NewCSAFService(client http.Client, dependencyVulnRepository shared.DependencyVulnRepository, ...) *csafService
- func NewCompliancePostureService(compliancePostureRepository shared.CompliancePostureRepository, ...) *compliancePostureService
- func NewDatabaseLeaderElector(configService shared.ConfigService) *databaseLeaderElector
- func NewDependencyProxyService(dependencyProxySecretRepository shared.DependencyProxySecretRepository) *dependencyProxySecretService
- func NewExternalEntityProviderService(projectService shared.ProjectService, assetService shared.AssetService, ...) externalEntityProviderService
- func NewFirstPartyVulnService(firstPartyVulnRepository shared.FirstPartyVulnRepository, ...) *firstPartyVulnService
- func NewGitHubVexFetcher() gitHubVexFetcher
- func NewOpenSourceInsightService() *openSourceInsightService
- func NewProjectService(projectRepository shared.ProjectRepository, ...) *projectService
- func NewReleaseService(releaseRepository shared.ReleaseRepository) *releaseService
- func NewScanService(db shared.DB, cveRepository shared.CveRepository, ...) *scanService
- func NewStatisticsService(statisticsRepository shared.StatisticsRepository, ...) *statisticsService
- func NewWebhookService(url string, secret *string) *webhookClient
- func ReadCurrentKey() []byte
- func SetVEXRulesEnabledFromParanoidMode(rules []models.VEXRule, paranoidMode bool)
- func SignCSAFReport(csafJSON []byte) ([]byte, error)
- func VexRulesFromDocument(body []byte, source string) ([]models.UpstreamVEXRule, dtos.ExternalReferenceType, error)
- type AdminService
- func (service AdminService) AddAdminToOrg(ctx context.Context, orgID uuid.UUID, userID uuid.UUID) error
- func (service AdminService) CheckIfOrgExists(ctx context.Context, orgID uuid.UUID) error
- func (service AdminService) GetAdminsForOrg(ctx context.Context, orgID uuid.UUID, adminClient shared.AdminClient) ([]dtos.UserDTO, error)
- func (service AdminService) GetInstanceUsageStatistics(ctx context.Context, tx *gorm.DB, authClient shared.AdminClient) (dtos.InstanceUsageStatistics, error)
- func (service AdminService) GetInstanceVulnStatistics(ctx context.Context, topCVEsLimit, topComponentsLimit, topProjectsLimit int) (dtos.InstanceOverview, error)
- func (service AdminService) GetMailFromUserID(ctx context.Context, authClient shared.AdminClient, userID uuid.UUID) (string, error)
- func (service AdminService) GetOrgsWhereUserIsOwner(ctx context.Context, userID uuid.UUID) ([]models.Org, error)
- func (service AdminService) GetOwnerForOrg(ctx context.Context, orgID uuid.UUID) (uuid.UUID, error)
- func (service AdminService) GetUserIDFromMail(ctx context.Context, adminClient shared.AdminClient, email string) (uuid.UUID, error)
- func (service AdminService) RevokeAdminFromOrg(ctx context.Context, orgID uuid.UUID, userID uuid.UUID) error
- type AdvisoryService
- func (s *AdvisoryService) Create(ctx context.Context, tx shared.DB, advisory *models.Advisory) error
- func (s *AdvisoryService) Delete(ctx context.Context, tx shared.DB, id int64) error
- func (s *AdvisoryService) ReadAdvisory(ctx context.Context, tx shared.DB, id int64) (models.Advisory, error)
- func (s *AdvisoryService) ReadAll(ctx context.Context, tx shared.DB, assetID uuid.UUID, ...) (shared.Paged[models.Advisory], error)
- func (s *AdvisoryService) Update(ctx context.Context, tx shared.DB, id int64, advisory *models.Advisory, ...) error
- type ArtifactService
- func (s *ArtifactService) DeleteArtifact(ctx context.Context, assetID uuid.UUID, assetVersionName string, ...) error
- func (s *ArtifactService) GatherVexInformationIncludingResolvedMarking(ctx context.Context, assetVersion models.AssetVersion, artifactName *string) ([]models.DependencyVuln, error)
- func (s *ArtifactService) GetArtifactsByAssetIDAndAssetVersionName(ctx context.Context, tx shared.DB, assetID uuid.UUID, assetVersionName string) ([]models.Artifact, error)
- func (s *ArtifactService) ReadArtifact(ctx context.Context, tx shared.DB, name string, assetVersionName string, ...) (models.Artifact, error)
- func (s *ArtifactService) SaveArtifact(ctx context.Context, tx shared.DB, artifact *models.Artifact) error
- type CVERelationshipService
- type ComponentService
- func (s *ComponentService) FetchComponentProject(ctx context.Context, component models.Component) (models.Component, error)
- func (s *ComponentService) FetchInformationSources(ctx context.Context, tx *gorm.DB, artifact *models.Artifact) ([]models.ComponentDependency, error)
- func (s *ComponentService) GetAndSaveLicenseInformation(ctx context.Context, tx shared.DB, assetVersion models.AssetVersion, ...) ([]models.Component, error)
- func (s *ComponentService) GetLicense(ctx context.Context, component models.Component) (models.Component, error)
- func (s *ComponentService) RefreshComponentProjectInformation(ctx context.Context, project models.ComponentProject)
- func (s *ComponentService) RemoveInformationSources(ctx context.Context, tx *gorm.DB, artifact *models.Artifact, ...) error
- type ConfigService
- func (service ConfigService) GetAndCacheInstanceSettings(ctx context.Context) (shared.InstanceSettings, error)
- func (service ConfigService) GetInstanceSettings(ctx context.Context) (shared.InstanceSettings, error)
- func (service ConfigService) GetJSONConfig(ctx context.Context, key string, v any) error
- func (service ConfigService) RemoveConfig(ctx context.Context, key string) error
- func (service ConfigService) SetJSONConfig(ctx context.Context, key string, v any) error
- type CrowdsourcedVexingContext
- type DBEncryptionService
- type DependencyVulnService
- func (s *DependencyVulnService) CreateVulnEventAndApply(ctx context.Context, tx shared.DB, assetID uuid.UUID, userID string, ...) (models.VulnEvent, error)
- func (s *DependencyVulnService) GetAllUniqueCVEsForAsset(ctx context.Context, assetID uuid.UUID, ...) ([]models.DependencyVuln, error)
- func (s *DependencyVulnService) RecalculateRawRiskAssessment(ctx context.Context, tx shared.DB, userID string, ...) ([]models.DependencyVuln, error)
- func (s *DependencyVulnService) SyncAllIssues(ctx context.Context, org models.Org, project models.Project, ...) error
- func (s *DependencyVulnService) SyncIssues(ctx context.Context, org models.Org, project models.Project, ...) error
- func (s *DependencyVulnService) UserDetectedDependencyVulnInAnotherArtifact(ctx context.Context, tx shared.DB, vulnerabilities []models.DependencyVuln, ...) error
- func (s *DependencyVulnService) UserDetectedDependencyVulns(ctx context.Context, tx shared.DB, userID string, userAgent *string, ...) error
- func (s *DependencyVulnService) UserDetectedExistingVulnOnDifferentBranch(ctx context.Context, tx shared.DB, scannerID string, ...) error
- func (s *DependencyVulnService) UserDidNotDetectDependencyVulnInArtifactAnymore(ctx context.Context, tx shared.DB, vulnerabilities []models.DependencyVuln, ...) error
- func (s *DependencyVulnService) UserFixedDependencyVulns(ctx context.Context, tx shared.DB, userID string, userAgent *string, ...) error
- func (s *DependencyVulnService) UserReopenedToOpen(ctx context.Context, tx shared.DB, userID string, userAgent *string, ...) error
- type InTotoService
- func (service InTotoService) HexPublicKeyToInTotoKey(hexPubKey string) (toto.Key, error)
- func (service InTotoService) VerifySupplyChain(ctx context.Context, supplyChainID string) (bool, error)
- func (service InTotoService) VerifySupplyChainByDigestOnly(ctx context.Context, digest string) (bool, error)
- func (service InTotoService) VerifySupplyChainWithOutputDigest(ctx context.Context, imageNameOrSupplyChainID string, digest string) (bool, error)
- type LicenseRiskService
- func (s *LicenseRiskService) FindLicenseRisksInComponents(ctx context.Context, tx *gorm.DB, userID string, userAgent *string, ...) error
- func (s *LicenseRiskService) MakeFinalLicenseDecision(ctx context.Context, tx *gorm.DB, vulnID uuid.UUID, ...) error
- func (s *LicenseRiskService) UpdateLicenseRiskState(ctx context.Context, tx shared.DB, userID string, ...) (models.VulnEvent, error)
- func (s *LicenseRiskService) UserDetectedExistingLicenseRiskOnDifferentBranch(ctx context.Context, tx shared.DB, artifactName string, ...) error
- func (s *LicenseRiskService) UserDetectedLicenseRiskInAnotherArtifact(ctx context.Context, tx shared.DB, licenseRisks []models.LicenseRisk, ...) error
- func (s *LicenseRiskService) UserDetectedLicenseRisks(ctx context.Context, tx shared.DB, userID string, userAgent *string, ...) error
- func (s *LicenseRiskService) UserDidNotDetectLicenseRiskInArtifactAnymore(ctx context.Context, tx shared.DB, licenseRisks []models.LicenseRisk, ...) error
- func (s *LicenseRiskService) UserFixedLicenseRisks(ctx context.Context, tx shared.DB, userID string, userAgent *string, ...) error
- func (s *LicenseRiskService) UserFixedLicenseRisksByAutomaticRefresh(ctx context.Context, tx shared.DB, userID string, userAgent *string, ...) error
- type OrgRBACData
- type OrgService
- type PatService
- func (p *PatService) CheckForValidTokenByFingerprint(ctx context.Context, fingerprint string) (models.PAT, bool)
- func (p *PatService) RevokeByPrivateKey(ctx context.Context, privKey string) error
- func (p *PatService) ToModel(ctx context.Context, request dtos.PatCreateRequest, owner dtos.TokenOwner) (models.PAT, string, error)
- func (p *PatService) VerifyAPIToken(ctx context.Context, token string) (shared.AuthSession, error)
- func (p *PatService) VerifyAdminRequest(req *http.Request) (bool, error)
- func (p *PatService) VerifyRequestSignature(ctx context.Context, req *http.Request) (shared.AuthSession, error)
- type TestPayloadType
- type WebhookStruct
- type WebhookType
Constants ¶
const KeyFilePathENVName = "APP_SIDE_ENCRYPTION_KEY_PATH"
const StatisticsExpiryTime = 15 * time.Minute
Variables ¶
var BearerTokenPrefix = "dvg_"
var ServiceModule = fx.Options( fx.Provide(fx.Annotate(utils.NewFireAndForgetSynchronizer, fx.As(new(utils.FireAndForgetSynchronizer)))), fx.Provide(fx.Annotate(NewDatabaseLeaderElector, fx.As(new(shared.LeaderElector)))), fx.Provide(fx.Annotate(NewConfigService, fx.As(new(shared.ConfigService)))), fx.Provide(fx.Annotate(NewFirstPartyVulnService, fx.As(new(shared.FirstPartyVulnService)))), fx.Provide(fx.Annotate(NewLicenseRiskService, fx.As(new(shared.LicenseRiskService)))), fx.Provide(fx.Annotate(NewProjectService, fx.As(new(shared.ProjectService)))), fx.Provide(fx.Annotate(NewAssetService, fx.As(new(shared.AssetService)))), fx.Provide(fx.Annotate(NewComponentService, fx.As(new(shared.ComponentService)))), fx.Provide(fx.Annotate(NewAssetVersionService, fx.As(new(shared.AssetVersionService)))), fx.Provide(func() http.Client { return utils.EgressClient }), fx.Provide(fx.Annotate(NewCSAFService, fx.As(new(shared.CSAFService)))), fx.Provide(fx.Annotate(NewArtifactService, fx.As(new(shared.ArtifactService)))), fx.Provide(fx.Annotate(NewStatisticsService, fx.As(new(shared.StatisticsService)))), fx.Provide(fx.Annotate(NewInTotoService, fx.As(new(shared.InTotoVerifierService)))), fx.Provide(fx.Annotate(NewOrgService, fx.As(new(shared.OrgService)))), fx.Provide(fx.Annotate(NewScanService, fx.As(new(shared.ScanService)))), fx.Provide(fx.Annotate(NewExternalEntityProviderService, fx.As(new(shared.ExternalEntityProviderService)))), fx.Provide(fx.Annotate(NewReleaseService, fx.As(new(shared.ReleaseService)))), fx.Provide(fx.Annotate(NewPatService, fx.As(new(shared.PersonalAccessTokenService)))), fx.Provide(fx.Annotate(NewDependencyVulnService, fx.As(new(shared.DependencyVulnService)))), fx.Provide(fx.Annotate(NewOpenSourceInsightService, fx.As(new(shared.OpenSourceInsightService)))), fx.Provide(fx.Annotate(NewDependencyProxyService, fx.As(new(shared.DependencyProxySecretService)))), fx.Provide(fx.Annotate(NewAdminService, fx.As(new(shared.AdminService)))), fx.Provide(fx.Annotate(NewDBEncryptionService, fx.As(new(shared.DBEncryptionService)))), fx.Provide(fx.Annotate(NewCVERelationshipService, fx.As(new(shared.CVERelationshipService)))), fx.Provide(fx.Annotate(NewAdvisoryService, fx.As(new(shared.AdvisoryService)))), fx.Provide(fx.Annotate(NewCompliancePostureService, fx.As(new(shared.CompliancePostureService)))), fx.Provide(fx.Annotate(NewGitHubVexFetcher, fx.As(new(shared.GitHubVexFetcher)))), )
ServiceModule provides all service-layer constructors as their interfaces
Functions ¶
func ApplyVEXRulesToVulns ¶ added in v1.12.0
func AuthenticateRequestWithToken ¶ added in v1.6.0
func ComputeVEXRuleRecommendations ¶ added in v1.12.0
func ComputeVEXRuleRecommendations( ctx context.Context, allVulns []models.DependencyVuln, allRules []models.VEXRule, upstreamRules []models.UpstreamVEXRule, crowdsourcedCtx CrowdsourcedVexingContext, ) ([]models.VEXRuleRecommendation, error)
func CreateYAMLMetadata ¶
func CreateYAMLMetadata(organizationName string, assetName string, assetVersionName string) dtos.YamlMetadata
generate the metadata used to generate the sbom-pdf and return it as struct
func DiffVEXRulesForSource ¶ added in v1.12.0
func FetchSbomsFromUpstream ¶ added in v1.12.0
func FetchVexFromUpstream ¶ added in v1.12.0
func FetchVexFromUpstream(ctx context.Context, assetID uuid.UUID, string, upstreamURLs []string) ([]models.VEXRule, []models.ExternalReference, []models.ExternalReference)
FetchVexFromUpstream downloads VEX from the given external references and converts it into VEX rules scoped to the given asset version. CSAF, OpenVEX and CycloneDX are parsed to rules by their respective transformers; the returned rules carry their VexSource (the reference URL).
func GenerateDocumentTitle ¶ added in v1.2.0
func GroupRulesByAssetAndSource ¶ added in v1.12.0
func HexTokenToECDSA ¶
func MarkdownTableFromSBOM ¶
write the components from bom to the output file following the template
func MatchRulesToVulns ¶ added in v1.12.0
func MatchRulesToVulns(ctx context.Context, rules []models.UpstreamVEXRule, vulns []models.DependencyVuln) (map[string][]models.DependencyVuln, error)
func MatchingSessionAccessibleRules ¶ added in v1.12.0
func NewAssetService ¶
func NewAssetService(assetRepository shared.AssetRepository, dependencyVulnRepository shared.DependencyVulnRepository, dependencyVulnService shared.DependencyVulnService) *assetService
func NewAssetVersionService ¶
func NewAssetVersionService(assetVersionRepository shared.AssetVersionRepository, componentRepository shared.ComponentRepository, componentService shared.ComponentService, thirdPartyIntegration shared.IntegrationAggregate, licenseRiskRepository shared.LicenseRiskRepository, synchronizer utils.FireAndForgetSynchronizer) *assetVersionService
func NewCSAFService ¶
func NewCSAFService(client http.Client, dependencyVulnRepository shared.DependencyVulnRepository, dependencyVulnService shared.DependencyVulnService, vulnEventRepository shared.VulnEventRepository, assetVersionRepository shared.AssetVersionRepository, cveRepository shared.CveRepository, artifactRepository shared.ArtifactRepository, advisoryRepository shared.AdvisoryRepository) *csafService
func NewCompliancePostureService ¶ added in v1.10.0
func NewCompliancePostureService(compliancePostureRepository shared.CompliancePostureRepository, vulnEventRepository shared.VulnEventRepository) *compliancePostureService
func NewDatabaseLeaderElector ¶
func NewDatabaseLeaderElector(configService shared.ConfigService) *databaseLeaderElector
func NewDependencyProxyService ¶ added in v1.3.0
func NewDependencyProxyService(dependencyProxySecretRepository shared.DependencyProxySecretRepository) *dependencyProxySecretService
func NewExternalEntityProviderService ¶
func NewExternalEntityProviderService( projectService shared.ProjectService, assetService shared.AssetService, assetRepository shared.AssetRepository, projectRepository shared.ProjectRepository, rbacProvider shared.RBACProvider, organizationRepository shared.OrganizationRepository, ) externalEntityProviderService
func NewFirstPartyVulnService ¶
func NewFirstPartyVulnService(firstPartyVulnRepository shared.FirstPartyVulnRepository, vulnEventRepository shared.VulnEventRepository, thirdPartyIntegration shared.IntegrationAggregate) *firstPartyVulnService
func NewGitHubVexFetcher ¶ added in v1.12.0
func NewGitHubVexFetcher() gitHubVexFetcher
func NewOpenSourceInsightService ¶
func NewOpenSourceInsightService() *openSourceInsightService
func NewProjectService ¶
func NewProjectService(projectRepository shared.ProjectRepository, assetRepository shared.AssetRepository) *projectService
func NewReleaseService ¶
func NewReleaseService(releaseRepository shared.ReleaseRepository) *releaseService
func NewScanService ¶
func NewScanService( db shared.DB, cveRepository shared.CveRepository, dependencyVulnService shared.DependencyVulnService, synchronizer utils.FireAndForgetSynchronizer, firstPartyVulnService shared.FirstPartyVulnService, firstPartyVulnRepository shared.FirstPartyVulnRepository, dependencyVulnRepository shared.DependencyVulnRepository, thirdPartyIntegration shared.IntegrationAggregate, csafService shared.CSAFService, assetVersionService shared.AssetVersionService, vexRuleRepository shared.VEXRuleRepository, vulnEventRepository shared.VulnEventRepository, externalReferenceRepository shared.ExternalReferenceRepository, componentService shared.ComponentService, ) *scanService
func NewStatisticsService ¶
func NewStatisticsService(statisticsRepository shared.StatisticsRepository, assetRiskHistoryRepository shared.ArtifactRiskHistoryRepository, dependencyVulnRepository shared.DependencyVulnRepository, assetVersionRepository shared.AssetVersionRepository) *statisticsService
func NewWebhookService ¶
func ReadCurrentKey ¶ added in v1.6.0
func ReadCurrentKey() []byte
reads the current key from the key file specified in the .env file, panicking if it is unavailable
func SetVEXRulesEnabledFromParanoidMode ¶ added in v1.12.0
func SignCSAFReport ¶
signs report and returns the resulting signature
func VexRulesFromDocument ¶ added in v1.12.0
func VexRulesFromDocument(body []byte, source string) ([]models.UpstreamVEXRule, dtos.ExternalReferenceType, error)
vexRulesFromDocument decodes a CSAF or OpenVEX document and converts it into VEX rules. nosemgrep: service-method-missing-ctx
Types ¶
type AdminService ¶ added in v1.6.1
type AdminService struct {
// contains filtered or unexported fields
}
func NewAdminService ¶ added in v1.6.1
func NewAdminService(casbinRBACProvider shared.RBACProvider, orgRepository shared.OrganizationRepository, statisticsRepository shared.StatisticsRepository) *AdminService
func (AdminService) AddAdminToOrg ¶ added in v1.6.1
func (AdminService) CheckIfOrgExists ¶ added in v1.6.1
func (AdminService) GetAdminsForOrg ¶ added in v1.6.1
func (service AdminService) GetAdminsForOrg(ctx context.Context, orgID uuid.UUID, adminClient shared.AdminClient) ([]dtos.UserDTO, error)
func (AdminService) GetInstanceUsageStatistics ¶ added in v1.6.1
func (service AdminService) GetInstanceUsageStatistics(ctx context.Context, tx *gorm.DB, authClient shared.AdminClient) (dtos.InstanceUsageStatistics, error)
func (AdminService) GetInstanceVulnStatistics ¶ added in v1.6.1
func (service AdminService) GetInstanceVulnStatistics(ctx context.Context, topCVEsLimit, topComponentsLimit, topProjectsLimit int) (dtos.InstanceOverview, error)
func (AdminService) GetMailFromUserID ¶ added in v1.6.1
func (service AdminService) GetMailFromUserID(ctx context.Context, authClient shared.AdminClient, userID uuid.UUID) (string, error)
func (AdminService) GetOrgsWhereUserIsOwner ¶ added in v1.6.1
func (AdminService) GetOwnerForOrg ¶ added in v1.6.1
func (AdminService) GetUserIDFromMail ¶ added in v1.6.1
func (service AdminService) GetUserIDFromMail(ctx context.Context, adminClient shared.AdminClient, email string) (uuid.UUID, error)
func (AdminService) RevokeAdminFromOrg ¶ added in v1.6.1
type AdvisoryService ¶ added in v1.10.0
type AdvisoryService struct {
// contains filtered or unexported fields
}
func NewAdvisoryService ¶ added in v1.10.0
func NewAdvisoryService(advisoryRepository shared.AdvisoryRepository) *AdvisoryService
func (*AdvisoryService) ReadAdvisory ¶ added in v1.10.0
type ArtifactService ¶
type ArtifactService struct {
// contains filtered or unexported fields
}
func NewArtifactService ¶
func NewArtifactService(artifactRepository shared.ArtifactRepository, csafService shared.CSAFService, cveRepository shared.CveRepository, componentRepository shared.ComponentRepository, assetVersionRepository shared.AssetVersionRepository, assetVersionService shared.AssetVersionService, dependencyVulnService shared.DependencyVulnService, dependencyVulnRepository shared.DependencyVulnRepository, scanService shared.ScanService, synchronizer utils.FireAndForgetSynchronizer) *ArtifactService
func (*ArtifactService) DeleteArtifact ¶
func (*ArtifactService) GatherVexInformationIncludingResolvedMarking ¶ added in v1.2.0
func (s *ArtifactService) GatherVexInformationIncludingResolvedMarking(ctx context.Context, assetVersion models.AssetVersion, artifactName *string) ([]models.DependencyVuln, error)
func (*ArtifactService) GetArtifactsByAssetIDAndAssetVersionName ¶
func (*ArtifactService) ReadArtifact ¶
func (*ArtifactService) SaveArtifact ¶
type CVERelationshipService ¶ added in v1.12.0
type CVERelationshipService struct {
// contains filtered or unexported fields
}
func NewCVERelationshipService ¶ added in v1.12.0
func NewCVERelationshipService(cveRelationshipRepository shared.CVERelationshipRepository) *CVERelationshipService
func (*CVERelationshipService) CreateAliasRelationshipMapBatch ¶ added in v1.12.0
func (s *CVERelationshipService) CreateAliasRelationshipMapBatch(ctx context.Context, tx shared.DB, cveIDs []string) (models.CVEMap, error)
Create a map where each CVE points to its alias. Using empty structs to validate existence without using up too much space
CVE1: {
CVE2: struct{}
CVE3: struct{}
CVE4: struct{}
}
type ComponentService ¶
type ComponentService struct {
utils.FireAndForgetSynchronizer
// contains filtered or unexported fields
}
func NewComponentService ¶
func NewComponentService(openSourceInsightsService shared.OpenSourceInsightService, componentProjectRepository shared.ComponentProjectRepository, componentRepository shared.ComponentRepository, licenseRiskService shared.LicenseRiskService, artifactRepository shared.ArtifactRepository, synchronizer utils.FireAndForgetSynchronizer) *ComponentService
func (*ComponentService) FetchComponentProject ¶ added in v1.0.1
func (*ComponentService) FetchInformationSources ¶
func (s *ComponentService) FetchInformationSources(ctx context.Context, tx *gorm.DB, artifact *models.Artifact) ([]models.ComponentDependency, error)
func (*ComponentService) GetAndSaveLicenseInformation ¶
func (*ComponentService) GetLicense ¶
func (*ComponentService) RefreshComponentProjectInformation ¶
func (s *ComponentService) RefreshComponentProjectInformation(ctx context.Context, project models.ComponentProject)
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
func NewConfigService ¶
func NewConfigService(db shared.DB) ConfigService
func (ConfigService) GetAndCacheInstanceSettings ¶ added in v1.6.0
func (service ConfigService) GetAndCacheInstanceSettings(ctx context.Context) (shared.InstanceSettings, error)
func (ConfigService) GetInstanceSettings ¶ added in v1.4.0
func (service ConfigService) GetInstanceSettings(ctx context.Context) (shared.InstanceSettings, error)
func (ConfigService) GetJSONConfig ¶
func (ConfigService) RemoveConfig ¶
func (service ConfigService) RemoveConfig(ctx context.Context, key string) error
func (ConfigService) SetJSONConfig ¶
type CrowdsourcedVexingContext ¶ added in v1.12.0
type CrowdsourcedVexingContext struct {
VexRules []models.VEXRule
CrowdSourceVexingOrgs []crowdsourcevexing.Organization
CrowdSourceVexingProj []crowdsourcevexing.Project
Assets []models.Asset
}
type DBEncryptionService ¶ added in v1.6.0
type DBEncryptionService struct {
// contains filtered or unexported fields
}
func NewDBEncryptionService ¶ added in v1.6.0
func NewDBEncryptionService() *DBEncryptionService
func NewDBEncryptionServiceFromKey ¶ added in v1.6.0
func NewDBEncryptionServiceFromKey(key []byte) (*DBEncryptionService, error)
builds a service from an explicit key; used for the key rotation
func (*DBEncryptionService) EncryptAndWrapData ¶ added in v1.6.0
func (service *DBEncryptionService) EncryptAndWrapData(data string) (string, error)
encrypts the data using AES-GCM and the loaded key and wraps it inside the encryption format (enc prefix+nonce+cipher) nosemgrep: service-method-missing-ctx -- pure crypto; no I/O, interface constraint prevents ctx addition
func (*DBEncryptionService) LoadDBEncryptionKey ¶ added in v1.6.0
func (service *DBEncryptionService) LoadDBEncryptionKey()
eagerly loads the key on startup so misconfiguration fails fast; lazy loading covers callers that skip this nosemgrep: service-method-missing-ctx,service-method-missing-ctx-empty-params -- startup helper; no request context available
func (*DBEncryptionService) MaybeDecryptData ¶ added in v1.6.0
func (service *DBEncryptionService) MaybeDecryptData(data string) (string, error)
returns the data untouched if it carries no encryption prefix (plaintext) and otherwise strips the prefix and decrypts. nosemgrep: service-method-missing-ctx -- pure crypto; no I/O, interface constraint prevents ctx addition
type DependencyVulnService ¶
type DependencyVulnService struct {
// contains filtered or unexported fields
}
func NewDependencyVulnService ¶
func NewDependencyVulnService(dependencyVulnRepository shared.DependencyVulnRepository, vulnEventRepository shared.VulnEventRepository, thirdPartyIntegration shared.IntegrationAggregate) *DependencyVulnService
func (*DependencyVulnService) CreateVulnEventAndApply ¶
func (s *DependencyVulnService) CreateVulnEventAndApply(ctx context.Context, tx shared.DB, assetID uuid.UUID, userID string, dependencyVuln *models.DependencyVuln, vulnEventType dtos.VulnEventType, justification string, mechanicalJustification dtos.MechanicalJustificationType, assetVersionName string, userAgent *string) (models.VulnEvent, error)
func (*DependencyVulnService) GetAllUniqueCVEsForAsset ¶ added in v1.2.0
func (s *DependencyVulnService) GetAllUniqueCVEsForAsset(ctx context.Context, assetID uuid.UUID, compareFunc func(existingLeader models.DependencyVuln, newVuln models.DependencyVuln) bool) ([]models.DependencyVuln, error)
returns 1 vuln for each unique CVE in the asset. The chosen vuln per CVE-ID is determined by compareFunc (if compareFunc = true , newVuln will be the new leader)
func (*DependencyVulnService) RecalculateRawRiskAssessment ¶
func (s *DependencyVulnService) RecalculateRawRiskAssessment(ctx context.Context, tx shared.DB, userID string, dependencyVulns []models.DependencyVuln, justification string, asset models.Asset) ([]models.DependencyVuln, error)
func (*DependencyVulnService) SyncAllIssues ¶
func (*DependencyVulnService) SyncIssues ¶
func (s *DependencyVulnService) SyncIssues(ctx context.Context, org models.Org, project models.Project, asset models.Asset, assetVersion models.AssetVersion, vulnList []models.DependencyVuln, userAgent *string) error
func (*DependencyVulnService) UserDetectedDependencyVulnInAnotherArtifact ¶
func (s *DependencyVulnService) UserDetectedDependencyVulnInAnotherArtifact(ctx context.Context, tx shared.DB, vulnerabilities []models.DependencyVuln, scannerID string) error
func (*DependencyVulnService) UserDetectedDependencyVulns ¶
func (s *DependencyVulnService) UserDetectedDependencyVulns(ctx context.Context, tx shared.DB, userID string, userAgent *string, artifactName string, dependencyVulns []models.DependencyVuln, assetVersion models.AssetVersion, asset models.Asset) error
func (*DependencyVulnService) UserDetectedExistingVulnOnDifferentBranch ¶
func (s *DependencyVulnService) UserDetectedExistingVulnOnDifferentBranch(ctx context.Context, tx shared.DB, scannerID string, dependencyVulns []statemachine.BranchVulnMatch[*models.DependencyVuln], assetVersion models.AssetVersion, asset models.Asset) error
func (*DependencyVulnService) UserDidNotDetectDependencyVulnInArtifactAnymore ¶
func (s *DependencyVulnService) UserDidNotDetectDependencyVulnInArtifactAnymore(ctx context.Context, tx shared.DB, vulnerabilities []models.DependencyVuln, scannerID string) error
func (*DependencyVulnService) UserFixedDependencyVulns ¶
func (s *DependencyVulnService) UserFixedDependencyVulns(ctx context.Context, tx shared.DB, userID string, userAgent *string, dependencyVulns []models.DependencyVuln, assetVersion models.AssetVersion, asset models.Asset) error
func (*DependencyVulnService) UserReopenedToOpen ¶ added in v1.3.0
func (s *DependencyVulnService) UserReopenedToOpen(ctx context.Context, tx shared.DB, userID string, userAgent *string, dependencyVulns []models.DependencyVuln) error
type InTotoService ¶
type InTotoService struct {
// contains filtered or unexported fields
}
func NewInTotoService ¶
func NewInTotoService(rbacProvider shared.RBACProvider, inTotoLinkRepository shared.InTotoLinkRepository, projectRepository shared.ProjectRepository, patRepository shared.PersonalAccessTokenRepository, supplyChainRepository shared.SupplyChainRepository) *InTotoService
func (InTotoService) HexPublicKeyToInTotoKey ¶
func (service InTotoService) HexPublicKeyToInTotoKey(hexPubKey string) (toto.Key, error)
func (InTotoService) VerifySupplyChain ¶
func (InTotoService) VerifySupplyChainByDigestOnly ¶
func (InTotoService) VerifySupplyChainWithOutputDigest ¶
type LicenseRiskService ¶
type LicenseRiskService struct {
// contains filtered or unexported fields
}
func NewLicenseRiskService ¶
func NewLicenseRiskService(licenseRiskRepository shared.LicenseRiskRepository, vulnEventRepository shared.VulnEventRepository) *LicenseRiskService
func (*LicenseRiskService) FindLicenseRisksInComponents ¶
func (*LicenseRiskService) MakeFinalLicenseDecision ¶
func (*LicenseRiskService) UpdateLicenseRiskState ¶
func (*LicenseRiskService) UserDetectedExistingLicenseRiskOnDifferentBranch ¶
func (s *LicenseRiskService) UserDetectedExistingLicenseRiskOnDifferentBranch(ctx context.Context, tx shared.DB, artifactName string, licenseRisks []models.LicenseRisk, alreadyExistingEvents [][]models.VulnEvent, assetVersion models.AssetVersion, asset models.Asset) error
func (*LicenseRiskService) UserDetectedLicenseRiskInAnotherArtifact ¶
func (s *LicenseRiskService) UserDetectedLicenseRiskInAnotherArtifact(ctx context.Context, tx shared.DB, licenseRisks []models.LicenseRisk, artifactName string) error
Helper: ensure existing license risks are associated with another artifact (insert join rows)
func (*LicenseRiskService) UserDetectedLicenseRisks ¶
func (s *LicenseRiskService) UserDetectedLicenseRisks(ctx context.Context, tx shared.DB, userID string, userAgent *string, assetID uuid.UUID, assetVersionName, artifactName string, licenseRisks []models.LicenseRisk) error
Helper: create detected events for newly opened license risks and save them
func (*LicenseRiskService) UserDidNotDetectLicenseRiskInArtifactAnymore ¶
func (s *LicenseRiskService) UserDidNotDetectLicenseRiskInArtifactAnymore(ctx context.Context, tx shared.DB, licenseRisks []models.LicenseRisk, artifactName string) error
func (*LicenseRiskService) UserFixedLicenseRisks ¶
func (s *LicenseRiskService) UserFixedLicenseRisks(ctx context.Context, tx shared.DB, userID string, userAgent *string, licenseRisks []models.LicenseRisk) error
the license risks were fixes BY REMOVING the component
type OrgRBACData ¶ added in v1.12.0
type OrgService ¶
type OrgService struct {
// contains filtered or unexported fields
}
func NewOrgService ¶
func NewOrgService(organizationRepository shared.OrganizationRepository, rbacProvider shared.RBACProvider) *OrgService
func (*OrgService) CreateOrganization ¶
func (*OrgService) ReadBySlug ¶
type PatService ¶
type PatService struct {
// contains filtered or unexported fields
}
func NewPatService ¶
func NewPatService(repository shared.PersonalAccessTokenRepository) *PatService
func (*PatService) CheckForValidTokenByFingerprint ¶ added in v1.6.0
func (*PatService) RevokeByPrivateKey ¶
func (p *PatService) RevokeByPrivateKey(ctx context.Context, privKey string) error
func (*PatService) ToModel ¶
func (p *PatService) ToModel(ctx context.Context, request dtos.PatCreateRequest, owner dtos.TokenOwner) (models.PAT, string, error)
func (*PatService) VerifyAPIToken ¶ added in v1.6.0
func (p *PatService) VerifyAPIToken(ctx context.Context, token string) (shared.AuthSession, error)
func (*PatService) VerifyAdminRequest ¶ added in v1.6.1
func (p *PatService) VerifyAdminRequest(req *http.Request) (bool, error)
nosemgrep: service-method-missing-ctx -- req.Context() carries the context; adding a separate ctx param would be redundant
func (*PatService) VerifyRequestSignature ¶
func (p *PatService) VerifyRequestSignature(ctx context.Context, req *http.Request) (shared.AuthSession, error)
type TestPayloadType ¶
type TestPayloadType string
const ( TestPayloadTypeEmpty TestPayloadType = "empty" TestPayloadTypeSampleSBOM TestPayloadType = "sampleSbom" TestPayloadTypeSampleDependencyVulns TestPayloadType = "sampleDependencyVulns" TestPayloadTypeSampleFirstPartyVulns TestPayloadType = "sampleFirstPartyVulns" )
type WebhookStruct ¶
type WebhookStruct struct {
Organization shared.OrgObject `json:"organization"`
Project shared.ProjectObject `json:"project"`
Asset shared.AssetObject `json:"asset"`
AssetVersion shared.AssetVersionObject `json:"assetVersion"`
Payload any `json:"payload"`
Type WebhookType `json:"type"`
Artifact shared.ArtifactObject `json:"artifact"`
}
type WebhookType ¶
type WebhookType string
const ( WebhookTypeSBOM WebhookType = "sbom" WebhookTypeFirstPartyVulnerabilities WebhookType = "firstPartyVulnerabilities" WebhookTypeDependencyVulnerabilities WebhookType = "dependencyVulnerabilities" WebhookTypeTest WebhookType = "test" )
Source Files
¶
- admin_service.go
- advisory_service.go
- artifact_service.go
- asset_service.go
- asset_version_service.go
- compliance_posture_service.go
- component_service.go
- config_service.go
- csaf_service.go
- cve_relationship_service.go
- db_encryption_service.go
- dependency_proxy_secret_service.go
- dependency_vuln_service.go
- external_entity_provider_service.go
- fetch_service.go
- first_party_vuln_service.go
- intoto_service.go
- leaderelection.go
- license_risk_service.go
- open_source_insight_service.go
- org_service.go
- pat_service.go
- project_service.go
- providers.go
- release_service.go
- scan_service.go
- statistics_service.go
- vex_rule_service.go
- webhook_service.go