part #2
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
// Copyright (c) StellaOps
|
||||
|
||||
using StellaOps.Scanner.Core.Epss;
|
||||
|
||||
namespace StellaOps.Scanner.Worker.Processing;
|
||||
|
||||
/// <summary>
|
||||
/// Null implementation of IEpssProvider for when EPSS storage is not configured.
|
||||
/// </summary>
|
||||
internal sealed class NullEpssProvider : IEpssProvider
|
||||
{
|
||||
public Task<EpssEvidence?> GetCurrentAsync(string cveId, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult<EpssEvidence?>(null);
|
||||
|
||||
public Task<EpssBatchResult> GetCurrentBatchAsync(IEnumerable<string> cveIds, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(new EpssBatchResult { Found = [], NotFound = cveIds.ToList(), ModelDate = DateOnly.MinValue });
|
||||
|
||||
public Task<EpssEvidence?> GetAsOfDateAsync(string cveId, DateOnly asOfDate, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult<EpssEvidence?>(null);
|
||||
|
||||
public Task<IReadOnlyList<EpssEvidence>> GetHistoryAsync(string cveId, DateOnly startDate, DateOnly endDate, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult<IReadOnlyList<EpssEvidence>>([]);
|
||||
|
||||
public Task<DateOnly?> GetLatestModelDateAsync(CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult<DateOnly?>(null);
|
||||
|
||||
public Task<bool> IsAvailableAsync(CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(false);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: BUSL-1.1
|
||||
// Copyright (c) StellaOps
|
||||
// Null implementations for PoE/Reachability infrastructure dependencies
|
||||
|
||||
using StellaOps.Scanner.Reachability;
|
||||
using StellaOps.Scanner.Storage.ObjectStore;
|
||||
|
||||
namespace StellaOps.Scanner.Worker.Processing;
|
||||
|
||||
/// <summary>
|
||||
/// Null implementation of IRichGraphStore for environments without richgraph infrastructure.
|
||||
/// </summary>
|
||||
internal sealed class NullRichGraphStore : IRichGraphStore
|
||||
{
|
||||
public Task<RichGraphV1?> FetchGraphAsync(string graphHash, CancellationToken cancellationToken)
|
||||
=> Task.FromResult<RichGraphV1?>(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Null implementation of IEntryPointResolver for environments without entry point resolution.
|
||||
/// </summary>
|
||||
internal sealed class NullEntryPointResolver : IEntryPointResolver
|
||||
{
|
||||
public Task<IReadOnlyList<EntryPoint>> ResolveAsync(RichGraphV1 graph, CancellationToken cancellationToken)
|
||||
=> Task.FromResult<IReadOnlyList<EntryPoint>>([]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Null implementation of IVulnSurfaceService for environments without vulnerability surface data.
|
||||
/// </summary>
|
||||
internal sealed class NullVulnSurfaceService : IVulnSurfaceService
|
||||
{
|
||||
public Task<IReadOnlyList<AffectedSymbol>> GetAffectedSymbolsAsync(
|
||||
string vulnId, string componentRef, CancellationToken cancellationToken)
|
||||
=> Task.FromResult<IReadOnlyList<AffectedSymbol>>([]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Null implementation of IDsseSigningService for environments without signing infrastructure.
|
||||
/// </summary>
|
||||
internal sealed class NullDsseSigningService : StellaOps.Attestor.IDsseSigningService
|
||||
{
|
||||
public Task<byte[]> SignAsync(byte[] payload, string payloadType, string signingKeyId, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(Array.Empty<byte>());
|
||||
|
||||
public Task<bool> VerifyAsync(byte[] dsseEnvelope, IReadOnlyList<string> trustedKeyIds, CancellationToken cancellationToken = default)
|
||||
=> Task.FromResult(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Null implementation of IArtifactObjectStore for environments without object storage.
|
||||
/// </summary>
|
||||
internal sealed class NullArtifactObjectStore : IArtifactObjectStore
|
||||
{
|
||||
public Task PutAsync(ArtifactObjectDescriptor descriptor, Stream content, CancellationToken cancellationToken)
|
||||
=> Task.CompletedTask;
|
||||
|
||||
public Task<Stream?> GetAsync(ArtifactObjectDescriptor descriptor, CancellationToken cancellationToken)
|
||||
=> Task.FromResult<Stream?>(null);
|
||||
|
||||
public Task DeleteAsync(ArtifactObjectDescriptor descriptor, CancellationToken cancellationToken)
|
||||
=> Task.CompletedTask;
|
||||
}
|
||||
Reference in New Issue
Block a user