feat: Add native binary analyzer test utilities and implement SM2 signing tests
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Manifest Integrity / Audit SHA256SUMS Files (push) Has been cancelled
Manifest Integrity / Validate Schema Integrity (push) Has been cancelled
Manifest Integrity / Validate Contract Documents (push) Has been cancelled
Manifest Integrity / Validate Pack Fixtures (push) Has been cancelled
Manifest Integrity / Verify Merkle Roots (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
Signals CI & Image / signals-ci (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Export Center CI / export-ci (push) Has been cancelled
Notify Smoke Test / Notify Unit Tests (push) Has been cancelled
Notify Smoke Test / Notifier Service Tests (push) Has been cancelled
Notify Smoke Test / Notification Smoke Test (push) Has been cancelled
- Introduced `NativeTestBase` class for ELF, PE, and Mach-O binary parsing helpers and assertions. - Created `TestCryptoFactory` for SM2 cryptographic provider setup and key generation. - Implemented `Sm2SigningTests` to validate signing functionality with environment gate checks. - Developed console export service and store with comprehensive unit tests for export status management.
This commit is contained in:
@@ -119,4 +119,137 @@ public sealed class BunLanguageAnalyzerTests
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ScopedPackagesAreParsedAsync()
|
||||
{
|
||||
var cancellationToken = TestContext.Current.CancellationToken;
|
||||
var fixturePath = TestPaths.ResolveFixture("lang", "bun", "scoped-packages");
|
||||
var goldenPath = Path.Combine(fixturePath, "expected.json");
|
||||
|
||||
var analyzers = new ILanguageAnalyzer[]
|
||||
{
|
||||
new BunLanguageAnalyzer()
|
||||
};
|
||||
|
||||
await LanguageAnalyzerTestHarness.AssertDeterministicAsync(
|
||||
fixturePath,
|
||||
goldenPath,
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GitDependenciesAreParsedAsync()
|
||||
{
|
||||
var cancellationToken = TestContext.Current.CancellationToken;
|
||||
var fixturePath = TestPaths.ResolveFixture("lang", "bun", "git-dependencies");
|
||||
var goldenPath = Path.Combine(fixturePath, "expected.json");
|
||||
|
||||
var analyzers = new ILanguageAnalyzer[]
|
||||
{
|
||||
new BunLanguageAnalyzer()
|
||||
};
|
||||
|
||||
await LanguageAnalyzerTestHarness.AssertDeterministicAsync(
|
||||
fixturePath,
|
||||
goldenPath,
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CustomRegistryIsParsedAsync()
|
||||
{
|
||||
var cancellationToken = TestContext.Current.CancellationToken;
|
||||
var fixturePath = TestPaths.ResolveFixture("lang", "bun", "custom-registry");
|
||||
var goldenPath = Path.Combine(fixturePath, "expected.json");
|
||||
|
||||
var analyzers = new ILanguageAnalyzer[]
|
||||
{
|
||||
new BunLanguageAnalyzer()
|
||||
};
|
||||
|
||||
await LanguageAnalyzerTestHarness.AssertDeterministicAsync(
|
||||
fixturePath,
|
||||
goldenPath,
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task PatchedPackagesAreParsedAsync()
|
||||
{
|
||||
var cancellationToken = TestContext.Current.CancellationToken;
|
||||
var fixturePath = TestPaths.ResolveFixture("lang", "bun", "patched-packages");
|
||||
var goldenPath = Path.Combine(fixturePath, "expected.json");
|
||||
|
||||
var analyzers = new ILanguageAnalyzer[]
|
||||
{
|
||||
new BunLanguageAnalyzer()
|
||||
};
|
||||
|
||||
await LanguageAnalyzerTestHarness.AssertDeterministicAsync(
|
||||
fixturePath,
|
||||
goldenPath,
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task DeepDependencyTreeIsParsedAsync()
|
||||
{
|
||||
var cancellationToken = TestContext.Current.CancellationToken;
|
||||
var fixturePath = TestPaths.ResolveFixture("lang", "bun", "deep-tree");
|
||||
var goldenPath = Path.Combine(fixturePath, "expected.json");
|
||||
|
||||
var analyzers = new ILanguageAnalyzer[]
|
||||
{
|
||||
new BunLanguageAnalyzer()
|
||||
};
|
||||
|
||||
await LanguageAnalyzerTestHarness.AssertDeterministicAsync(
|
||||
fixturePath,
|
||||
goldenPath,
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MultiWorkspaceIsParsedAsync()
|
||||
{
|
||||
var cancellationToken = TestContext.Current.CancellationToken;
|
||||
var fixturePath = TestPaths.ResolveFixture("lang", "bun", "multi-workspace");
|
||||
var goldenPath = Path.Combine(fixturePath, "expected.json");
|
||||
|
||||
var analyzers = new ILanguageAnalyzer[]
|
||||
{
|
||||
new BunLanguageAnalyzer()
|
||||
};
|
||||
|
||||
await LanguageAnalyzerTestHarness.AssertDeterministicAsync(
|
||||
fixturePath,
|
||||
goldenPath,
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task JsoncLockfileIsParsedAsync()
|
||||
{
|
||||
var cancellationToken = TestContext.Current.CancellationToken;
|
||||
var fixturePath = TestPaths.ResolveFixture("lang", "bun", "jsonc-lockfile");
|
||||
var goldenPath = Path.Combine(fixturePath, "expected.json");
|
||||
|
||||
var analyzers = new ILanguageAnalyzer[]
|
||||
{
|
||||
new BunLanguageAnalyzer()
|
||||
};
|
||||
|
||||
await LanguageAnalyzerTestHarness.AssertDeterministicAsync(
|
||||
fixturePath,
|
||||
goldenPath,
|
||||
analyzers,
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
using StellaOps.Scanner.Analyzers.Lang.Bun.Internal;
|
||||
|
||||
namespace StellaOps.Scanner.Analyzers.Lang.Bun.Tests.ErrorHandling;
|
||||
|
||||
public sealed class BunAnalyzerErrorHandlingTests : IDisposable
|
||||
{
|
||||
private readonly string _tempDir;
|
||||
|
||||
public BunAnalyzerErrorHandlingTests()
|
||||
{
|
||||
_tempDir = Path.Combine(Path.GetTempPath(), $"bun-error-test-{Guid.NewGuid():N}");
|
||||
Directory.CreateDirectory(_tempDir);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (Directory.Exists(_tempDir))
|
||||
{
|
||||
Directory.Delete(_tempDir, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
#region BunLockParser Error Handling
|
||||
|
||||
[Fact]
|
||||
public void MalformedBunLock_ReturnsEmptyData()
|
||||
{
|
||||
var content = "{ invalid json content }";
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmptyBunLock_ReturnsEmptyData()
|
||||
{
|
||||
var content = "";
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NullContentBunLock_ReturnsEmptyData()
|
||||
{
|
||||
var result = BunLockParser.Parse(null!);
|
||||
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NoPackagesProperty_ReturnsEmptyData()
|
||||
{
|
||||
var content = """
|
||||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
""";
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidPackageKey_SkipsEntry()
|
||||
{
|
||||
var content = """
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"packages": {
|
||||
"invalid-key-no-version": ["https://example.com/pkg.tgz", "sha512-abc"],
|
||||
"valid@1.0.0": ["https://example.com/valid.tgz", "sha512-def"]
|
||||
}
|
||||
}
|
||||
""";
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.AllEntries);
|
||||
Assert.Equal("valid", result.AllEntries[0].Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MissingBunLockFile_ReturnsEmptyData()
|
||||
{
|
||||
var nonExistentPath = Path.Combine(_tempDir, "nonexistent", "bun.lock");
|
||||
|
||||
var result = await BunLockParser.ParseAsync(nonExistentPath, CancellationToken.None);
|
||||
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BunWorkspaceHelper Error Handling
|
||||
|
||||
[Fact]
|
||||
public void MalformedPackageJson_ReturnsEmptyWorkspaceInfo()
|
||||
{
|
||||
File.WriteAllText(Path.Combine(_tempDir, "package.json"), "{ invalid json }");
|
||||
|
||||
var result = BunWorkspaceHelper.ParseWorkspaceInfo(_tempDir);
|
||||
|
||||
Assert.Empty(result.DirectDependencies);
|
||||
Assert.Empty(result.WorkspacePatterns);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingPackageJson_ReturnsEmptyWorkspaceInfo()
|
||||
{
|
||||
var result = BunWorkspaceHelper.ParseWorkspaceInfo(_tempDir);
|
||||
|
||||
Assert.Empty(result.DirectDependencies);
|
||||
Assert.Empty(result.WorkspacePatterns);
|
||||
Assert.Empty(result.PatchedDependencies);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmptyWorkspacesArray_ReturnsEmptyPatterns()
|
||||
{
|
||||
var packageJson = """
|
||||
{
|
||||
"name": "test",
|
||||
"workspaces": []
|
||||
}
|
||||
""";
|
||||
File.WriteAllText(Path.Combine(_tempDir, "package.json"), packageJson);
|
||||
|
||||
var result = BunWorkspaceHelper.ParseWorkspaceInfo(_tempDir);
|
||||
|
||||
Assert.Empty(result.WorkspacePatterns);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NonExistentWorkspacePaths_ReturnsEmptyPaths()
|
||||
{
|
||||
var packageJson = """
|
||||
{
|
||||
"name": "test",
|
||||
"workspaces": ["non-existent/*"]
|
||||
}
|
||||
""";
|
||||
File.WriteAllText(Path.Combine(_tempDir, "package.json"), packageJson);
|
||||
|
||||
var result = BunWorkspaceHelper.ParseWorkspaceInfo(_tempDir);
|
||||
|
||||
Assert.Single(result.WorkspacePatterns);
|
||||
Assert.Empty(result.WorkspacePaths);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BunConfigHelper Error Handling
|
||||
|
||||
[Fact]
|
||||
public void MissingBunfigToml_ReturnsEmptyConfig()
|
||||
{
|
||||
var result = BunConfigHelper.ParseConfig(_tempDir);
|
||||
|
||||
Assert.Null(result.DefaultRegistry);
|
||||
Assert.Empty(result.ScopeRegistries);
|
||||
Assert.False(result.HasCustomRegistry);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EmptyBunfigToml_ReturnsEmptyConfig()
|
||||
{
|
||||
File.WriteAllText(Path.Combine(_tempDir, "bunfig.toml"), "");
|
||||
|
||||
var result = BunConfigHelper.ParseConfig(_tempDir);
|
||||
|
||||
Assert.Null(result.DefaultRegistry);
|
||||
Assert.Empty(result.ScopeRegistries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvalidTomlSyntax_ReturnsPartialConfig()
|
||||
{
|
||||
var bunfig = """
|
||||
[install]
|
||||
registry = "https://valid.registry.com/"
|
||||
|
||||
invalid syntax here
|
||||
""";
|
||||
File.WriteAllText(Path.Combine(_tempDir, "bunfig.toml"), bunfig);
|
||||
|
||||
var result = BunConfigHelper.ParseConfig(_tempDir);
|
||||
|
||||
// Should still parse the valid parts
|
||||
Assert.Equal("https://valid.registry.com/", result.DefaultRegistry);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BunPackage Error Handling
|
||||
|
||||
[Fact]
|
||||
public void FromLockEntry_NullEntry_ThrowsArgumentNullException()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException>(() => BunPackage.FromLockEntry(null!, "source"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddOccurrence_EmptyPath_DoesNotAdd()
|
||||
{
|
||||
var lockEntry = new BunLockEntry
|
||||
{
|
||||
Name = "test",
|
||||
Version = "1.0.0"
|
||||
};
|
||||
var package = BunPackage.FromLockEntry(lockEntry, "bun.lock");
|
||||
|
||||
package.AddOccurrence("");
|
||||
package.AddOccurrence(" ");
|
||||
|
||||
Assert.Empty(package.OccurrencePaths);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -14,7 +14,9 @@
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/@company/internal-pkg",
|
||||
"resolved": "https://npm.company.com/@company/internal-pkg/-/internal-pkg-1.0.0.tgz",
|
||||
"source": "node_modules"
|
||||
"source": "node_modules",
|
||||
"sourceType": "tarball",
|
||||
"specifier": "https://npm.company.com/@company/internal-pkg/-/internal-pkg-1.0.0.tgz"
|
||||
},
|
||||
"evidence": [
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"usedByEntrypoint": false,
|
||||
"metadata": {
|
||||
"direct": "true",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX\u002B7G/vCNNhehwxfkQ==",
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/debug",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
@@ -25,7 +25,7 @@
|
||||
"kind": "metadata",
|
||||
"source": "integrity",
|
||||
"locator": "bun.lock",
|
||||
"value": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ=="
|
||||
"value": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX\u002B7G/vCNNhehwxfkQ=="
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
"gitCommit": "abc123def456",
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/my-git-pkg",
|
||||
"resolved": "git+https://github.com/user/my-git-pkg.git#abc123def456",
|
||||
"resolved": "git\u002Bhttps://github.com/user/my-git-pkg.git#abc123def456",
|
||||
"source": "node_modules",
|
||||
"sourceType": "git",
|
||||
"specifier": "git+https://github.com/user/my-git-pkg.git#abc123def456"
|
||||
"specifier": "git\u002Bhttps://github.com/user/my-git-pkg.git#abc123def456"
|
||||
},
|
||||
"evidence": [
|
||||
{
|
||||
@@ -27,7 +27,7 @@
|
||||
"kind": "metadata",
|
||||
"source": "resolved",
|
||||
"locator": "bun.lock",
|
||||
"value": "git+https://github.com/user/my-git-pkg.git#abc123def456"
|
||||
"value": "git\u002Bhttps://github.com/user/my-git-pkg.git#abc123def456"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
// This is a comment that should be ignored
|
||||
"lockfileVersion": 1,
|
||||
"packages": {
|
||||
// Package entry with trailing comma
|
||||
"lodash@4.17.21": ["https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi+8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7+D9bF8Q=="],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
[
|
||||
{
|
||||
"analyzerId": "bun",
|
||||
"componentKey": "purl::pkg:npm/lodash@4.17.21",
|
||||
"purl": "pkg:npm/lodash@4.17.21",
|
||||
"name": "lodash",
|
||||
"version": "4.17.21",
|
||||
"type": "npm",
|
||||
"usedByEntrypoint": false,
|
||||
"metadata": {
|
||||
"direct": "true",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi\u002B8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7\u002BD9bF8Q==",
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/lodash",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"source": "node_modules"
|
||||
},
|
||||
"evidence": [
|
||||
{
|
||||
"kind": "file",
|
||||
"source": "node_modules",
|
||||
"locator": "node_modules/lodash/package.json"
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
"source": "integrity",
|
||||
"locator": "bun.lock",
|
||||
"value": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi\u002B8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7\u002BD9bF8Q=="
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
"source": "resolved",
|
||||
"locator": "bun.lock",
|
||||
"value": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "jsonc-lockfile-fixture",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.21"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"packages": {
|
||||
"lodash@4.17.21": ["https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi+8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7+D9bF8Q=="],
|
||||
"ms@2.1.3": ["https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
[
|
||||
{
|
||||
"analyzerId": "bun",
|
||||
"componentKey": "purl::pkg:npm/lodash@4.17.21",
|
||||
"purl": "pkg:npm/lodash@4.17.21",
|
||||
"name": "lodash",
|
||||
"version": "4.17.21",
|
||||
"type": "npm",
|
||||
"usedByEntrypoint": false,
|
||||
"metadata": {
|
||||
"direct": "true",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi\u002B8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7\u002BD9bF8Q==",
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/lodash",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"source": "node_modules"
|
||||
},
|
||||
"evidence": [
|
||||
{
|
||||
"kind": "file",
|
||||
"source": "node_modules",
|
||||
"locator": "node_modules/lodash/package.json"
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
"source": "integrity",
|
||||
"locator": "bun.lock",
|
||||
"value": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi\u002B8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7\u002BD9bF8Q=="
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
"source": "resolved",
|
||||
"locator": "bun.lock",
|
||||
"value": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"analyzerId": "bun",
|
||||
"componentKey": "purl::pkg:npm/ms@2.1.3",
|
||||
"purl": "pkg:npm/ms@2.1.3",
|
||||
"name": "ms",
|
||||
"version": "2.1.3",
|
||||
"type": "npm",
|
||||
"usedByEntrypoint": false,
|
||||
"metadata": {
|
||||
"direct": "true",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/ms",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"source": "node_modules"
|
||||
},
|
||||
"evidence": [
|
||||
{
|
||||
"kind": "file",
|
||||
"source": "node_modules",
|
||||
"locator": "node_modules/ms/package.json"
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
"source": "integrity",
|
||||
"locator": "bun.lock",
|
||||
"value": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
"source": "resolved",
|
||||
"locator": "bun.lock",
|
||||
"value": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "@my/app",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
"usedByEntrypoint": false,
|
||||
"metadata": {
|
||||
"direct": "true",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi+8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7+D9bF8Q==",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi\u002B8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7\u002BD9bF8Q==",
|
||||
"packageManager": "bun",
|
||||
"patchFile": "patches/lodash@4.17.21.patch",
|
||||
"patched": "true",
|
||||
@@ -27,7 +27,7 @@
|
||||
"kind": "metadata",
|
||||
"source": "integrity",
|
||||
"locator": "bun.lock",
|
||||
"value": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi+8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7+D9bF8Q=="
|
||||
"value": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vz1kAmtILi\u002B8fm9nJMg7b0GN8sMEJz2mxG/S7mNxhWQ7\u002BD9bF8Q=="
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"usedByEntrypoint": false,
|
||||
"metadata": {
|
||||
"direct": "true",
|
||||
"integrity": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw==",
|
||||
"integrity": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR\u002BK9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw==",
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/@babel/core",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.0.tgz",
|
||||
@@ -25,7 +25,7 @@
|
||||
"kind": "metadata",
|
||||
"source": "integrity",
|
||||
"locator": "bun.lock",
|
||||
"value": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw=="
|
||||
"value": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR\u002BK9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw=="
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
@@ -45,7 +45,7 @@
|
||||
"usedByEntrypoint": false,
|
||||
"metadata": {
|
||||
"direct": "true",
|
||||
"integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxXjVJa7b8XWCF/wPH2E/0Vz9e+V1B3eXX0WCw+INcAobvUag==",
|
||||
"integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi\u002BTutCgap/K3w1JyKgxXjVJa7b8XWCF/wPH2E/0Vz9e\u002BV1B3eXX0WCw\u002BINcAobvUag==",
|
||||
"packageManager": "bun",
|
||||
"path": "node_modules/@types/node",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz",
|
||||
@@ -61,7 +61,7 @@
|
||||
"kind": "metadata",
|
||||
"source": "integrity",
|
||||
"locator": "bun.lock",
|
||||
"value": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxXjVJa7b8XWCF/wPH2E/0Vz9e+V1B3eXX0WCw+INcAobvUag=="
|
||||
"value": "sha512-o9bjXmDNcF7GbM4CNQpmi\u002BTutCgap/K3w1JyKgxXjVJa7b8XWCF/wPH2E/0Vz9e\u002BV1B3eXX0WCw\u002BINcAobvUag=="
|
||||
},
|
||||
{
|
||||
"kind": "metadata",
|
||||
|
||||
@@ -2,7 +2,7 @@ using StellaOps.Scanner.Analyzers.Lang.Bun.Internal;
|
||||
|
||||
namespace StellaOps.Scanner.Analyzers.Lang.Bun.Tests.Parsers;
|
||||
|
||||
public sealed class BunConfigHelperTests
|
||||
public sealed class BunConfigHelperTests : IDisposable
|
||||
{
|
||||
private readonly string _tempDir;
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ public sealed class BunLockParserTests
|
||||
{
|
||||
var result = BunLockParser.Parse("");
|
||||
|
||||
Assert.Empty(result.Entries);
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -236,7 +236,7 @@ public sealed class BunLockParserTests
|
||||
{
|
||||
var result = BunLockParser.Parse(" \n\t ");
|
||||
|
||||
Assert.Empty(result.Entries);
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -244,7 +244,7 @@ public sealed class BunLockParserTests
|
||||
{
|
||||
var result = BunLockParser.Parse("{ invalid json }");
|
||||
|
||||
Assert.Empty(result.Entries);
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -262,8 +262,8 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
Assert.Equal("lodash", result.Entries[0].Name);
|
||||
Assert.Single(result.AllEntries);
|
||||
Assert.Equal("lodash", result.AllEntries[0].Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -280,7 +280,7 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
Assert.Single(result.AllEntries);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -297,8 +297,8 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
var entry = result.Entries[0];
|
||||
Assert.Single(result.AllEntries);
|
||||
var entry = result.AllEntries[0];
|
||||
Assert.Equal("ms", entry.Name);
|
||||
Assert.Equal("2.1.3", entry.Version);
|
||||
Assert.Equal("https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", entry.Resolved);
|
||||
@@ -319,8 +319,8 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
var entry = result.Entries[0];
|
||||
Assert.Single(result.AllEntries);
|
||||
var entry = result.AllEntries[0];
|
||||
Assert.Single(entry.Dependencies);
|
||||
Assert.Contains("ms", entry.Dependencies);
|
||||
}
|
||||
@@ -345,8 +345,8 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
var entry = result.Entries[0];
|
||||
Assert.Single(result.AllEntries);
|
||||
var entry = result.AllEntries[0];
|
||||
Assert.Equal("typescript", entry.Name);
|
||||
Assert.True(entry.IsDev);
|
||||
Assert.True(entry.IsOptional);
|
||||
@@ -367,8 +367,8 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
var entry = result.Entries[0];
|
||||
Assert.Single(result.AllEntries);
|
||||
var entry = result.AllEntries[0];
|
||||
Assert.Equal("lodash", entry.Name);
|
||||
Assert.Equal("https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", entry.Resolved);
|
||||
Assert.Null(entry.Integrity);
|
||||
@@ -390,8 +390,8 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
Assert.Equal("lodash", result.Entries[0].Name);
|
||||
Assert.Single(result.AllEntries);
|
||||
Assert.Equal("lodash", result.AllEntries[0].Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -410,10 +410,10 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Equal(3, result.Entries.Count);
|
||||
Assert.Contains(result.Entries, e => e.Name == "lodash");
|
||||
Assert.Contains(result.Entries, e => e.Name == "ms");
|
||||
Assert.Contains(result.Entries, e => e.Name == "@babel/core");
|
||||
Assert.Equal(3, result.AllEntries.Length);
|
||||
Assert.Contains(result.AllEntries, e => e.Name == "lodash");
|
||||
Assert.Contains(result.AllEntries, e => e.Name == "ms");
|
||||
Assert.Contains(result.AllEntries, e => e.Name == "@babel/core");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -430,8 +430,8 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Single(result.Entries);
|
||||
var entry = result.Entries[0];
|
||||
Assert.Single(result.AllEntries);
|
||||
var entry = result.AllEntries[0];
|
||||
Assert.Equal("git", entry.SourceType);
|
||||
Assert.Equal("abc123", entry.GitCommit);
|
||||
Assert.Equal("git+https://github.com/user/my-pkg.git#abc123", entry.Specifier);
|
||||
@@ -448,7 +448,7 @@ public sealed class BunLockParserTests
|
||||
|
||||
var result = BunLockParser.Parse(content);
|
||||
|
||||
Assert.Empty(result.Entries);
|
||||
Assert.Empty(result.AllEntries);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<LangVersion>preview</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<IsPackable>false</IsPackable>
|
||||
<UseConcelierTestInfra>false</UseConcelierTestInfra>
|
||||
<ConcelierTestingPath></ConcelierTestingPath>
|
||||
|
||||
Reference in New Issue
Block a user