Match a lockfile against security advisories.
lock: {package: version}. Package names compare after PEP 503 normalisation: lowercase, and runs of
-, _, . become a single -.advisories: [{"id", "package", "affected", "fixed", "severity"}] where affected is comma-separated
clauses >=X, >X, <=X, <X, ==X (all must hold) and severity is critical, high, medium or low.1.4 == 1.4.0).Return one finding per (package, advisory) that applies: {"package": normalised name, "version", "advisory", "severity", "fixed"}, sorted by severity (critical first), then package, then advisory id.
Implement audit. Input: lock: dict, advisories: list[dict]. Returns: list[dict].
def audit(lock: dict, advisories: list[dict]) -> list[dict]:
return [{"package": a["package"], "version": lock[a["package"]], "advisory": a["id"], "severity": a["severity"], "fixed": a["fixed"]}
for a in advisories if a["package"] in lock]
Run executes the public tests. Submit grades against public and hidden tests.
Match a lockfile against security advisories.
lock: {package: version}. Package names compare after PEP 503 normalisation: lowercase, and runs of
-, _, . become a single -.advisories: [{"id", "package", "affected", "fixed", "severity"}] where affected is comma-separated
clauses >=X, >X, <=X, <X, ==X (all must hold) and severity is critical, high, medium or low.1.4 == 1.4.0).Return one finding per (package, advisory) that applies: {"package": normalised name, "version", "advisory", "severity", "fixed"}, sorted by severity (critical first), then package, then advisory id.
Implement audit. Input: lock: dict, advisories: list[dict]. Returns: list[dict].
def audit(lock: dict, advisories: list[dict]) -> list[dict]:
return [{"package": a["package"], "version": lock[a["package"]], "advisory": a["id"], "severity": a["severity"], "fixed": a["fixed"]}
for a in advisories if a["package"] in lock]
Run executes the public tests. Submit grades against public and hidden tests.