Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions backend/tests/test_frontend_nanoid_security.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Fail closed when the frontend lock resolves the vulnerable Nano ID release."""

from __future__ import annotations

from pathlib import Path

import yaml

REPO_ROOT = Path(__file__).resolve().parents[2]
FRONTEND_LOCK = REPO_ROOT / "frontend" / "pnpm-lock.yaml"
PATCHED_NANOID_VERSION = "3.3.17"


def test_frontend_lock_resolves_only_patched_nanoid_3x() -> None:
"""Require PostCSS's Nano ID dependency to resolve to the reviewed patched 3.x release."""
lock = yaml.safe_load(FRONTEND_LOCK.read_text(encoding="utf-8"))

for section_name in ("packages", "snapshots"):
section = lock[section_name]
nanoid_3x = sorted(
package_key
for package_key in section
if package_key.startswith("nanoid@3.")
)
assert nanoid_3x == [f"nanoid@{PATCHED_NANOID_VERSION}"]

postcss_snapshot = lock["snapshots"]["postcss@8.5.24"]
assert postcss_snapshot["dependencies"]["nanoid"] == PATCHED_NANOID_VERSION
8 changes: 4 additions & 4 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading