audit work, fixed StellaOps.sln warnings/errors, fixed tests, sprints work, new advisories
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -15,6 +16,7 @@ public sealed class VexExportService : IVexExportService
|
||||
private readonly IVexStatementRepository _statementRepository;
|
||||
private readonly ILogger<VexExportService> _logger;
|
||||
private readonly VexHubOptions _options;
|
||||
private readonly TimeProvider _timeProvider;
|
||||
|
||||
private static readonly JsonSerializerOptions JsonOptions = new()
|
||||
{
|
||||
@@ -25,11 +27,13 @@ public sealed class VexExportService : IVexExportService
|
||||
public VexExportService(
|
||||
IVexStatementRepository statementRepository,
|
||||
IOptions<VexHubOptions> options,
|
||||
ILogger<VexExportService> logger)
|
||||
ILogger<VexExportService> logger,
|
||||
TimeProvider? timeProvider = null)
|
||||
{
|
||||
_statementRepository = statementRepository;
|
||||
_options = options.Value;
|
||||
_logger = logger;
|
||||
_timeProvider = timeProvider ?? TimeProvider.System;
|
||||
}
|
||||
|
||||
public async Task<Stream> ExportToOpenVexAsync(
|
||||
@@ -134,7 +138,7 @@ public sealed class VexExportService : IVexExportService
|
||||
string? purl = null)
|
||||
{
|
||||
var documentId = GenerateDocumentId(cveId, purl);
|
||||
var timestamp = DateTimeOffset.UtcNow;
|
||||
var timestamp = _timeProvider.GetUtcNow();
|
||||
|
||||
var openVexStatements = statements.Select(s => new OpenVexStatement
|
||||
{
|
||||
@@ -149,7 +153,7 @@ public sealed class VexExportService : IVexExportService
|
||||
Statement = s.StatusNotes,
|
||||
ImpactStatement = s.ImpactStatement,
|
||||
ActionStatement = s.ActionStatement,
|
||||
Timestamp = s.IssuedAt?.ToString("O")
|
||||
Timestamp = s.IssuedAt?.ToString("O", CultureInfo.InvariantCulture)
|
||||
}).ToList();
|
||||
|
||||
return new OpenVexDocument
|
||||
@@ -162,7 +166,7 @@ public sealed class VexExportService : IVexExportService
|
||||
Name = "StellaOps VexHub",
|
||||
Role = "aggregator"
|
||||
},
|
||||
Timestamp = timestamp.ToString("O"),
|
||||
Timestamp = timestamp.ToString("O", CultureInfo.InvariantCulture),
|
||||
Version = 1,
|
||||
Statements = openVexStatements
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user