From 5cac2338e8f19d1956c3a8ecf8b771da4d4ff18d 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/scorecard.go | 2 +- pkg/assembler/backends/inmem/certifyBad.go | 2 +- pkg/assembler/backends/inmem/certifyGood.go | 4 ++-- pkg/assembler/backends/inmem/certifyLegal.go | 6 +++--- 9 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/scorecard.go b/pkg/assembler/backends/ent/backend/scorecard.go index d6fd5427091..a97a9b0bd11 100644 --- a/pkg/assembler/backends/ent/backend/scorecard.go +++ b/pkg/assembler/backends/ent/backend/scorecard.go @@ -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/inmem/certifyBad.go b/pkg/assembler/backends/inmem/certifyBad.go index 92924388f49..4619b68cd14 100644 --- a/pkg/assembler/backends/inmem/certifyBad.go +++ b/pkg/assembler/backends/inmem/certifyBad.go @@ -162,7 +162,7 @@ func (c *demoClient) ingestCertifyBad(ctx context.Context, subject model.Package } if subjectMatch && certifyBad.Justification == v.justification && certifyBad.Origin == v.origin && certifyBad.Collector == v.collector && - certifyBad.KnownSince.Equal(v.knownSince) { + certifyBad.KnownSince.UTC().Equal(v.knownSince.UTC()) { collectedCertifyBadLink = *v duplicate = true diff --git a/pkg/assembler/backends/inmem/certifyGood.go b/pkg/assembler/backends/inmem/certifyGood.go index 1d8b93a84ea..ffa17889ee1 100644 --- a/pkg/assembler/backends/inmem/certifyGood.go +++ b/pkg/assembler/backends/inmem/certifyGood.go @@ -161,7 +161,7 @@ func (c *demoClient) ingestCertifyGood(ctx context.Context, subject model.Packag } if subjectMatch && certifyGood.Justification == v.justification && certifyGood.Origin == v.origin && certifyGood.Collector == v.collector && - certifyGood.KnownSince.Equal(v.knownSince) { + certifyGood.KnownSince.UTC().Equal(v.knownSince.UTC()) { collectedCertifyGoodLink = *v duplicate = true @@ -292,7 +292,7 @@ func (c *demoClient) addCGIfMatch(out []*model.CertifyGood, noMatch(filter.Collector, link.collector) || noMatch(filter.Collector, link.collector) || noMatch(filter.Origin, link.origin) || - filter.KnownSince != nil && filter.KnownSince.After(link.knownSince) { + filter.KnownSince != nil && filter.KnownSince.UTC().After(link.knownSince.UTC()) { return out, nil } } diff --git a/pkg/assembler/backends/inmem/certifyLegal.go b/pkg/assembler/backends/inmem/certifyLegal.go index 59d30d3b769..c4b3bbca704 100644 --- a/pkg/assembler/backends/inmem/certifyLegal.go +++ b/pkg/assembler/backends/inmem/certifyLegal.go @@ -164,7 +164,7 @@ func (c *demoClient) ingestCertifyLegal(ctx context.Context, subject model.Packa cl.discoveredLicense == certifyLegal.DiscoveredLicense && slices.Equal(cl.discoveredLicenses, dis) && cl.attribution == certifyLegal.Attribution && - cl.timeScanned.Equal(certifyLegal.TimeScanned) && + cl.timeScanned.UTC().Equal(certifyLegal.TimeScanned.UTC()) && cl.justification == certifyLegal.Justification && cl.origin == certifyLegal.Origin && cl.collector == certifyLegal.Collector { @@ -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, } @@ -365,7 +365,7 @@ func (c *demoClient) addLegalIfMatch(out []*model.CertifyLegal, noMatch(filter.Justification, link.justification) || noMatch(filter.Origin, link.origin) || noMatch(filter.Collector, link.collector) || - (filter.TimeScanned != nil && !link.timeScanned.Equal(*filter.TimeScanned)) || + (filter.TimeScanned != nil && !link.timeScanned.UTC().Equal(filter.TimeScanned.UTC())) || !c.matchLicenses(filter.DeclaredLicenses, link.declaredLicenses) || !c.matchLicenses(filter.DiscoveredLicenses, link.discoveredLicenses) { return out, nil