izm1chael commited on
Commit
9552f9c
·
verified ·
1 Parent(s): e70805f

Publish Layerfault synthetic corpus LF-CORPUS-PY-0001

Browse files
LAYERFAULT_CORPUS.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "candidate_rules": [],
3
+ "corpus_id": "LF-CORPUS-PY-0001",
4
+ "description": "HF-style custom loader containing harmless process, native-load, loopback-network, credential, filesystem, dynamic-code, package-manager and NumPy allow_pickle call sites.",
5
+ "expected_rules": [
6
+ "LF-CODE-AUTO-MAP",
7
+ "LF-CODE-SUBPROCESS",
8
+ "LF-PY-CALL-PROCESS",
9
+ "LF-CORR-HF-LOADER-PROCESS",
10
+ "LF-CODE-CTYPES",
11
+ "LF-PY-NATIVE-LOAD",
12
+ "LF-CORR-HF-LOADER-NATIVE-LOAD",
13
+ "LF-CODE-NETWORK",
14
+ "LF-PY-CALL-NETWORK",
15
+ "LF-CORR-HF-LOADER-NETWORK",
16
+ "LF-PY-CREDENTIAL-ACCESS",
17
+ "LF-CORR-HF-LOADER-CREDENTIALS",
18
+ "LF-PY-FILESYSTEM-MUTATION",
19
+ "LF-CORR-HF-LOADER-FILESYSTEM",
20
+ "LF-CODE-EVAL",
21
+ "LF-PY-CALL-DYNAMIC-CODE",
22
+ "LF-CORR-HF-LOADER-DYNAMIC-CODE",
23
+ "LF-PY-PACKAGE-INSTALL",
24
+ "LF-CORR-HF-LOADER-INSTALL",
25
+ "LF-PY-NUMPY-ALLOW-PICKLE",
26
+ "LF-CORR-NUMPY-ALLOW-PICKLE"
27
+ ],
28
+ "generator": "packages.python_capability_chain",
29
+ "ground_truth": "synthetic-generated",
30
+ "must_not_rules": [],
31
+ "repo_name": "python-custom-loader-capability-chain",
32
+ "repo_type": "model",
33
+ "safety": "inert/canary-only",
34
+ "schema": 1,
35
+ "validation": {
36
+ "kind": "verify-package",
37
+ "target": "."
38
+ }
39
+ }
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - layerfault
5
+ - security-research
6
+ - model-security
7
+ - synthetic
8
+ - adversarial-testing
9
+ extra_gated_prompt: >-
10
+ This repository is a synthetic security-test artifact from the Layerfault
11
+ corpus. It intentionally contains adversarial characteristics (e.g.
12
+ suspicious pickle opcodes, executable-format smuggling, prompt-injection
13
+ strings) designed to exercise security scanner detection rules. It is
14
+ **not** a usable ML model and must never be loaded or executed outside an
15
+ isolated scanner-testing environment. By accepting, you confirm you
16
+ understand this repository is a test fixture, not production model
17
+ weights.
18
+ extra_gated_button_content: I understand this is a security test fixture and accept the risk
19
+ gated: auto
20
+ ---
21
+
22
+ # python-custom-loader-capability-chain
23
+
24
+ > **SECURITY TEST ARTIFACT — DO NOT USE AS A PRODUCTION MODEL**
25
+
26
+ This repository is part of the Layerfault synthetic security corpus.
27
+ It is deliberately constructed to contain security-relevant characteristics for scanner testing.
28
+
29
+ **Corpus ID:** `LF-CORPUS-PY-0001`
30
+
31
+ ## Purpose
32
+
33
+ HF-style custom loader containing harmless process, native-load, loopback-network, credential, filesystem, dynamic-code, package-manager and NumPy allow_pickle call sites.
34
+
35
+ ## Direct expected Layerfault rules
36
+
37
+ - `LF-CODE-AUTO-MAP`
38
+ - `LF-CODE-SUBPROCESS`
39
+ - `LF-PY-CALL-PROCESS`
40
+ - `LF-CORR-HF-LOADER-PROCESS`
41
+ - `LF-CODE-CTYPES`
42
+ - `LF-PY-NATIVE-LOAD`
43
+ - `LF-CORR-HF-LOADER-NATIVE-LOAD`
44
+ - `LF-CODE-NETWORK`
45
+ - `LF-PY-CALL-NETWORK`
46
+ - `LF-CORR-HF-LOADER-NETWORK`
47
+ - `LF-PY-CREDENTIAL-ACCESS`
48
+ - `LF-CORR-HF-LOADER-CREDENTIALS`
49
+ - `LF-PY-FILESYSTEM-MUTATION`
50
+ - `LF-CORR-HF-LOADER-FILESYSTEM`
51
+ - `LF-CODE-EVAL`
52
+ - `LF-PY-CALL-DYNAMIC-CODE`
53
+ - `LF-CORR-HF-LOADER-DYNAMIC-CODE`
54
+ - `LF-PY-PACKAGE-INSTALL`
55
+ - `LF-CORR-HF-LOADER-INSTALL`
56
+ - `LF-PY-NUMPY-ALLOW-PICKLE`
57
+ - `LF-CORR-NUMPY-ALLOW-PICKLE`
58
+
59
+ ## Candidate rules
60
+
61
+ These are deliberately plausible targets that remain marked as candidates until the exact
62
+ Layerfault build used for certification confirms them.
63
+
64
+ - None
65
+
66
+ ## Negative-control rules
67
+
68
+ These should remain silent for this corpus item.
69
+
70
+ - None
71
+
72
+ ## Safety
73
+
74
+ The corpus uses fake secrets, loopback/`.invalid` network destinations, harmless marker output,
75
+ and synthetic model behavior only. It is intended for static scanning and isolated security testing.
SHA256SUMS.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "path": "LAYERFAULT_CORPUS.json",
4
+ "sha256": "41577c4a141aad1344fdb2fb9afc177e15e652e6ce9cc8d83fd1a2687375e27f",
5
+ "size": 1226
6
+ },
7
+ {
8
+ "path": "README.md",
9
+ "sha256": "c72ca9fd42263eb1c8a25364ee92f218283b12efef5c7325197b89056839ad83",
10
+ "size": 2333
11
+ },
12
+ {
13
+ "path": "canary.npy",
14
+ "sha256": "0398209604f3b7330658ab31021254f5e931e0680b450547a1513414acb1a4d3",
15
+ "size": 140
16
+ },
17
+ {
18
+ "path": "config.json",
19
+ "sha256": "6066bb9115444d01d760f2901486df17c3b598f90fea1e65be05454bbb2ce950",
20
+ "size": 134
21
+ },
22
+ {
23
+ "path": "model.safetensors",
24
+ "sha256": "d2ca18b298651a52fc6fc6d7cf90df5a4b05586832277686f5681ee524af58b0",
25
+ "size": 856
26
+ },
27
+ {
28
+ "path": "modeling_security.py",
29
+ "sha256": "5a13f287db0e01aeaf75991bf3e7ff0552a4789e7f0c700312bdc044349c84b1",
30
+ "size": 962
31
+ }
32
+ ]
canary.npy ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0398209604f3b7330658ab31021254f5e931e0680b450547a1513414acb1a4d3
3
+ size 140
config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "auto_map": {
3
+ "AutoModel": "modeling_security.LayerfaultSecurityFixture"
4
+ },
5
+ "model_type": "layerfault_security_fixture"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2ca18b298651a52fc6fc6d7cf90df5a4b05586832277686f5681ee524af58b0
3
+ size 856
modeling_security.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+ import ctypes, os, pathlib, socket, subprocess, sys, tempfile
3
+ import numpy as np
4
+
5
+ class LayerfaultSecurityFixture:
6
+ @classmethod
7
+ def from_pretrained(cls, *args, **kwargs):
8
+ subprocess.run(["/bin/echo", "LAYERFAULT_CANARY"], check=False)
9
+ ctypes.CDLL(None)
10
+ os.environ.get("LAYERFAULT_SYNTHETIC_API_KEY")
11
+ canary_path = pathlib.Path(tempfile.gettempdir(), "layerfault-corpus-canary")
12
+ canary_path.write_text("canary")
13
+ try:
14
+ socket.create_connection(("127.0.0.1", 9), timeout=0.01)
15
+ except OSError:
16
+ pass
17
+ eval("1 + 1", {"__builtins__": {}}, {})
18
+ subprocess.run([sys.executable, "-m", "pip", "--version"], check=False)
19
+ subprocess.run(["pip", "install", "layerfault-synthetic-canary"], check=False)
20
+ try:
21
+ np.load("canary.npy", allow_pickle=True)
22
+ except Exception:
23
+ pass
24
+ return cls()