- Added Program.cs to set up the web application with Serilog for logging, health check endpoints, and a placeholder admission endpoint. - Configured Kestrel server to use TLS 1.3 and handle client certificates appropriately. - Created StellaOps.Zastava.Webhook.csproj with necessary dependencies including Serilog and Polly. - Documented tasks in TASKS.md for the Zastava Webhook project, outlining current work and exit criteria for each task.
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using StellaOps.Scanner.Analyzers.Lang.Node.Internal;
|
|
|
|
namespace StellaOps.Scanner.Analyzers.Lang.Node;
|
|
|
|
public sealed class NodeLanguageAnalyzer : ILanguageAnalyzer
|
|
{
|
|
public string Id => "node";
|
|
|
|
public string DisplayName => "Node.js Analyzer";
|
|
|
|
public async ValueTask AnalyzeAsync(LanguageAnalyzerContext context, LanguageComponentWriter writer, CancellationToken cancellationToken)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(context);
|
|
ArgumentNullException.ThrowIfNull(writer);
|
|
|
|
var lockData = await NodeLockData.LoadAsync(context.RootPath, cancellationToken).ConfigureAwait(false);
|
|
var packages = NodePackageCollector.CollectPackages(context, lockData, cancellationToken);
|
|
|
|
foreach (var package in packages.OrderBy(static p => p.ComponentKey, StringComparer.Ordinal))
|
|
{
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
var metadata = package.CreateMetadata();
|
|
var evidence = package.CreateEvidence();
|
|
|
|
writer.AddFromPurl(
|
|
analyzerId: Id,
|
|
purl: package.Purl,
|
|
name: package.Name,
|
|
version: package.Version,
|
|
type: "npm",
|
|
metadata: metadata,
|
|
evidence: evidence,
|
|
usedByEntrypoint: package.IsUsedByEntrypoint);
|
|
}
|
|
}
|
|
}
|