From 82f0a06521cfddba890edf1f39d0799488871989 Mon Sep 17 00:00:00 2001 From: desmax74 Date: Tue, 24 Oct 2023 13:39:04 +0200 Subject: [PATCH] 1417-timestamp-UTC Signed-off-by: desmax74 --- pkg/assembler/backends/arangodb/certifyBad.go | 2 +- pkg/assembler/backends/arangodb/certifyLegal.go | 2 +- pkg/assembler/backends/arangodb/certifyVuln.go | 2 +- pkg/assembler/backends/ent/backend/certify.go | 2 +- pkg/assembler/backends/ent/backend/certifyLegal.go | 2 +- pkg/assembler/backends/ent/backend/certifyVEXStatement.go | 2 +- pkg/assembler/backends/ent/backend/scorecard.go | 4 ++-- pkg/assembler/backends/ent/backend/source.go | 2 +- pkg/assembler/backends/inmem/certifyLegal.go | 2 +- pkg/assembler/backends/inmem/vulnMetadata.go | 4 ++-- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/assembler/backends/arangodb/certifyBad.go b/pkg/assembler/backends/arangodb/certifyBad.go index 52ba52c269d..7cc8b0ad6a5 100644 --- a/pkg/assembler/backends/arangodb/certifyBad.go +++ b/pkg/assembler/backends/arangodb/certifyBad.go @@ -946,7 +946,7 @@ func getCertifyBadFromCursor(ctx context.Context, cursor driver.Cursor) ([]*mode Justification: createdValue.Justification, Origin: createdValue.Collector, Collector: createdValue.Origin, - KnownSince: createdValue.KnownSince, + KnownSince: createdValue.KnownSince.UTC(), } if pkg != nil { diff --git a/pkg/assembler/backends/arangodb/certifyLegal.go b/pkg/assembler/backends/arangodb/certifyLegal.go index c5c65772927..5e0263212df 100644 --- a/pkg/assembler/backends/arangodb/certifyLegal.go +++ b/pkg/assembler/backends/arangodb/certifyLegal.go @@ -855,7 +855,7 @@ func (c *arangoClient) getCertifyLegalFromCursor(ctx context.Context, DiscoveredLicense: createdValue.DiscoveredLicense, Attribution: createdValue.Attribution, Justification: createdValue.Justification, - TimeScanned: createdValue.TimeScanned, + TimeScanned: createdValue.TimeScanned.UTC(), Origin: createdValue.Origin, Collector: createdValue.Collector, } diff --git a/pkg/assembler/backends/arangodb/certifyVuln.go b/pkg/assembler/backends/arangodb/certifyVuln.go index caa86e6c074..31f68139be7 100644 --- a/pkg/assembler/backends/arangodb/certifyVuln.go +++ b/pkg/assembler/backends/arangodb/certifyVuln.go @@ -113,7 +113,7 @@ func setCertifyVulnMatchValues(arangoQueryBuilder *arangoQueryBuilder, certifyVu } if certifyVulnSpec.TimeScanned != nil { arangoQueryBuilder.filter("certifyVuln", timeScannedStr, "==", "@"+timeScannedStr) - queryValues[timeScannedStr] = certifyVulnSpec.TimeScanned.UTC() + queryValues[timeScannedStr] = certifyVulnSpec.TimeScanned } if certifyVulnSpec.DbURI != nil { arangoQueryBuilder.filter("certifyVuln", dbUriStr, "==", "@"+dbUriStr) diff --git a/pkg/assembler/backends/ent/backend/certify.go b/pkg/assembler/backends/ent/backend/certify.go index 78fc37eb0e8..36f682d1c8b 100644 --- a/pkg/assembler/backends/ent/backend/certify.go +++ b/pkg/assembler/backends/ent/backend/certify.go @@ -162,7 +162,7 @@ func upsertCertification[T certificationInputSpec](ctx context.Context, client * SetJustification(v.Justification). SetOrigin(v.Origin). SetCollector(v.Collector). - SetKnownSince(v.KnownSince) + SetKnownSince(v.KnownSince.UTC()) case model.CertifyGoodInputSpec: insert. SetType(certification.TypeGOOD). diff --git a/pkg/assembler/backends/ent/backend/certifyLegal.go b/pkg/assembler/backends/ent/backend/certifyLegal.go index 402012df9ec..164a72b3d29 100644 --- a/pkg/assembler/backends/ent/backend/certifyLegal.go +++ b/pkg/assembler/backends/ent/backend/certifyLegal.go @@ -97,7 +97,7 @@ func (b *EntBackend) IngestCertifyLegal(ctx context.Context, subject model.Packa SetDiscoveredLicense(spec.DiscoveredLicense). SetAttribution(spec.Attribution). SetJustification(spec.Justification). - SetTimeScanned(spec.TimeScanned). + SetTimeScanned(spec.TimeScanned.UTC()). SetOrigin(spec.Origin). SetCollector(spec.Collector) diff --git a/pkg/assembler/backends/ent/backend/certifyVEXStatement.go b/pkg/assembler/backends/ent/backend/certifyVEXStatement.go index 1c4e88cc59b..0aca0434d11 100644 --- a/pkg/assembler/backends/ent/backend/certifyVEXStatement.go +++ b/pkg/assembler/backends/ent/backend/certifyVEXStatement.go @@ -92,7 +92,7 @@ func (b *EntBackend) IngestVEXStatement(ctx context.Context, subject model.Packa } insert. - SetKnownSince(vexStatement.KnownSince). + SetKnownSince(vexStatement.KnownSince.UTC()). SetStatus(vexStatement.Status.String()). SetStatement(vexStatement.Statement). SetStatusNotes(vexStatement.StatusNotes). diff --git a/pkg/assembler/backends/ent/backend/scorecard.go b/pkg/assembler/backends/ent/backend/scorecard.go index d6fd5427091..9453ec58aee 100644 --- a/pkg/assembler/backends/ent/backend/scorecard.go +++ b/pkg/assembler/backends/ent/backend/scorecard.go @@ -133,7 +133,7 @@ func upsertScorecard(ctx context.Context, tx *ent.Tx, source model.SourceInputSp Create(). SetChecks(checks). SetAggregateScore(scorecardInput.AggregateScore). - SetTimeScanned(scorecardInput.TimeScanned). + SetTimeScanned(scorecardInput.TimeScanned.UTC()). SetScorecardVersion(scorecardInput.ScorecardVersion). SetScorecardCommit(scorecardInput.ScorecardCommit). SetOrigin(scorecardInput.Origin). @@ -182,7 +182,7 @@ func toModelScorecard(record *ent.Scorecard) *model.Scorecard { return &model.Scorecard{ Checks: record.Checks, AggregateScore: record.AggregateScore, - TimeScanned: record.TimeScanned, + TimeScanned: record.TimeScanned.UTC(), ScorecardVersion: record.ScorecardVersion, ScorecardCommit: record.ScorecardCommit, Origin: record.Origin, diff --git a/pkg/assembler/backends/ent/backend/source.go b/pkg/assembler/backends/ent/backend/source.go index 0092f5c3ab6..258d8df949b 100644 --- a/pkg/assembler/backends/ent/backend/source.go +++ b/pkg/assembler/backends/ent/backend/source.go @@ -103,7 +103,7 @@ func upsertHasSourceAt(ctx context.Context, client *ent.Tx, pkg model.PkgInputSp SetCollector(spec.Collector). SetOrigin(spec.Origin). SetJustification(spec.Justification). - SetKnownSince(spec.KnownSince). + SetKnownSince(spec.KnownSince.UTC()). SetSourceID(srcID) if pkgMatchType.Pkg == model.PkgMatchTypeAllVersions { diff --git a/pkg/assembler/backends/inmem/certifyLegal.go b/pkg/assembler/backends/inmem/certifyLegal.go index 59d30d3b769..8ac63fa8f68 100644 --- a/pkg/assembler/backends/inmem/certifyLegal.go +++ b/pkg/assembler/backends/inmem/certifyLegal.go @@ -223,7 +223,7 @@ func (c *demoClient) convLegal(in *certifyLegalStruct) (*model.CertifyLegal, err DiscoveredLicense: in.discoveredLicense, Attribution: in.attribution, Justification: in.justification, - TimeScanned: in.timeScanned, + TimeScanned: in.timeScanned.UTC(), Origin: in.origin, Collector: in.collector, } diff --git a/pkg/assembler/backends/inmem/vulnMetadata.go b/pkg/assembler/backends/inmem/vulnMetadata.go index bc40c41d59c..24db29f8608 100644 --- a/pkg/assembler/backends/inmem/vulnMetadata.go +++ b/pkg/assembler/backends/inmem/vulnMetadata.go @@ -120,7 +120,7 @@ func (c *demoClient) ingestVulnerabilityMetadata(ctx context.Context, vulnerabil collectedVulnMetadataLink = &vulnerabilityMetadataLink{ id: c.getNextID(), vulnerabilityID: vulnID, - timestamp: vulnerabilityMetadata.Timestamp, + timestamp: vulnerabilityMetadata.Timestamp.UTC(), scoreType: vulnerabilityMetadata.ScoreType, scoreValue: (vulnerabilityMetadata.ScoreValue), origin: vulnerabilityMetadata.Origin, @@ -287,7 +287,7 @@ func (c *demoClient) buildVulnerabilityMetadata(link *vulnerabilityMetadataLink, vulnMetadata := &model.VulnerabilityMetadata{ ID: nodeID(link.id), Vulnerability: vuln, - Timestamp: link.timestamp, + Timestamp: link.timestamp.UTC(), ScoreType: model.VulnerabilityScoreType(link.scoreType), ScoreValue: link.scoreValue, Origin: link.origin,