Explorar o código

fix(tests): keep adversarial PEM out of packager source scan

Load the fixture private-key marker from the basename-excluded payload
file so review-compact packaging does not trip content secret scan.

Co-authored-by: Cursor <cursoragent@cursor.com>
root hai 3 meses
pai
achega
2bbe4375d1
Modificáronse 1 ficheiros con 11 adicións e 2 borrados
  1. 11 2
      tests/unit/package_review_compact_contract.py

+ 11 - 2
tests/unit/package_review_compact_contract.py

@@ -187,9 +187,18 @@ def assert_no_full_git_bundle(members: list[str], *, testcase) -> None:
     )
 
 
+def _adversarial_private_key_bytes() -> bytes:
+    """Load PEM-like fixture bytes without embedding secret markers in this module.
+
+    The payload file basename ``id_ed25519`` is path-excluded from packaging; keeping
+    the PEM text out of this helper avoids content-scan false positives on the helper.
+    """
+    path = ROOT / "tests" / "fixtures" / "package_adversarial" / "payloads" / "id_ed25519"
+    return path.read_bytes()
+
+
 def adversarial_fixture_relatives() -> dict[str, bytes]:
     """Canonical sneaky paths planted into disposable source trees."""
-    private_key = b"-----BEGIN PRIVATE KEY-----\nADVERSARIAL_FIXTURE_NOT_A_REAL_KEY\n-----END PRIVATE KEY-----\n"
     return {
         "reference/original/board/sneaky-main.brd": b"%ADV-BRD-FIXTURE%\n",
         "reference/original/schematics/sneaky-schematic.pdf": b"%PDF-1.4 ADV-FIXTURE\n",
@@ -204,7 +213,7 @@ def adversarial_fixture_relatives() -> dict[str, bytes]:
         "anlogic_cd/installer/setup.exe": b"MZADV-INSTALLER",
         "reference/original/local_archives/Anlogic.lic": b"ADV-LICENSE-KEY\n",
         "config/.env": b"SECRET=should-never-pack\n",
-        "secrets/id_ed25519": private_key,
+        "secrets/id_ed25519": _adversarial_private_key_bytes(),
         "node_modules/left-pad/index.js": b"module.exports=function(){}\n",
         ".venv/bin/python": b"#!/adversarial-venv\n",
         "venv/lib/site.py": b"# adversarial venv\n",