@absolutejs/vulnerabilities

中文文档
0.15.2发布于 2026/10/23BSL-1.1TypeScriptES Module构建来源已验证近 30 天下载 1907

Scanner-neutral vulnerability normalization, policy gates, host inventory, and audit-ready evidence for AbsoluteJS applications.

原始使用文档

@absolutejs/vulnerabilities

Reusable vulnerability-management primitives for AbsoluteJS applications. The package normalizes scanner output, applies explicit severity thresholds, collects Debian/Ubuntu host inventory through a deploy-compatible target, and produces evidence objects suitable for storage or compliance reporting.

Version 0.2.0 also defines the canonical contracts shared by feed adapters, scanner adapters, persistence layers, remediation workers, and host applications. Assets, components, advisories, scanner observations, managed findings, VEX decisions, risk assessments, remediation plans, and execution evidence all carry an explicit contract version.

It deliberately preserves distribution package versions and vendor security status. A version such as 1.24.0-2ubuntu7.5 must not be reduced to upstream 1.24.0: Ubuntu and other distributions backport security fixes without changing the upstream version, and discarding the distro revision creates false positives.

import {
  assertVulnerabilityPolicy,
  createVulnerabilityEvidence,
  summarizeGrypeReport,
} from "@absolutejs/vulnerabilities";

const counts = summarizeGrypeReport(await Bun.file("grype.json").json());
assertVulnerabilityPolicy(counts, {
  maximums: { critical: 0, high: 0 },
});

const evidence = createVulnerabilityEvidence({
  asset: { id: imageDigest, kind: "container" },
  scan: {
    ...counts,
    databaseBuiltAt: grypeDatabaseBuiltAt,
    scannedAt: new Date().toISOString(),
    scanner: "grype",
  },
});

Host collection is structurally compatible with @absolutejs/deploy targets:

import { collectDebianHostInventory } from "@absolutejs/vulnerabilities/host";

const inventory = await collectDebianHostInventory(deployTarget);

Scanner execution, scheduling, persistence, remediation approvals, and user interfaces remain application concerns. This package owns the contracts and decisions those applications should not hand-roll.

The remediation lifecycle keeps deployment success separate from security verification. A successful execution requires deployment evidence, and a finding becomes fixed only after a later inventory observation proves it is absent. Remediating findings remain open while that verification is pending.

Inventory correlation is ecosystem-aware and fails closed when a version scheme cannot be compared. osv.ecosystem on a component preserves vendor release context such as Ubuntu:24.04 while the component purl remains a standard pkg:deb identifier.

import { correlateVulnerabilityInventory } from "@absolutejs/vulnerabilities";

const result = correlateVulnerabilityInventory({
  advisories,
  asset,
  components,
  existingFindings,
  observedAt: new Date().toISOString(),
});

await findingStore.saveMany(result.upserts);

Managed finding identities are deterministic and scanner-independent:

import { createStableFindingId } from "@absolutejs/vulnerabilities";

const findingId = createStableFindingId({
  tenantId: "tenant-1",
  assetId: "production-web-1",
  componentIdentity: "pkg:deb/ubuntu/[email protected]",
  vulnerabilityIds: ["CVE-2026-0001", "USN-9999-1"],
});

Alias order, duplicate aliases, and identifier case do not change the result. Changing the tenant, asset, component identity, or vulnerability identity does.

Version intelligence

Version comparison is ecosystem-aware and explainable. Debian/Ubuntu revisions, epochs, and backport suffixes are preserved rather than reduced to upstream versions. SemVer, Go module, Python PEP 440, and NuGet versions use their native ordering rules.

import {
  comparePackageVersions,
  evaluateVersionConstraints,
} from "@absolutejs/vulnerabilities";

comparePackageVersions({
  ecosystem: "ubuntu",
  left: "1.24.0-2ubuntu7.4",
  right: "1.24.0-2ubuntu7.5",
});

evaluateVersionConstraints({
  ecosystem: "ubuntu",
  installedVersion: "1.24.0-2ubuntu7.4",
  constraints: [
    { operator: "gte", version: "1.24.0" },
    { operator: "lt", version: "1.24.0-2ubuntu7.5" },
  ],
});

RPM, APK, and Maven comparisons require a verified adapter. Without one, the package returns unknown; it never substitutes lexicographic or generic SemVer ordering for an ecosystem it cannot compare defensibly.

Advisory feeds

Feed adapters share cursor, snapshot, cache, and failure-isolation contracts. Applications can persist snapshots in their own storage while keeping provider fetching separate from policy and remediation logic.

Alert operations can use VulnerabilityAlertConfiguration to keep evaluation SLAs, severity-specific escalation timing, and opened/escalated/resolved notification routing in one validated contract. Use validateVulnerabilityAlertConfiguration at persistence boundaries and resolveVulnerabilityAlertAudiences when queuing deliveries. Owner routes fall back to administrators when an alert has no owning asset.

import { createMemoryFeedStore, syncFeed } from "@absolutejs/vulnerabilities";

const result = await syncFeed({
  adapter,
  maxStaleMs: 24 * 60 * 60 * 1_000,
  store: createMemoryFeedStore(),
});

if (result.status === "stale") {
  // Cached intelligence remains available, with the provider error attached.
}

An adapter can replace a complete provider snapshot or incrementally merge records and deletions. not_modified responses require an existing cached snapshot, and provider failures never erase the last successful snapshot.

Production stores remain replaceable through the FeedSnapshotStore, FeedSyncRunStore, and ManagedFindingStore contracts. Recorded refreshes persist status, errors, revisions, timestamps, and record counts without coupling feed orchestration to a database driver.

Deployment admission can retain a signed OSV and CISA KEV snapshot instead of calling upstream providers on the activation path. Exact package/version coverage is part of the signed payload, including queries that returned no advisories, so missing intelligence cannot be interpreted as a clean result.

import {
  admissionIntelligenceCoverageKey,
  signAdmissionIntelligenceSnapshot,
} from "@absolutejs/vulnerabilities/intelligence-snapshot";

const attestation = signAdmissionIntelligenceSnapshot({
  coverage: components.map(({ identity }) =>
    admissionIntelligenceCoverageKey(identity),
  ),
  issuedAt: new Date().toISOString(),
  kev: kevSnapshot,
  keyId: "vulnerability-intelligence-v1",
  maxAgeMs: 24 * 60 * 60 * 1_000,
  osv: osvSnapshot,
  secret: signingSecret,
});

Client evidence can be wrapped in an Ed25519 bundle that binds the runtime SBOM, signed intelligence snapshot, admission decision, and the exact VEX exceptions used. Verification requires only the public key. Cross-signed key transitions preserve trust when an operator rotates the signing identity.

import {
  createEvidenceSigningIdentity,
  evidenceVerificationKeyFrom,
  signVulnerabilityEvidenceBundle,
  verifyVulnerabilityEvidenceBundle,
} from "@absolutejs/vulnerabilities/evidence-bundle";

const identity = createEvidenceSigningIdentity();
const bundle = signVulnerabilityEvidenceBundle({ identity, payload });
const verification = verifyVulnerabilityEvidenceBundle({
  bundle,
  trustedKeys: [evidenceVerificationKeyFrom(identity)],
});

Private keys remain an application secret. Published trust anchors contain only the key ID, fingerprint, creation time, algorithm, and DER public key.

Key creation, rotation, and revocation can also be recorded in a signed, hash-chained transparency log. A client pins the genesis key fingerprint, the latest log head, or both through a trusted out-of-band channel. This detects rewritten or truncated history and rejects bundles signed by revoked keys.

absolute-vulnerability-evidence verify \
  --bundle vulnerability-evidence.json \
  --registry vulnerability-evidence-registry.json \
  --trusted-fingerprint <genesis-sha256-fingerprint> \
  --trusted-head <sha256-log-head> \
  --trusted-witness-fingerprint <witness-sha256-fingerprint>

The command exits 0 only for trusted evidence, 1 for cryptographically valid but untrusted or revoked evidence, and 2 for invalid input or usage. When a registry includes a receipt from an independent witness, the optional witness fingerprint requires that receipt to match the exact log head and size. Applications that use multiple independent witnesses can call verifyEvidenceWitnessQuorum; duplicate receipts from one identity never count more than once toward the required quorum.

版本与发布记录

@absolutejs/vulnerabilities 共发布 31 个版本,首次发布于 2026/07/19;过去 12 个月发布了 31 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.15.2latest2026/10/2316 天前
0.15.12026/10/081 个月前
0.15.02026/08/172 个月前
0.14.12026/07/253 个月前
0.14.02026/07/203 个月前
0.13.02026/07/203 个月前

关于 @absolutejs/vulnerabilities 的常见问题

@absolutejs/vulnerabilities 是什么?

Scanner-neutral vulnerability normalization, policy gates, host inventory, and audit-ready evidence for AbsoluteJS applications.

如何安装 @absolutejs/vulnerabilities?

在项目目录运行 npm install @absolutejs/vulnerabilities,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 absolute-vulnerability-evidence,可以用 npx absolute-vulnerability-evidence 直接运行。

@absolutejs/vulnerabilities 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@absolutejs/vulnerabilities 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@absolutejs/vulnerabilities 可以商用吗?

@absolutejs/vulnerabilities 使用 BSL-1.1 许可。声明的许可为 BSL-1.1,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@absolutejs/vulnerabilities 的下载量有多少?

根据 npm 官方下载统计,@absolutejs/vulnerabilities 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,907 次,日均约 64 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@absolutejs/vulnerabilities 还在维护吗?

最新版本 0.15.2 发布于 2026/10/23(16 天前);至今共发布 31 个版本,其中过去 12 个月发布了 31 个;首次发布于 2026/07/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。