josh-hud commited on
Commit
8d1b820
·
verified ·
1 Parent(s): dce9264

v2: charset-recalibrated 42 GB build, replace data/, update docs/notebook

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. DATA_DICTIONARY.md +11 -7
  2. README.md +13 -5
  3. data/part-00004.parquet +0 -3
  4. data/part-00005.parquet +0 -3
  5. data/part-00006.parquet +0 -3
  6. data/part-00007.parquet +0 -3
  7. data/part-00008.parquet +0 -3
  8. data/part-00009.parquet +0 -3
  9. data/part-00010.parquet +0 -3
  10. data/part-00011.parquet +0 -3
  11. data/part-00012.parquet +0 -3
  12. data/part-00013.parquet +0 -3
  13. data/part-00014.parquet +0 -3
  14. data/part-00015.parquet +0 -3
  15. data/part-00016.parquet +0 -3
  16. data/part-00017.parquet +0 -3
  17. data/part-00018.parquet +0 -3
  18. data/part-00019.parquet +0 -3
  19. data/part-00020.parquet +0 -3
  20. data/part-00021.parquet +0 -3
  21. data/part-00022.parquet +0 -3
  22. data/part-00023.parquet +0 -3
  23. data/{part-00000.parquet → train-00000-00002.parquet} +2 -2
  24. data/{part-00001.parquet → train-00003-00005.parquet} +2 -2
  25. data/{part-00002.parquet → train-00006-00008.parquet} +2 -2
  26. data/{part-00003.parquet → train-00009-00011.parquet} +2 -2
  27. data/train-00012-00014.parquet +3 -0
  28. data/train-00015-00017.parquet +3 -0
  29. data/train-00018-00020.parquet +3 -0
  30. data/train-00021-00023.parquet +3 -0
  31. data/train-00024-00026.parquet +3 -0
  32. data/train-00027-00029.parquet +3 -0
  33. data/train-00030-00032.parquet +3 -0
  34. data/train-00033-00035.parquet +3 -0
  35. data/train-00036-00038.parquet +3 -0
  36. data/train-00039-00041.parquet +3 -0
  37. data/train-00042-00044.parquet +3 -0
  38. data/train-00045-00047.parquet +3 -0
  39. data/train-00048-00050.parquet +3 -0
  40. data/train-00051-00053.parquet +3 -0
  41. data/train-00054-00056.parquet +3 -0
  42. data/train-00057-00059.parquet +3 -0
  43. data/train-00060-00062.parquet +3 -0
  44. data/train-00063-00065.parquet +3 -0
  45. data/train-00066-00068.parquet +3 -0
  46. data/train-00069-00069.parquet +3 -0
  47. generate_dataset.py +78 -9
  48. notebooks/eda.ipynb +0 -0
  49. notebooks/make_stats_summary.py +16 -0
  50. notebooks/stats_summary.json +573 -196
DATA_DICTIONARY.md CHANGED
@@ -1,6 +1,6 @@
1
  # code-pii POC dataset: data dictionary
2
 
3
- Span-labeled source code for training detectors of **code-related sensitive data** (passwords, API keys, tokens, private keys, emails). Not classic PII (no names/addresses/SSNs). Proof of concept; everything is generated by `generate_dataset.py` and reproducible with `--seed`.
4
 
5
  ## 1. How the dataset is built
6
 
@@ -10,13 +10,13 @@ Span-labeled source code for training detectors of **code-related sensitive data
10
 
11
  **Injection.** For each kept file a coin with `--inject-frac` (0.75) decides whether anything is injected; 85% of those receive 1-5 secrets (count sampled from CredData's secrets-per-file histogram with the "10+" bucket damped) and 0-3 hard negatives. The rest (~36% of records end up with zero secret spans) are pure negatives. For each secret: a label is drawn from the CredData label distribution (plus a fixed 12% share for `email`, which CredData does not annotate); a syntactic context is drawn from CredData's per-label context distribution; a variable name from the per-label vocabulary; a value from the generators below. A language table (31 languages + generic fallback) renders the construct in the file's syntax: assignments (`const x = "..."`, `String x = "..."`, `#define X "..."`, `ENV X=...`, `set(X "...")`...), dictionary/object keys, `.env`/shell exports, comments with the language's comment leader, URL credentials (`postgres://user:PASS@host/db`, span = password only), `Authorization: Bearer/Basic` headers in the language's HTTP idiom, and PEM blocks as heredocs/template literals/concatenated string literals. The rendered line is inserted at a uniformly random line boundary, indented like the following line. Offsets are computed during assembly and asserted (`text[start:end] == value`) for every span before writing.
12
 
13
- **Value generators.** `api_key`: AWS access key id (`AKIA`+16), AWS secret (40 base64), Google (`AIza`+35), Stripe (`sk_live_`/`sk_test_`/`rk_live_`+24), SendGrid, Twilio, Mailgun, OpenAI, Anthropic, Azure client secret, and generic hex (32-64), base64 (24-64 raw bytes) and alphanumeric keys (weighted toward generic, as in CredData). `token`: GitHub classic (`ghp_/gho_/ghs_`+36) and fine-grained PATs, Slack tokens and webhooks, JWTs (real base64url header.payload.signature), GitLab, npm, Discord, DigitalOcean, Hugging Face, opaque bearer tokens, Basic-auth base64 of `user:password`. `password`: Faker passwords, word+digits+symbol patterns, short lowercase alphanumerics (length distribution follows CredData: median 9, p90 21). `private_key`: PEM blocks (RSA/EC/DSA/OPENSSH/PKCS8 headers, 64-char base64 lines, realistic lengths). `email`: Faker free/company/domain emails, never `example.*`.
14
 
15
  **Hard negatives** (label `not_secret`): placeholders (`CHANGEME`, `<YOUR_API_KEY>`, AWS's documented `AKIAIOSFODNN7EXAMPLE`, `ghp_xxx...`, `********`), `example.com`/`test.com`/`localhost` emails, UUIDs, MD5/SHA-1/SHA-256 hex digests, environment-variable references (`os.environ["API_KEY"]`, `${{ secrets.TOKEN }}`...), public keys (PEM `PUBLIC KEY`, `ssh-rsa ...`), base64 of plain text, and version/IP/path/package identifiers. Negatives are rendered with the same constructs but with names that fit the value (`checksum`, `commit`, `request_id`, `public_key`, `version`, ...), except placeholders, example emails and env references, which deliberately use secret-like names (`password = "<YOUR_API_KEY>"`).
16
 
17
  **Validation.** `validate.py` re-checks offsets on every span (0 failures on 151k records), tabulates labels/value types/contexts/languages, runs a gitleaks-style regex scanner for 15 value types (100% of injected spans of those types are found exactly at the labeled offsets, i.e. quoting/escaping/indentation did not mangle them), and prints 20 random records for eyeballing.
18
 
19
- **Known limitations and biases.** (1) Injected lines are syntactically plausible but semantically disconnected from the surrounding file (a Java constant may land inside a method body, a PEM block inside HTML); a model can learn "line that does not fit" as a cue. (2) Placement is at random line boundaries, not where a human would put config; CredData priors drive *what* and *in which construct*, not *where in the file*. (3) The base corpus is "clean-ish": github-code-clean removed auto-generated files and near-duplicates but was never scrubbed for secrets or PII, so unlabeled real emails, keys or tokens exist in the base text and are implicitly negatives (label noise; eval on `eval_creddata.jsonl` instead of on synthetic splits). (4) Variable-name vocabulary inherits CredData quirks (e.g. `sharedsecret`, `nonce`, `salt` are frequent because a few repos dominate). (5) `generic_hex_key` positives and hash negatives are the same character class; they are disambiguated only by the variable name, which is intentional but means a 40-hex value is not labelable in isolation. (6) Scope is secrets + emails only; names, addresses, phone numbers, SSNs are neither injected nor labeled. (7) Language mix mirrors github-code-clean (Java/JS/HTML/PHP/C heavy; little YAML/JSON/.env, which are where CredData sees most real secrets). (8) CredData values in the eval set are obfuscated by CredData's pipeline (format-preserving), not the originals. (9) Value charsets are not yet calibrated: synthetic `api_key` values are ~25% plain hex versus 70% in CredData, and synthetic passwords are rarely pure-lowercase words versus 49% in CredData (see `notebooks/eda.ipynb`, section 6).
20
 
21
  ## 2. Record schema (`data/*.parquet`, `sample.jsonl`)
22
 
@@ -92,6 +92,9 @@ Example record (abridged `text`):
92
  | api_key | anthropic_api_key | `sk-ant-api03-<93>AA` | `sk-ant-api03-...AA` | same |
93
  | api_key | azure_client_secret | 40 chars `[A-Za-z0-9~._-]` | `YJYGkd2XGEbq0xHBUYUN9wY7-ts1F1dO0raZXm1s` | same |
94
  | api_key | generic_hex_key | 32/40/48/64 lowercase hex | `b4a9fa3ca185cc40da7c9edce315ac17f112fbd4` | CredData "Key"/"Secret"/"Salt"/"Nonce" (hex is the dominant charset: 70%) |
 
 
 
95
  | api_key | generic_base64_secret | base64 of 24-64 bytes | `r/Y+kPmu4sQFtSoBF4iSX7XKFgdpVk4QiiAx2H5Lwk8=` | same |
96
  | api_key | generic_alnum_key | 20-40 alphanumerics | `PU5lRtqn363qL3CA2bH1jYRJ` | same |
97
  | token | github_pat | `gh[pos]_[A-Za-z0-9]{36}` | `ghp_Ig187tXPStYwqtbfh7hArK9jNHCrkejKHHRL` | CredData "Token"/"Bearer Authorization" (auth header 37%, json 24%) |
@@ -101,8 +104,9 @@ Example record (abridged `text`):
101
  | token | jwt | `eyJ..\.eyJ..\.<sig>` | `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOi...` | same |
102
  | token | gitlab_pat / npm_token / hf_token / digitalocean_pat / discord_bot_token | `glpat-<20>`, `npm_<36>`, `hf_<34>`, `dop_v1_<64hex>`, `<24>.<6>.<27>` | `hf_Lk...` | same |
103
  | token | bearer_token_opaque | 32-64 base64url | `YJYGkd2XGEbq0xHBUYUN9wY7...` | same |
 
104
  | token | basic_auth_b64 | base64(`user:password`) | `ZGVwbG95OkhkNyFrcTJ6` | CredData "Basic Authorization" |
105
- | password | password | 5-20 chars, Faker/word-based | `dbComputer@1601`, `pecn95` | CredData "Password"/"URL Credentials" (assignment 33%, yaml 22%, comment 11%, url 8%) |
106
  | private_key | pem_private_key | `-----BEGIN (RSA\|EC\|DSA\|OPENSSH\|) PRIVATE KEY-----` + base64 lines | see example in `sample.jsonl` | CredData "PEM Private Key" (89% standalone block) |
107
  | email | email | RFC-ish `local@domain.tld`, never example.* | `stacie16@gardner.com` | not in CredData; fixed mix: assignment 40%, comment 35%, json/yaml 20% |
108
  | not_secret | placeholder | known dummy values | `AKIAIOSFODNN7EXAMPLE`, `<YOUR_API_KEY>` | secret-like names |
@@ -114,14 +118,14 @@ Example record (abridged `text`):
114
  | not_secret | base64_non_secret | base64 of an English sentence | `QXVkaWVuY2UgYXJndWUg...` | payload/body names |
115
  | not_secret | version_or_id | IPv4, semver, package id, path, numeric id | `v7.20.44`, `151.134.43.138` | version/host names |
116
 
117
- Label counts for this release (24 shards, 1,810,060 records): api_key 1.01M, password 482k, token 364k, email 249k, private_key 216k secret spans; 1.70M hard negatives split evenly over 11 types. See `stats.md`.
118
 
119
  ## 4. Files
120
 
121
  | file | what | size / count |
122
  |---|---|---|
123
- | `data/part-000NN.parquet` | generated records, one Parquet file per base-corpus shard, zstd; ~75k records / ~600 MB JSONL / ~160 MB Parquet each | 24 files, shards 0-23: 1,810,060 records, 14.4 GB JSONL, 3.84 GB Parquet |
124
- | `sample.jsonl` | 500 records reservoir-sampled from shards 0-1, same schema | 500 |
125
  | `eval_creddata.jsonl` | real CredData lines (+-3 lines context), **not synthetic**; use only for evaluation / threshold tuning, never for training if you want an honest number. `T` rows = positives, `F` rows = hard negatives, `X` rows = ignore. Offsets are code-point based like the synthetic data | 67,896 rows; 15,753 T / 48,061 F / 4,082 X; ~90 MB |
126
  | `priors.json` | CredData-derived statistics that drive the generator | 12 KB |
127
  | `stats.md` | counts by label/value_type/context/language, size histogram, throughput | |
 
1
  # code-pii POC dataset: data dictionary
2
 
3
+ Version 2 (charset-recalibrated, 40 GB). Span-labeled source code for training detectors of **code-related sensitive data** (passwords, API keys, tokens, private keys, emails). Not classic PII (no names/addresses/SSNs). Proof of concept; everything is generated by `generate_dataset.py` and reproducible with `--seed`.
4
 
5
  ## 1. How the dataset is built
6
 
 
10
 
11
  **Injection.** For each kept file a coin with `--inject-frac` (0.75) decides whether anything is injected; 85% of those receive 1-5 secrets (count sampled from CredData's secrets-per-file histogram with the "10+" bucket damped) and 0-3 hard negatives. The rest (~36% of records end up with zero secret spans) are pure negatives. For each secret: a label is drawn from the CredData label distribution (plus a fixed 12% share for `email`, which CredData does not annotate); a syntactic context is drawn from CredData's per-label context distribution; a variable name from the per-label vocabulary; a value from the generators below. A language table (31 languages + generic fallback) renders the construct in the file's syntax: assignments (`const x = "..."`, `String x = "..."`, `#define X "..."`, `ENV X=...`, `set(X "...")`...), dictionary/object keys, `.env`/shell exports, comments with the language's comment leader, URL credentials (`postgres://user:PASS@host/db`, span = password only), `Authorization: Bearer/Basic` headers in the language's HTTP idiom, and PEM blocks as heredocs/template literals/concatenated string literals. The rendered line is inserted at a uniformly random line boundary, indented like the following line. Offsets are computed during assembly and asserted (`text[start:end] == value`) for every span before writing.
12
 
13
+ **Value generators (v2, charset-calibrated).** Values are drawn in two steps: first a target *charset class* (which of lower/upper/digit/symbol occur in the value) is sampled from CredData's per-label charset distribution (`priors.json: charset_by_label`), then a generator is chosen proportionally to its base weight times the empirically profiled probability that it produces that class, and rejection-sampled (<=12 tries) until the value matches. This makes the synthetic charset mix track CredData within ~2 points per class (v1 had 25% plain-hex api keys vs 70% real, and <1% pure-lowercase passwords vs 49% real). `api_key`: AWS access key id (`AKIA`+16), AWS secret (40 base64), Google (`AIza`+35), Stripe (`sk_live_`/`sk_test_`/`rk_live_`+24), SendGrid, Twilio, Mailgun, OpenAI, Anthropic, Azure client secret, and generic hex (32-64, lower or upper case), base64 (24-64 raw bytes), alphanumeric, lowercase-only, uppercase/digit, digit-only and dashed-hex keys. Vendor-prefixed formats end up at ~14% of api keys and ~35% of tokens (CredData's own vendor-specific categories are <10% of its true positives; the synthetic share is kept a little higher on purpose so each format is seen tens of thousands of times). `token`: GitHub classic (`ghp_/gho_/ghs_`+36) and fine-grained PATs, Slack tokens and webhooks, JWTs (real base64url header.payload.signature), GitLab, npm, Discord, DigitalOcean, Hugging Face, opaque bearer tokens, Basic-auth base64 of `user:password`, plus generic hex, alphanumeric, dashed-lowercase and uppercase tokens. `password`: lowercase dictionary words and word pairs (the largest real class), word+digits, word+symbol, Faker strong passwords, capitalised word+digits, digit-only (length distribution follows CredData: median 9, p90 21). `private_key`: PEM blocks (RSA/EC/DSA/OPENSSH/PKCS8 headers, 64-char base64 lines, realistic lengths). `email`: Faker free/company/domain emails, never `example.*`.
14
 
15
  **Hard negatives** (label `not_secret`): placeholders (`CHANGEME`, `<YOUR_API_KEY>`, AWS's documented `AKIAIOSFODNN7EXAMPLE`, `ghp_xxx...`, `********`), `example.com`/`test.com`/`localhost` emails, UUIDs, MD5/SHA-1/SHA-256 hex digests, environment-variable references (`os.environ["API_KEY"]`, `${{ secrets.TOKEN }}`...), public keys (PEM `PUBLIC KEY`, `ssh-rsa ...`), base64 of plain text, and version/IP/path/package identifiers. Negatives are rendered with the same constructs but with names that fit the value (`checksum`, `commit`, `request_id`, `public_key`, `version`, ...), except placeholders, example emails and env references, which deliberately use secret-like names (`password = "<YOUR_API_KEY>"`).
16
 
17
  **Validation.** `validate.py` re-checks offsets on every span (0 failures on 151k records), tabulates labels/value types/contexts/languages, runs a gitleaks-style regex scanner for 15 value types (100% of injected spans of those types are found exactly at the labeled offsets, i.e. quoting/escaping/indentation did not mangle them), and prints 20 random records for eyeballing.
18
 
19
+ **Known limitations and biases.** (1) Injected lines are syntactically plausible but semantically disconnected from the surrounding file (a Java constant may land inside a method body, a PEM block inside HTML); a model can learn "line that does not fit" as a cue. (2) Placement is at random line boundaries, not where a human would put config; CredData priors drive *what* and *in which construct*, not *where in the file*. (3) The base corpus is "clean-ish": github-code-clean removed auto-generated files and near-duplicates but was never scrubbed for secrets or PII, so unlabeled real emails, keys or tokens exist in the base text and are implicitly negatives (label noise; eval on `eval_creddata.jsonl` instead of on synthetic splits). (4) Variable-name vocabulary inherits CredData quirks (e.g. `sharedsecret`, `nonce`, `salt` are frequent because a few repos dominate). (5) `generic_hex_key` positives and hash negatives are the same character class; they are disambiguated only by the variable name, which is intentional but means a 40-hex value is not labelable in isolation. (6) Scope is secrets + emails only; names, addresses, phone numbers, SSNs are neither injected nor labeled. (7) Language mix mirrors github-code-clean (Java/JS/HTML/PHP/C heavy; little YAML/JSON/.env, which are where CredData sees most real secrets). (8) CredData values in the eval set are obfuscated by CredData's pipeline (format-preserving), not the originals. (9) Charset calibration (v2) matches CredData's per-label charset classes to within ~2 points but not its exact lengths per class or its vendor mix; classes CredData reaches with <1% mass (`upper`-only keys, `digit+symbol`) are not generated.
20
 
21
  ## 2. Record schema (`data/*.parquet`, `sample.jsonl`)
22
 
 
92
  | api_key | anthropic_api_key | `sk-ant-api03-<93>AA` | `sk-ant-api03-...AA` | same |
93
  | api_key | azure_client_secret | 40 chars `[A-Za-z0-9~._-]` | `YJYGkd2XGEbq0xHBUYUN9wY7-ts1F1dO0raZXm1s` | same |
94
  | api_key | generic_hex_key | 32/40/48/64 lowercase hex | `b4a9fa3ca185cc40da7c9edce315ac17f112fbd4` | CredData "Key"/"Secret"/"Salt"/"Nonce" (hex is the dominant charset: 70%) |
95
+ | api_key | generic_hex_key_upper | 32/40/64 uppercase hex | `0A4396E2885F2D6F9965B81B44051234` | CredData `digit+upper` class (8%) |
96
+ | api_key | generic_lower_key / generic_upper_key / generic_digit_key | 16-32 lowercase letters / uppercase+digits / digits | `qzkmwvbtxaplrfhsncyd`, `7KQ2M9XWBP4RZ1TY6LC3`, `4981234509871234` | CredData `lower` (3%), `digit+upper`, `digit` classes |
97
+ | api_key | generic_hex_dashed_key | 3-5 groups of 8 hex joined by `-` | `3fa85f64-5717b4d2-9c1e8a7f` | CredData `digit+lower+symbol` class (2%) |
98
  | api_key | generic_base64_secret | base64 of 24-64 bytes | `r/Y+kPmu4sQFtSoBF4iSX7XKFgdpVk4QiiAx2H5Lwk8=` | same |
99
  | api_key | generic_alnum_key | 20-40 alphanumerics | `PU5lRtqn363qL3CA2bH1jYRJ` | same |
100
  | token | github_pat | `gh[pos]_[A-Za-z0-9]{36}` | `ghp_Ig187tXPStYwqtbfh7hArK9jNHCrkejKHHRL` | CredData "Token"/"Bearer Authorization" (auth header 37%, json 24%) |
 
104
  | token | jwt | `eyJ..\.eyJ..\.<sig>` | `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOi...` | same |
105
  | token | gitlab_pat / npm_token / hf_token / digitalocean_pat / discord_bot_token | `glpat-<20>`, `npm_<36>`, `hf_<34>`, `dop_v1_<64hex>`, `<24>.<6>.<27>` | `hf_Lk...` | same |
106
  | token | bearer_token_opaque | 32-64 base64url | `YJYGkd2XGEbq0xHBUYUN9wY7...` | same |
107
+ | token | generic_hex_token / generic_alnum_token / generic_dashed_token / generic_upper_token | 32-64 hex / 24-48 alnum / `abcd-ef12-...` lowercase groups / 20-32 uppercase+digits | `9f1c...`, `Lk3P...`, `k9x2-7hqa-m1zt-04pd`, `Q7MZ2...` | CredData token charset classes `digit+lower` 17%, `digit+lower+upper` 20%, `digit+lower+symbol` 15%, `digit+upper` 4% |
108
  | token | basic_auth_b64 | base64(`user:password`) | `ZGVwbG95OkhkNyFrcTJ6` | CredData "Basic Authorization" |
109
+ | password | password | 5-20 chars; charset classes follow CredData (lower 49%, digit+lower 16%, mixed+symbol 10%, ...) | `secretgarden`, `summer2019`, `dbComputer@1601` | CredData "Password"/"URL Credentials" (assignment 33%, yaml 22%, comment 11%, url 8%) |
110
  | private_key | pem_private_key | `-----BEGIN (RSA\|EC\|DSA\|OPENSSH\|) PRIVATE KEY-----` + base64 lines | see example in `sample.jsonl` | CredData "PEM Private Key" (89% standalone block) |
111
  | email | email | RFC-ish `local@domain.tld`, never example.* | `stacie16@gardner.com` | not in CredData; fixed mix: assignment 40%, comment 35%, json/yaml 20% |
112
  | not_secret | placeholder | known dummy values | `AKIAIOSFODNN7EXAMPLE`, `<YOUR_API_KEY>` | secret-like names |
 
118
  | not_secret | base64_non_secret | base64 of an English sentence | `QXVkaWVuY2UgYXJndWUg...` | payload/body names |
119
  | not_secret | version_or_id | IPv4, semver, package id, path, numeric id | `v7.20.44`, `151.134.43.138` | version/host names |
120
 
121
+ Label shares are stable across runs (api_key ~43%, password ~21%, token ~16%, email ~11%, private_key ~9%); exact counts for the current release are in `stats.md`.
122
 
123
  ## 4. Files
124
 
125
  | file | what | size / count |
126
  |---|---|---|
127
+ | `data/train-AAAAA-BBBBB.parquet` | generated records; each Parquet file (zstd) merges base-corpus shards AAAAA..BBBBB (3 shards, ~225k records, ~1.8 GB JSONL, ~480 MB Parquet) | v2: see `stats.md` for the exact file count, records and bytes |
128
+ | `sample.jsonl` | 500 records reservoir-sampled from shards 0-1 of the v2 run, same schema | 500 |
129
  | `eval_creddata.jsonl` | real CredData lines (+-3 lines context), **not synthetic**; use only for evaluation / threshold tuning, never for training if you want an honest number. `T` rows = positives, `F` rows = hard negatives, `X` rows = ignore. Offsets are code-point based like the synthetic data | 67,896 rows; 15,753 T / 48,061 F / 4,082 X; ~90 MB |
130
  | `priors.json` | CredData-derived statistics that drive the generator | 12 KB |
131
  | `stats.md` | counts by label/value_type/context/language, size histogram, throughput | |
README.md CHANGED
@@ -23,6 +23,7 @@ tags:
23
  pretty_name: code-pii (POC) - span-labeled secrets in source code
24
  size_categories:
25
  - 1M<n<10M
 
26
  configs:
27
  - config_name: default
28
  data_files:
@@ -30,7 +31,7 @@ configs:
30
  path: data/*.parquet
31
  ---
32
 
33
- # code-pii (proof of concept)
34
 
35
  Span-labeled source files for fine-tuning an LLM / token classifier to detect **code-related sensitive data**: passwords, API keys, tokens, private keys and emails. Out of scope: names, addresses, phone numbers, SSNs.
36
 
@@ -42,7 +43,7 @@ Full field-by-field documentation: [`DATA_DICTIONARY.md`](DATA_DICTIONARY.md). C
42
 
43
  | path | description |
44
  |---|---|
45
- | `data/part-000NN.parquet` | generated training records (one file per base-corpus shard, ~75k records / ~160 MB each, zstd) |
46
  | `sample.jsonl` | 500 records, same schema, for a quick look |
47
  | `eval_creddata.jsonl` | 67,896 **real** labeled lines from CredData (+-3 lines of context): 15,753 true secrets, 48,061 annotated false positives, 4,082 ambiguous. Evaluation only. |
48
  | `priors.json` | CredData-derived placement statistics that drive the generator |
@@ -69,7 +70,7 @@ Offsets are **0-based Unicode code-point offsets into `text`, end-exclusive**: `
69
 
70
  `label` in `spans`: `api_key`, `password`, `token`, `private_key`, `email`. In `hard_negatives` it is always `not_secret`.
71
 
72
- `value_type` (positives): `aws_access_key_id`, `aws_secret_access_key`, `google_api_key`, `stripe_secret_key`, `sendgrid_api_key`, `twilio_api_key`, `mailgun_api_key`, `openai_api_key`, `anthropic_api_key`, `azure_client_secret`, `generic_hex_key`, `generic_base64_secret`, `generic_alnum_key`, `github_pat`, `github_fine_grained_pat`, `slack_token`, `slack_webhook`, `jwt`, `gitlab_pat`, `npm_token`, `discord_bot_token`, `digitalocean_pat`, `hf_token`, `bearer_token_opaque`, `basic_auth_b64`, `password`, `pem_private_key`, `email`.
73
  `value_type` (hard negatives): `placeholder`, `example_email`, `uuid`, `sha256_hash`, `sha1_git_sha`, `md5_hash`, `env_var_reference`, `public_key_pem`, `ssh_public_key`, `version_or_id`, `base64_non_secret`.
74
 
75
  `context` (how the secret was rendered): `assignment`, `json_key`, `yaml_key`, `env_assignment`, `comment`, `url_credential` (span = the password inside `scheme://user:PASS@host`), `auth_header` (span = the token after `Bearer `/`Basic `), `function_arg`, `pem_block`.
@@ -88,7 +89,7 @@ Example (abridged):
88
 
89
  1. **Priors** (`build_priors.py`): parse CredData's `meta/*.csv` (67,896 rows with line + column offsets, category, GroundTruth) and the rebuilt, CredData-obfuscated files. Collapse ~200 categories to the label set, classify each true secret's syntactic context by regex on the text before the value, collect variable-name vocabularies, value length/charset stats, quote style, extension frequencies and secrets-per-file histogram into `priors.json`. Emit every labeled line as `eval_creddata.jsonl`.
90
  2. **Base corpus**: stream `codeparrot/github-code-clean` parquet shards over HTTPS (ungated, no click-through), keep rows whose `license` is MIT/Apache-2.0/BSD/ISC/Unlicense/CC0 (~63%) and 200 B-200 KB.
91
- 3. **Injection** (`generate_dataset.py`): 75% of files get 1-5 secrets (CredData histogram) and 0-3 hard negatives; label, construct and variable name are sampled from the priors; the value comes from a per-type generator; a 31-language syntax table renders the line (assignment, dict/object key, `.env`/export, comment, URL credential, `Authorization` header in the language's HTTP idiom, PEM as heredoc/template literal/string concatenation); the line is inserted at a random line boundary with the neighbor's indentation; offsets are asserted.
92
  4. **Validation** (`validate.py`): offsets re-checked (0 failures), label tables, regex scanner with gitleaks-style patterns finds 100% of injected spans of 15 pattern-bearing types at the labeled offsets, 20 random records printed for review.
93
 
94
  ## Statistics (this release: shards 0-23)
@@ -122,9 +123,16 @@ Real code, real annotations, obfuscated secret values (CredData's pipeline repla
122
  - Hex key positives vs hash negatives are the same character class and are disambiguated only by variable name, by design.
123
  - Variable-name vocabulary inherits CredData's repo skew (`sharedsecret`, `nonce`, `salt` are over-represented).
124
  - Language mix is code-heavy; YAML/JSON/.env/properties files, where CredData sees most real secrets, are under-represented because github-code-clean has few of them.
125
- - Value charsets are not yet calibrated to CredData: synthetic `api_key` values are ~25% plain hex (CredData: 70%) and synthetic passwords are rarely pure lowercase words (CredData: 49%). See `notebooks/eda.ipynb` section 6; a re-weighting of `GENERATORS`/`gen_password` is the recommended first fix.
126
  - Secrets + emails only; no names/addresses/SSNs.
127
 
 
 
 
 
 
 
 
128
  ## Licenses
129
 
130
  - Base corpus: [codeparrot/github-code-clean](https://huggingface.co/datasets/codeparrot/github-code-clean) (dataset compilation Apache-2.0; ungated). Only files whose per-file `license` is MIT, Apache-2.0, BSD-2/3-Clause, ISC, Unlicense or CC0-1.0 are included and each record carries that license; attribution requirements of those licenses apply to the `repo`/`path` listed in each record.
 
23
  pretty_name: code-pii (POC) - span-labeled secrets in source code
24
  size_categories:
25
  - 1M<n<10M
26
+ version: "2.0"
27
  configs:
28
  - config_name: default
29
  data_files:
 
31
  path: data/*.parquet
32
  ---
33
 
34
+ # code-pii (v2, charset-recalibrated)
35
 
36
  Span-labeled source files for fine-tuning an LLM / token classifier to detect **code-related sensitive data**: passwords, API keys, tokens, private keys and emails. Out of scope: names, addresses, phone numbers, SSNs.
37
 
 
43
 
44
  | path | description |
45
  |---|---|
46
+ | `data/train-AAAAA-BBBBB.parquet` | generated training records; each file merges 3 base-corpus shards (~225k records, ~480 MB, zstd) |
47
  | `sample.jsonl` | 500 records, same schema, for a quick look |
48
  | `eval_creddata.jsonl` | 67,896 **real** labeled lines from CredData (+-3 lines of context): 15,753 true secrets, 48,061 annotated false positives, 4,082 ambiguous. Evaluation only. |
49
  | `priors.json` | CredData-derived placement statistics that drive the generator |
 
70
 
71
  `label` in `spans`: `api_key`, `password`, `token`, `private_key`, `email`. In `hard_negatives` it is always `not_secret`.
72
 
73
+ `value_type` (positives): `aws_access_key_id`, `aws_secret_access_key`, `google_api_key`, `stripe_secret_key`, `sendgrid_api_key`, `twilio_api_key`, `mailgun_api_key`, `openai_api_key`, `anthropic_api_key`, `azure_client_secret`, `generic_hex_key`, `generic_hex_key_upper`, `generic_base64_secret`, `generic_alnum_key`, `generic_lower_key`, `generic_upper_key`, `generic_digit_key`, `generic_hex_dashed_key`, `github_pat`, `github_fine_grained_pat`, `slack_token`, `slack_webhook`, `jwt`, `gitlab_pat`, `npm_token`, `discord_bot_token`, `digitalocean_pat`, `hf_token`, `bearer_token_opaque`, `basic_auth_b64`, `generic_hex_token`, `generic_alnum_token`, `generic_dashed_token`, `generic_upper_token`, `password`, `pem_private_key`, `email`.
74
  `value_type` (hard negatives): `placeholder`, `example_email`, `uuid`, `sha256_hash`, `sha1_git_sha`, `md5_hash`, `env_var_reference`, `public_key_pem`, `ssh_public_key`, `version_or_id`, `base64_non_secret`.
75
 
76
  `context` (how the secret was rendered): `assignment`, `json_key`, `yaml_key`, `env_assignment`, `comment`, `url_credential` (span = the password inside `scheme://user:PASS@host`), `auth_header` (span = the token after `Bearer `/`Basic `), `function_arg`, `pem_block`.
 
89
 
90
  1. **Priors** (`build_priors.py`): parse CredData's `meta/*.csv` (67,896 rows with line + column offsets, category, GroundTruth) and the rebuilt, CredData-obfuscated files. Collapse ~200 categories to the label set, classify each true secret's syntactic context by regex on the text before the value, collect variable-name vocabularies, value length/charset stats, quote style, extension frequencies and secrets-per-file histogram into `priors.json`. Emit every labeled line as `eval_creddata.jsonl`.
91
  2. **Base corpus**: stream `codeparrot/github-code-clean` parquet shards over HTTPS (ungated, no click-through), keep rows whose `license` is MIT/Apache-2.0/BSD/ISC/Unlicense/CC0 (~63%) and 200 B-200 KB.
92
+ 3. **Injection** (`generate_dataset.py`): 75% of files get 1-5 secrets (CredData histogram) and 0-3 hard negatives; label, construct and variable name are sampled from the priors; the value's *charset class* is sampled from CredData's per-label charset distribution and a matching generator is chosen (v2 recalibration, see Changelog); a 31-language syntax table renders the line (assignment, dict/object key, `.env`/export, comment, URL credential, `Authorization` header in the language's HTTP idiom, PEM as heredoc/template literal/string concatenation); the line is inserted at a random line boundary with the neighbor's indentation; offsets are asserted.
93
  4. **Validation** (`validate.py`): offsets re-checked (0 failures), label tables, regex scanner with gitleaks-style patterns finds 100% of injected spans of 15 pattern-bearing types at the labeled offsets, 20 random records printed for review.
94
 
95
  ## Statistics (this release: shards 0-23)
 
123
  - Hex key positives vs hash negatives are the same character class and are disambiguated only by variable name, by design.
124
  - Variable-name vocabulary inherits CredData's repo skew (`sharedsecret`, `nonce`, `salt` are over-represented).
125
  - Language mix is code-heavy; YAML/JSON/.env/properties files, where CredData sees most real secrets, are under-represented because github-code-clean has few of them.
126
+ - Charset classes are calibrated to CredData (v2) but value *lengths within a class* and the vendor-prefix mix are generator choices; CredData classes with <1% mass (`upper`-only, `digit+symbol`) are not produced.
127
  - Secrets + emails only; no names/addresses/SSNs.
128
 
129
+ ## Changelog
130
+
131
+ | version | date | change |
132
+ |---|---|---|
133
+ | v1 (PoC) | 2026-11-05 | 24 shards, 1.81M records, 14.4 GB JSONL / 3.84 GB Parquet (one 160 MB file per shard). EDA found value charsets diverged from CredData: `api_key` 25% plain hex vs 70% real; passwords <1% pure lowercase vs 49% real; tokens 93% mixed-case+symbol vs 40% real. |
134
+ | v2 | 2026-11-05 | **Charset recalibration**: `gen_value` now samples a target charset class from `priors.json: charset_by_label` and picks a generator by `weight x P(class | generator)` with rejection sampling; new generic generators (`generic_hex_key_upper`, `generic_lower_key`, `generic_upper_key`, `generic_digit_key`, `generic_hex_dashed_key`, `generic_hex_token`, `generic_alnum_token`, `generic_dashed_token`, `generic_upper_token`) and a rewritten `gen_password` with lowercase-word classes. Resulting api_key: 71% hex (prior 70%); password: 51% lowercase (prior 49%); token: 43% mixed+symbol (prior 40%). Full 40 GB build (`--seed 2`), Parquet merged to ~480 MB files (`train-AAAAA-BBBBB.parquet`), `data/` replaced. Docs, notebook and sample regenerated. |
135
+
136
  ## Licenses
137
 
138
  - Base corpus: [codeparrot/github-code-clean](https://huggingface.co/datasets/codeparrot/github-code-clean) (dataset compilation Apache-2.0; ungated). Only files whose per-file `license` is MIT, Apache-2.0, BSD-2/3-Clause, ISC, Unlicense or CC0-1.0 are included and each record carries that license; attribution requirements of those licenses apply to the `repo`/`path` listed in each record.
data/part-00004.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:fe15ffb281085b66c2723ae3d0ffd71d7300fda93118da937149fa29ca8cddcc
3
- size 157775245
 
 
 
 
data/part-00005.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d448e0966ce90f542b1bf5164b6371ab684a1f8d02e00bb09771fd59f06f157b
3
- size 162030330
 
 
 
 
data/part-00006.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:97985a427cac74fa6376fb19cc7fbede08e295510383deda3befe40fbc7b9bb0
3
- size 156398382
 
 
 
 
data/part-00007.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:204096160f04334cda5ceb6436cf715c65c5158ac9bd1c98d7d2e1ed4cd5696b
3
- size 161852997
 
 
 
 
data/part-00008.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:af55b0c723673aee3770b2037ac76921c00f699202cc56eff716b2ccce944861
3
- size 156932668
 
 
 
 
data/part-00009.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4376745b32430a411c08213094708e92feeee1cca8ffc6e87ab843a23afffb6c
3
- size 163511052
 
 
 
 
data/part-00010.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:accf01d2cece6a6b2088b0e67015aa19dcea25fbf7abfb8c42ce19e908b4b02b
3
- size 157608460
 
 
 
 
data/part-00011.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:a5ca30450827c6a50cbdb0e52145ccd12aadc312f9d0d61e5fd4f16712df8b27
3
- size 160831338
 
 
 
 
data/part-00012.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9024ed29e41c806511f71c2cc09b8751016da2a6e28d8682d9bd03859ba4ab94
3
- size 157231805
 
 
 
 
data/part-00013.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b3329b842594e437f055fae850a4656b2c5b6062f1c3b1411f2dde611779aa91
3
- size 162674672
 
 
 
 
data/part-00014.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:96ee1f12e0c6cde22cfd01e9a4abe9a3062b6a795ac828738b49000c942f3874
3
- size 158412882
 
 
 
 
data/part-00015.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1250f2e88e4f6b93eee8a79b74093e3fdb76bec1a58156b16f2e449ee29d0df3
3
- size 161960948
 
 
 
 
data/part-00016.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d9ca64fe280c8cbde1d840568c890d094ee31750101a5d741949095a19e77b91
3
- size 157745434
 
 
 
 
data/part-00017.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b47cfaf0c82988b58c2809d1d80b513b1dc8bb3330361f8fdebaa8a77908075d
3
- size 161972403
 
 
 
 
data/part-00018.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:668956b678c15e4ec290c356b40bbf49acb82ef4f4af3974ca81c5f8b60ee864
3
- size 155522962
 
 
 
 
data/part-00019.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:78b27fee3e92decf94cc6fd1af49bebfe93aa8542d1c9f677396fda5e04d16fe
3
- size 162810732
 
 
 
 
data/part-00020.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:cc986ba36137aa1c044eed2d8a78799cd484371f07f0f2049343ee51411864f7
3
- size 157559410
 
 
 
 
data/part-00021.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e39380bd2fa952bd064281caeb521187bc5f9300729c3707542106c5f7ea754f
3
- size 162164664
 
 
 
 
data/part-00022.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:bfb7aac86dc47df16d471ffdf98407f151868a7fd21caa4b1bbbe9762f4d96af
3
- size 159624230
 
 
 
 
data/part-00023.parquet DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:8e28bff5b27d4cdada138659f5b9e672b20f2d67bd4559fb59d927c5fac2239c
3
- size 162676071
 
 
 
 
data/{part-00000.parquet → train-00000-00002.parquet} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0c75593310d23f042071faa510bd8fc5190680c72cb709d544671054ac9d01e5
3
- size 156930226
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a24dd0c86de207b340b70a2119de017e1fec0934331f0f88bc81b7d524977b4
3
+ size 474202995
data/{part-00001.parquet → train-00003-00005.parquet} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fd5811de8dfc1f3cdabef07dd84935b3660bfb622ee6776af73b5a5b043d6b3f
3
- size 161619930
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c560128f7996a2a71d974bf65efab156646f8a5ba474720e2c0ae98b81f3ee8b
3
+ size 480551376
data/{part-00002.parquet → train-00006-00008.parquet} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:64aeac32fe5d40cba4e548283aea68df33ad820edd98b7d2475a4902878fab2c
3
- size 156427434
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4fa5e9bd055f64e224c007025a4e3e5d802945d2f6a62de1905e38debe2d233
3
+ size 473983847
data/{part-00003.parquet → train-00009-00011.parquet} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:79999ff761b92f4c35418a580c48f59e752711199203889a65218f6c53165345
3
- size 162741946
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ef279fe0726eb1a99f0c6a0aa3802b017736bb793b1d37a6eee675322c6519e
3
+ size 480044467
data/train-00012-00014.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ee75059c354dee80f2130c3d9d4cc0352362f234eda23c9a4f3063c0f87bd6f
3
+ size 476766732
data/train-00015-00017.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e276953a09c0b2dbfa111d27e726a4788411e3956a67976041a73a0afd248945
3
+ size 480375176
data/train-00018-00020.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:210b10190aebd9d998ad524dba796e191be19045db050676876736b4ab421a09
3
+ size 475610117
data/train-00021-00023.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d0ea10c272a7f17e5a2712b1274d2651a1f9eb3f936c9c1462e432348e61c8e
3
+ size 483569061
data/train-00024-00026.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e38d3902e277ee3228ecba6008f1c5d8fe7255c3df6f805d3181e20cf22e0d6
3
+ size 479051338
data/train-00027-00029.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:baebe3064382dbfcc24403000f86507cc58bd8f65b3afba9ea5e53e52b8729f3
3
+ size 473025807
data/train-00030-00032.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b9670a216ecf104b68f11bb23d6dd71d1ea84f78d93763b7471368e06ddcd84
3
+ size 480399119
data/train-00033-00035.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:860ebf4029f6f3c2db3697e74d371e418ce85bf42bca85ec40ad50b20e56ab96
3
+ size 478168950
data/train-00036-00038.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf55bf569ff38a0879b2f28ac960c1f1f2a6b958eb73b402d0c31a1d182933c5
3
+ size 482926481
data/train-00039-00041.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e471c3589233dcdcad4b19c526cb129503ec3c7fb683609ae834d83b125451fa
3
+ size 473504996
data/train-00042-00044.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f516eded3ddc95fbfb32d188bd06469c0746156da04763cc4981c24ead9a37ab
3
+ size 483011399
data/train-00045-00047.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71c7592f1d3d3c2ba4364b6778502948a531b93704c2d03a73850dd3e8507c4b
3
+ size 478048648
data/train-00048-00050.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c25248b6059f5cca1067ceabcbb7a99a53a3f1f3fec82e1a472921d11dd6b65
3
+ size 478676578
data/train-00051-00053.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:021b16041c3887687560fd568b4217ef6765c905d16c8ceb265c7a8145b7bec5
3
+ size 484807633
data/train-00054-00056.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5bccb32fc4e95824377bd31b220b9029a6e48696b72ae4bbbb6cee2b4566c2ba
3
+ size 478119930
data/train-00057-00059.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d417240d9a52ae4f01373401246681129d5351806df4c47d4de1ddcffc61e4fd
3
+ size 475373339
data/train-00060-00062.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab4fbea52bc5764bbcc0f6b1f8bf71fa8302b4473c03081aedbfd470fa558643
3
+ size 479144687
data/train-00063-00065.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c434d6a6afbe6ab4001ed9a74bec84692a04669574924f6fdb0e1ce37553c873
3
+ size 474893789
data/train-00066-00068.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36d7b472a02216fdbb6bfd7bf33f7581bda651562d71bf684e476bad399f9370
3
+ size 484232757
data/train-00069-00069.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0015c31c00e9f8a622111b89fb47d6ac31c563e1d79838843af091017084e4b
3
+ size 158574328
generate_dataset.py CHANGED
@@ -99,14 +99,24 @@ def gen_jwt():
99
  return f"{hdr}.{pl}.{b64url(32)}"
100
 
101
  def gen_password():
 
 
102
  k = R.random()
103
- if k < 0.45:
104
- return fake.password(length=R.randint(8, 16), special_chars=R.random() < 0.4)
105
- if k < 0.70:
106
- return R.choice(["", "", "admin", "root", "dev", "test", "db", "qa"]) + fake.word().capitalize() + R.choice(["", "!", "#", "@"]) + str(R.randint(1, 2024))
107
- if k < 0.85:
108
- return rs(string.ascii_lowercase + string.digits, R.randint(6, 12))
109
- return fake.word() + "_" + fake.word() + str(R.randint(10, 99))
 
 
 
 
 
 
 
 
110
 
111
  def gen_pem():
112
  kind = R.choice(["RSA PRIVATE KEY", "RSA PRIVATE KEY", "PRIVATE KEY", "EC PRIVATE KEY", "OPENSSH PRIVATE KEY", "DSA PRIVATE KEY"])
@@ -139,8 +149,13 @@ GENERATORS = {
139
  (1, "anthropic_api_key", lambda: "sk-ant-api03-" + rs(B64URL, 93) + "AA"),
140
  (1, "azure_client_secret", lambda: rs(B62 + "~._-", 40)),
141
  (6, "generic_hex_key", lambda: rs(HEX, R.choice([32, 32, 40, 48, 64, 64]))),
 
142
  (4, "generic_base64_secret", lambda: b64(R.choice([24, 32, 32, 48, 64]))),
143
  (2, "generic_alnum_key", lambda: rs(B62, R.choice([20, 24, 32, 40]))),
 
 
 
 
144
  ],
145
  "token": [
146
  (3, "github_pat", lambda: R.choice(["ghp_", "gho_", "ghs_"]) + rs(B62, 36)),
@@ -155,6 +170,10 @@ GENERATORS = {
155
  (1, "hf_token", lambda: "hf_" + rs(B62, 34)),
156
  (3, "bearer_token_opaque", lambda: rs(B64URL, R.choice([32, 40, 43, 64]))),
157
  (2, "basic_auth_b64", lambda: base64.b64encode(f"{fake.user_name()}:{gen_password()}".encode()).decode()),
 
 
 
 
158
  ],
159
  "password": [(1, "password", gen_password)],
160
  "private_key": [(1, "pem_private_key", gen_pem)],
@@ -170,9 +189,52 @@ def pick_weighted(items):
170
  return it
171
  return items[-1]
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  def gen_value(label):
174
- w, vt, fn = pick_weighted(GENERATORS[label])
175
- return fn(), vt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
  # Hard negatives: (value_type, fn, label_of_similar_secret)
178
  HARD_NEGATIVES = [
@@ -208,6 +270,13 @@ class Priors:
208
  self.names["token"] = dict(self.names["token"]); self.names["token"].update({"token": 50, "access_token": 30, "auth_token": 20, "api_token": 15, "github_token": 10, "slack_token": 8, "bearer": 5})
209
  self.names["api_key"] = dict(self.names["api_key"]); self.names["api_key"].update({"api_key": 60, "apikey": 30, "secret_key": 30, "aws_secret_access_key": 20, "aws_access_key_id": 20, "client_secret": 20, "private_key": 5, "stripe_key": 5})
210
  self.names["private_key"] = {"private_key": 30, "key": 20, "rsa_key": 10, "ssh_key": 10, "pem": 5, "signing_key": 5, "server_key": 5}
 
 
 
 
 
 
 
211
  h = p.get("secrets_per_file_hist", {"1": 60, "2": 20, "3": 10, "4": 5})
212
  # CredData's last bucket is "10+", dominated by a few credential-dump files; damp it
213
  self.nsec = [min(int(k), 5) for k in h]; self.nsec_w = [h[k] / (4 if int(k) >= 10 else 1) for k in h]
 
99
  return f"{hdr}.{pl}.{b64url(32)}"
100
 
101
  def gen_password():
102
+ """Password sub-generators spanning CredData's charset buckets (lower 49%, digit+lower 16%, mixed 10%, ...).
103
+ The final mix is set by charset-targeted sampling (see gen_value), not by the branch probabilities here."""
104
  k = R.random()
105
+ if k < 0.30: # pure lowercase: dictionary words, as in most real leaked passwords
106
+ return R.choice([fake.word() + fake.word(), fake.word() + R.choice(["pass", "pwd", "admin", "secret", "test", "root"]), fake.user_name().replace(".", "").replace("_", ""), rs(string.ascii_lowercase, R.randint(5, 12))])
107
+ if k < 0.45: # lowercase + digits
108
+ return R.choice([fake.word() + str(R.randint(1, 9999)), rs(string.ascii_lowercase + string.digits, R.randint(6, 12)), fake.word() + str(R.randint(10, 99)) + fake.word()])
109
+ if k < 0.55: # lowercase + symbol
110
+ return R.choice([fake.word() + R.choice(["_", "-", ".", "!", "@"]) + fake.word(), fake.word() + R.choice(["!", "#", "$"])])
111
+ if k < 0.70: # mixed case, digits, symbols (Faker-style strong passwords)
112
+ return fake.password(length=R.randint(8, 16), special_chars=R.random() < 0.6)
113
+ if k < 0.85: # capitalised word + digits (+ symbol)
114
+ return R.choice(["", "", "admin", "root", "dev", "test", "db", "qa"]) + fake.word().capitalize() + R.choice(["", "", "!", "#", "@"]) + str(R.randint(1, 2024))
115
+ if k < 0.92:
116
+ return fake.word() + "_" + fake.word() + str(R.randint(10, 99))
117
+ if k < 0.96:
118
+ return str(R.randint(10 ** 5, 10 ** 9)) # digits only
119
+ return rs(string.ascii_uppercase, R.randint(6, 10)) if R.random() < 0.5 else fake.word().capitalize() + fake.word().capitalize()
120
 
121
  def gen_pem():
122
  kind = R.choice(["RSA PRIVATE KEY", "RSA PRIVATE KEY", "PRIVATE KEY", "EC PRIVATE KEY", "OPENSSH PRIVATE KEY", "DSA PRIVATE KEY"])
 
149
  (1, "anthropic_api_key", lambda: "sk-ant-api03-" + rs(B64URL, 93) + "AA"),
150
  (1, "azure_client_secret", lambda: rs(B62 + "~._-", 40)),
151
  (6, "generic_hex_key", lambda: rs(HEX, R.choice([32, 32, 40, 48, 64, 64]))),
152
+ (2, "generic_hex_key_upper", lambda: rs(HEX.upper(), R.choice([32, 40, 64]))),
153
  (4, "generic_base64_secret", lambda: b64(R.choice([24, 32, 32, 48, 64]))),
154
  (2, "generic_alnum_key", lambda: rs(B62, R.choice([20, 24, 32, 40]))),
155
+ (1, "generic_lower_key", lambda: rs(string.ascii_lowercase, R.choice([16, 20, 24, 32]))),
156
+ (1, "generic_upper_key", lambda: rs(string.ascii_uppercase + string.digits, R.choice([16, 20, 25, 32]))),
157
+ (1, "generic_digit_key", lambda: rs(string.digits, R.choice([12, 16, 20, 32]))),
158
+ (1, "generic_hex_dashed_key", lambda: "-".join(rs(HEX, 8) for _ in range(R.choice([3, 4, 5])))),
159
  ],
160
  "token": [
161
  (3, "github_pat", lambda: R.choice(["ghp_", "gho_", "ghs_"]) + rs(B62, 36)),
 
170
  (1, "hf_token", lambda: "hf_" + rs(B62, 34)),
171
  (3, "bearer_token_opaque", lambda: rs(B64URL, R.choice([32, 40, 43, 64]))),
172
  (2, "basic_auth_b64", lambda: base64.b64encode(f"{fake.user_name()}:{gen_password()}".encode()).decode()),
173
+ (3, "generic_hex_token", lambda: rs(HEX, R.choice([32, 40, 48, 64]))),
174
+ (2, "generic_alnum_token", lambda: rs(B62, R.choice([24, 32, 40, 48]))),
175
+ (2, "generic_dashed_token", lambda: "-".join(rs(string.ascii_lowercase + string.digits, R.choice([4, 6, 8])) for _ in range(R.choice([3, 4, 5, 6])))),
176
+ (1, "generic_upper_token", lambda: rs(string.ascii_uppercase + string.digits, R.choice([20, 24, 32]))),
177
  ],
178
  "password": [(1, "password", gen_password)],
179
  "private_key": [(1, "pem_private_key", gen_pem)],
 
189
  return it
190
  return items[-1]
191
 
192
+ def charset(v):
193
+ s = set()
194
+ if re.search(r"[a-z]", v): s.add("lower")
195
+ if re.search(r"[A-Z]", v): s.add("upper")
196
+ if re.search(r"[0-9]", v): s.add("digit")
197
+ if re.search(r"[^A-Za-z0-9]", v): s.add("symbol")
198
+ return "+".join(sorted(s))
199
+
200
+ def _profile_generators(n=300):
201
+ """Empirical P(charset | generator), used to steer sampling toward CredData's charset mix."""
202
+ prof = {}
203
+ for label, gens in GENERATORS.items():
204
+ for w, vt, fn in gens:
205
+ c = {}
206
+ for _ in range(n):
207
+ cs = charset(fn()); c[cs] = c.get(cs, 0) + 1
208
+ prof[vt] = {k: v / n for k, v in c.items()}
209
+ return prof
210
+
211
+ GEN_PROFILE = None
212
+ CHARSET_TARGET = {} # label -> {charset: weight}; filled from priors.json by Priors()
213
+
214
  def gen_value(label):
215
+ """Pick a generator and value. When a charset target exists for the label (api_key, password, token),
216
+ first draw a target charset from CredData's distribution, then draw a generator proportionally to
217
+ base_weight * P(charset | generator) and rejection-sample (<=12 tries) until the value matches."""
218
+ global GEN_PROFILE
219
+ gens = GENERATORS[label]
220
+ tgt = CHARSET_TARGET.get(label)
221
+ if not tgt:
222
+ w, vt, fn = pick_weighted(gens)
223
+ return fn(), vt
224
+ if GEN_PROFILE is None:
225
+ GEN_PROFILE = _profile_generators()
226
+ cs = R.choices(list(tgt), list(tgt.values()))[0]
227
+ cands = [(w * GEN_PROFILE[vt].get(cs, 0), vt, fn) for w, vt, fn in gens if GEN_PROFILE[vt].get(cs, 0) > 0]
228
+ if not cands:
229
+ w, vt, fn = pick_weighted(gens)
230
+ return fn(), vt
231
+ w, vt, fn = pick_weighted(cands)
232
+ v = fn()
233
+ for _ in range(12):
234
+ if charset(v) == cs:
235
+ break
236
+ v = fn()
237
+ return v, vt
238
 
239
  # Hard negatives: (value_type, fn, label_of_similar_secret)
240
  HARD_NEGATIVES = [
 
270
  self.names["token"] = dict(self.names["token"]); self.names["token"].update({"token": 50, "access_token": 30, "auth_token": 20, "api_token": 15, "github_token": 10, "slack_token": 8, "bearer": 5})
271
  self.names["api_key"] = dict(self.names["api_key"]); self.names["api_key"].update({"api_key": 60, "apikey": 30, "secret_key": 30, "aws_secret_access_key": 20, "aws_access_key_id": 20, "client_secret": 20, "private_key": 5, "stripe_key": 5})
272
  self.names["private_key"] = {"private_key": 30, "key": 20, "rsa_key": 10, "ssh_key": 10, "pem": 5, "signing_key": 5, "server_key": 5}
273
+ global GEN_PROFILE
274
+ if GEN_PROFILE is None:
275
+ GEN_PROFILE = _profile_generators()
276
+ for l in ("api_key", "password", "token"):
277
+ d = p.get("charset_by_label", {}).get(l, {})
278
+ reachable = set().union(*(GEN_PROFILE[vt].keys() for _, vt, _ in GENERATORS[l]))
279
+ CHARSET_TARGET[l] = {cs: n for cs, n in d.items() if cs in reachable and n > 0}
280
  h = p.get("secrets_per_file_hist", {"1": 60, "2": 20, "3": 10, "4": 5})
281
  # CredData's last bucket is "10+", dominated by a few credential-dump files; damp it
282
  self.nsec = [min(int(k), 5) for k in h]; self.nsec_w = [h[k] / (4 if int(k) >= 10 else 1) for k in h]
notebooks/eda.ipynb CHANGED
The diff for this file is too large to render. See raw diff
 
notebooks/make_stats_summary.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Aggregate part-*.stats.json + summary.json of a generated dataset dir into notebooks/stats_summary.json."""
3
+ import json, glob, collections, sys, os
4
+ d = sys.argv[1]; out = sys.argv[2] if len(sys.argv) > 2 else os.path.join(os.path.dirname(__file__), "stats_summary.json")
5
+ C = collections.Counter
6
+ agg = {k: C() for k in ("label", "value_type", "lang", "context")}; tot = C(); per = []
7
+ for p in sorted(glob.glob(os.path.join(d, "part-*.stats.json"))):
8
+ s = json.load(open(p))
9
+ for k in agg: agg[k].update(s[k])
10
+ for k in ("files", "injected_files", "clean_files", "bytes", "spans", "negs", "skipped_license", "skipped_size"): tot[k] += s[k]
11
+ per.append({k: s[k] for k in ("shard", "files", "bytes", "spans", "negs", "seconds")})
12
+ summ = json.load(open(os.path.join(d, "summary.json")))
13
+ res = {"note": f"Aggregated from per-shard stats emitted by generate_dataset.py for the full run ({summ['shards']} shards).", "summary": summ, "totals": dict(tot),
14
+ "label": dict(agg["label"]), "value_type": {k: v for k, v in agg["value_type"].items() if not k.startswith("neg:")},
15
+ "hard_negative_type": {k[4:]: v for k, v in agg["value_type"].items() if k.startswith("neg:")}, "language": dict(agg["lang"]), "context": dict(agg["context"]), "per_shard": per}
16
+ json.dump(res, open(out, "w"), indent=1); print(out, tot["files"], tot["bytes"])
notebooks/stats_summary.json CHANGED
@@ -1,310 +1,687 @@
1
  {
2
- "note": "Aggregated from per-shard stats emitted by generate_dataset.py for the full 24-shard run (shards 0-23).",
3
  "summary": {
4
- "shards": 24,
5
- "files": 1810060,
6
- "bytes": 14426362622,
7
- "spans": 2319190,
8
- "hard_negatives": 1696239,
9
- "seconds": 217.29999999999998,
10
- "workers": 4,
11
- "MB_per_s": 66.39
12
  },
13
  "totals": {
14
- "files": 1810060,
15
- "injected_files": 1153616,
16
- "clean_files": 656444,
17
- "bytes": 14426362622,
18
- "spans": 2319190,
19
- "negs": 1696239,
20
- "skipped_license": 1075029,
21
- "skipped_size": 161111
22
  },
23
  "label": {
24
- "private_key": 215959,
25
- "password": 482135,
26
- "api_key": 1008714,
27
- "token": 363752,
28
- "email": 248630
29
  },
30
  "value_type": {
31
- "pem_private_key": 215959,
32
- "password": 482135,
33
- "stripe_secret_key": 72231,
34
- "openai_api_key": 35976,
35
- "generic_base64_secret": 143999,
36
- "generic_hex_key": 215759,
37
- "bearer_token_opaque": 51927,
38
- "email": 248630,
39
- "jwt": 69314,
40
- "mailgun_api_key": 36176,
41
- "aws_access_key_id": 108440,
42
- "twilio_api_key": 36039,
43
- "google_api_key": 72035,
44
- "generic_alnum_key": 72287,
45
- "npm_token": 17265,
46
- "basic_auth_b64": 34582,
47
- "aws_secret_access_key": 107670,
48
- "github_pat": 52267,
49
- "sendgrid_api_key": 36048,
50
- "gitlab_pat": 17297,
51
- "slack_token": 34404,
52
- "discord_bot_token": 17510,
53
- "slack_webhook": 17266,
54
- "github_fine_grained_pat": 17252,
55
- "digitalocean_pat": 17313,
56
- "azure_client_secret": 35964,
57
- "anthropic_api_key": 36090,
58
- "hf_token": 17355
 
 
 
 
 
 
 
 
 
59
  },
60
  "hard_negative_type": {
61
- "uuid": 154284,
62
- "ssh_public_key": 154826,
63
- "sha1_git_sha": 153941,
64
- "version_or_id": 154375,
65
- "public_key_pem": 154348,
66
- "example_email": 153763,
67
- "base64_non_secret": 153819,
68
- "env_var_reference": 153704,
69
- "md5_hash": 154226,
70
- "sha256_hash": 154820,
71
- "placeholder": 154133
72
  },
73
  "language": {
74
- "JavaScript": 210187,
75
- "GO": 48747,
76
- "C": 144024,
77
- "CSS": 26863,
78
- "Markdown": 128952,
79
- "C++": 94112,
80
- "Batchfile": 1844,
81
- "Java": 347001,
82
- "SQL": 6795,
83
- "Python": 116954,
84
- "PHP": 154047,
85
- "HTML": 195124,
86
- "C#": 128866,
87
- "Ruby": 83580,
88
- "TypeScript": 40648,
89
- "Rust": 6296,
90
- "Shell": 17885,
91
- "Scala": 18369,
92
- "CMake": 2478,
93
- "TeX": 2930,
94
- "Lua": 5003,
95
- "Julia": 1242,
96
- "Makefile": 6405,
97
- "FORTRAN": 1316,
98
- "PowerShell": 3105,
99
- "Assembly": 720,
100
- "Perl": 4947,
101
- "Visual Basic": 1969,
102
- "Dockerfile": 3153,
103
- "Haskell": 6498
104
  },
105
  "context": {
106
- "pem_block": 216577,
107
- "yaml_key": 239092,
108
- "assignment": 1091580,
109
- "url_credential": 72576,
110
- "comment": 191427,
111
- "json_key": 258561,
112
- "env_assignment": 42691,
113
- "auth_header": 159434,
114
- "function_arg": 47252
115
  },
116
  "per_shard": [
117
  {
118
  "shard": 0,
119
  "files": 74815,
120
- "bytes": 590694516,
121
- "spans": 95653,
122
- "negs": 70354,
123
- "seconds": 26.2
124
  },
125
  {
126
  "shard": 1,
127
  "files": 76521,
128
- "bytes": 607625703,
129
- "spans": 98151,
130
- "negs": 71293,
131
- "seconds": 26.5
132
  },
133
  {
134
  "shard": 2,
135
  "files": 74273,
136
- "bytes": 588171619,
137
- "spans": 95466,
138
- "negs": 69760,
139
- "seconds": 25.9
140
  },
141
  {
142
  "shard": 3,
143
  "files": 76117,
144
- "bytes": 612627702,
145
- "spans": 97511,
146
- "negs": 71403,
147
- "seconds": 26.8
148
  },
149
  {
150
  "shard": 4,
151
  "files": 75057,
152
- "bytes": 595213026,
153
- "spans": 96511,
154
- "negs": 70390,
155
- "seconds": 26.1
156
  },
157
  {
158
  "shard": 5,
159
  "files": 76333,
160
- "bytes": 610242813,
161
- "spans": 98239,
162
- "negs": 71773,
163
- "seconds": 26.5
164
  },
165
  {
166
  "shard": 6,
167
  "files": 74175,
168
- "bytes": 587985954,
169
- "spans": 94366,
170
- "negs": 69551,
171
- "seconds": 25.7
172
  },
173
  {
174
  "shard": 7,
175
  "files": 76218,
176
- "bytes": 605199682,
177
- "spans": 97763,
178
- "negs": 71536,
179
- "seconds": 26.3
180
  },
181
  {
182
  "shard": 8,
183
  "files": 74476,
184
- "bytes": 591982426,
185
- "spans": 95276,
186
- "negs": 69713,
187
- "seconds": 25.9
188
  },
189
  {
190
  "shard": 9,
191
  "files": 76612,
192
- "bytes": 617047081,
193
- "spans": 97947,
194
- "negs": 71645,
195
- "seconds": 27.0
196
  },
197
  {
198
  "shard": 10,
199
  "files": 74578,
200
- "bytes": 593557485,
201
- "spans": 95816,
202
- "negs": 69759,
203
- "seconds": 25.9
204
  },
205
  {
206
  "shard": 11,
207
  "files": 76314,
208
- "bytes": 599733027,
209
- "spans": 97762,
210
- "negs": 71858,
211
- "seconds": 26.9
212
  },
213
  {
214
  "shard": 12,
215
  "files": 74366,
216
- "bytes": 590979194,
217
- "spans": 95345,
218
- "negs": 69367,
219
- "seconds": 26.4
220
  },
221
  {
222
  "shard": 13,
223
  "files": 76371,
224
- "bytes": 610640246,
225
- "spans": 98079,
226
- "negs": 71815,
227
- "seconds": 27.3
228
  },
229
  {
230
  "shard": 14,
231
  "files": 74739,
232
- "bytes": 596045071,
233
- "spans": 95807,
234
- "negs": 69986,
235
- "seconds": 26.8
236
  },
237
  {
238
  "shard": 15,
239
  "files": 76680,
240
- "bytes": 609048185,
241
- "spans": 98107,
242
- "negs": 71782,
243
- "seconds": 27.3
244
  },
245
  {
246
  "shard": 16,
247
  "files": 74304,
248
- "bytes": 593641813,
249
- "spans": 95509,
250
- "negs": 69405,
251
- "seconds": 26.3
252
  },
253
  {
254
  "shard": 17,
255
  "files": 76491,
256
- "bytes": 608303848,
257
- "spans": 98348,
258
- "negs": 71545,
259
- "seconds": 27.2
260
  },
261
  {
262
  "shard": 18,
263
  "files": 73595,
264
- "bytes": 587978743,
265
- "spans": 93698,
266
- "negs": 68802,
267
- "seconds": 26.0
268
  },
269
  {
270
  "shard": 19,
271
  "files": 77065,
272
- "bytes": 611322163,
273
- "spans": 98188,
274
- "negs": 72281,
275
- "seconds": 27.6
276
  },
277
  {
278
  "shard": 20,
279
  "files": 73881,
280
- "bytes": 592887155,
281
- "spans": 94528,
282
- "negs": 69262,
283
- "seconds": 26.4
284
  },
285
  {
286
  "shard": 21,
287
  "files": 75915,
288
- "bytes": 609462360,
289
- "spans": 97166,
290
- "negs": 71082,
291
- "seconds": 26.3
292
  },
293
  {
294
  "shard": 22,
295
  "files": 75145,
296
- "bytes": 602208787,
297
- "spans": 96099,
298
- "negs": 70374,
299
- "seconds": 26.4
300
  },
301
  {
302
  "shard": 23,
303
  "files": 76019,
304
- "bytes": 613764023,
305
- "spans": 97855,
306
- "negs": 71503,
307
- "seconds": 26.5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  }
309
  ]
310
  }
 
1
  {
2
+ "note": "Aggregated from per-shard stats emitted by generate_dataset.py for the full run (70 shards).",
3
  "summary": {
4
+ "shards": 70,
5
+ "files": 5278400,
6
+ "bytes": 42079749385,
7
+ "spans": 6765485,
8
+ "hard_negatives": 4947748,
9
+ "seconds": 709.7,
10
+ "MB_per_s": 59.3,
11
+ "workers": 4
12
  },
13
  "totals": {
14
+ "files": 5278400,
15
+ "injected_files": 3365090,
16
+ "clean_files": 1913310,
17
+ "bytes": 42079749385,
18
+ "spans": 6765485,
19
+ "negs": 4947748,
20
+ "skipped_license": 3136065,
21
+ "skipped_size": 470285
22
  },
23
  "label": {
24
+ "api_key": 2941426,
25
+ "private_key": 630711,
26
+ "token": 1057949,
27
+ "password": 1411282,
28
+ "email": 724117
29
  },
30
  "value_type": {
31
+ "generic_hex_key": 2088403,
32
+ "pem_private_key": 630711,
33
+ "hf_token": 23999,
34
+ "generic_hex_key_upper": 84257,
35
+ "generic_alnum_token": 125593,
36
+ "generic_hex_token": 188962,
37
+ "generic_upper_token": 42387,
38
+ "generic_dashed_token": 108217,
39
+ "password": 1411282,
40
+ "google_api_key": 46522,
41
+ "github_pat": 72223,
42
+ "stripe_secret_key": 45652,
43
+ "generic_base64_secret": 84345,
44
+ "twilio_api_key": 28982,
45
+ "email": 724117,
46
+ "slack_token": 47429,
47
+ "digitalocean_pat": 52983,
48
+ "jwt": 94858,
49
+ "basic_auth_b64": 78316,
50
+ "generic_alnum_key": 70933,
51
+ "aws_access_key_id": 140211,
52
+ "generic_upper_key": 42447,
53
+ "discord_bot_token": 23750,
54
+ "bearer_token_opaque": 100417,
55
+ "openai_api_key": 20557,
56
+ "anthropic_api_key": 20045,
57
+ "aws_secret_access_key": 68075,
58
+ "gitlab_pat": 26876,
59
+ "generic_lower_key": 84658,
60
+ "slack_webhook": 23980,
61
+ "generic_digit_key": 14650,
62
+ "generic_hex_dashed_key": 30003,
63
+ "mailgun_api_key": 30009,
64
+ "sendgrid_api_key": 20259,
65
+ "npm_token": 24231,
66
+ "github_fine_grained_pat": 23728,
67
+ "azure_client_secret": 21418
68
  },
69
  "hard_negative_type": {
70
+ "public_key_pem": 450917,
71
+ "example_email": 449706,
72
+ "sha256_hash": 448904,
73
+ "base64_non_secret": 449929,
74
+ "uuid": 450581,
75
+ "sha1_git_sha": 449891,
76
+ "env_var_reference": 449976,
77
+ "ssh_public_key": 449066,
78
+ "placeholder": 449463,
79
+ "version_or_id": 448970,
80
+ "md5_hash": 450345
81
  },
82
  "language": {
83
+ "JavaScript": 611284,
84
+ "GO": 142183,
85
+ "C": 418772,
86
+ "CSS": 77104,
87
+ "Markdown": 377703,
88
+ "C++": 276426,
89
+ "Batchfile": 5395,
90
+ "Java": 1013525,
91
+ "SQL": 19549,
92
+ "Python": 342346,
93
+ "PHP": 447622,
94
+ "HTML": 569348,
95
+ "C#": 374456,
96
+ "Ruby": 244789,
97
+ "TypeScript": 118371,
98
+ "Rust": 18294,
99
+ "Shell": 52401,
100
+ "Scala": 53472,
101
+ "CMake": 7311,
102
+ "TeX": 8167,
103
+ "Lua": 14602,
104
+ "Julia": 3596,
105
+ "Makefile": 18329,
106
+ "FORTRAN": 3693,
107
+ "PowerShell": 8941,
108
+ "Assembly": 2144,
109
+ "Perl": 14562,
110
+ "Visual Basic": 5753,
111
+ "Dockerfile": 9249,
112
+ "Haskell": 19013
113
  },
114
  "context": {
115
+ "json_key": 754676,
116
+ "pem_block": 632717,
117
+ "auth_header": 462377,
118
+ "assignment": 3184852,
119
+ "yaml_key": 698655,
120
+ "comment": 558213,
121
+ "url_credential": 211787,
122
+ "function_arg": 137084,
123
+ "env_assignment": 125124
124
  },
125
  "per_shard": [
126
  {
127
  "shard": 0,
128
  "files": 74815,
129
+ "bytes": 590132293,
130
+ "spans": 95461,
131
+ "negs": 70511,
132
+ "seconds": 32.1
133
  },
134
  {
135
  "shard": 1,
136
  "files": 76521,
137
+ "bytes": 607328364,
138
+ "spans": 98481,
139
+ "negs": 71264,
140
+ "seconds": 33.0
141
  },
142
  {
143
  "shard": 2,
144
  "files": 74273,
145
+ "bytes": 587502343,
146
+ "spans": 94997,
147
+ "negs": 69573,
148
+ "seconds": 31.8
149
  },
150
  {
151
  "shard": 3,
152
  "files": 76117,
153
+ "bytes": 611344041,
154
+ "spans": 97950,
155
+ "negs": 71405,
156
+ "seconds": 33.4
157
  },
158
  {
159
  "shard": 4,
160
  "files": 75057,
161
+ "bytes": 594260184,
162
+ "spans": 96401,
163
+ "negs": 70334,
164
+ "seconds": 31.6
165
  },
166
  {
167
  "shard": 5,
168
  "files": 76333,
169
+ "bytes": 609450038,
170
+ "spans": 98172,
171
+ "negs": 71875,
172
+ "seconds": 32.6
173
  },
174
  {
175
  "shard": 6,
176
  "files": 74175,
177
+ "bytes": 587380148,
178
+ "spans": 95239,
179
+ "negs": 69560,
180
+ "seconds": 31.9
181
  },
182
  {
183
  "shard": 7,
184
  "files": 76218,
185
+ "bytes": 604513085,
186
+ "spans": 97164,
187
+ "negs": 71421,
188
+ "seconds": 32.2
189
  },
190
  {
191
  "shard": 8,
192
  "files": 74476,
193
+ "bytes": 591230541,
194
+ "spans": 95493,
195
+ "negs": 70012,
196
+ "seconds": 30.7
197
  },
198
  {
199
  "shard": 9,
200
  "files": 76612,
201
+ "bytes": 616167696,
202
+ "spans": 98466,
203
+ "negs": 71443,
204
+ "seconds": 31.5
205
  },
206
  {
207
  "shard": 10,
208
  "files": 74578,
209
+ "bytes": 592730222,
210
+ "spans": 94585,
211
+ "negs": 70091,
212
+ "seconds": 30.8
213
  },
214
  {
215
  "shard": 11,
216
  "files": 76314,
217
+ "bytes": 598231423,
218
+ "spans": 97160,
219
+ "negs": 71253,
220
+ "seconds": 31.2
221
  },
222
  {
223
  "shard": 12,
224
  "files": 74366,
225
+ "bytes": 590322850,
226
+ "spans": 95512,
227
+ "negs": 69961,
228
+ "seconds": 30.4
229
  },
230
  {
231
  "shard": 13,
232
  "files": 76371,
233
+ "bytes": 609610505,
234
+ "spans": 97516,
235
+ "negs": 71776,
236
+ "seconds": 31.3
237
  },
238
  {
239
  "shard": 14,
240
  "files": 74739,
241
+ "bytes": 595168614,
242
+ "spans": 95780,
243
+ "negs": 69996,
244
+ "seconds": 30.8
245
  },
246
  {
247
  "shard": 15,
248
  "files": 76680,
249
+ "bytes": 608035568,
250
+ "spans": 98368,
251
+ "negs": 71774,
252
+ "seconds": 31.3
253
  },
254
  {
255
  "shard": 16,
256
  "files": 74304,
257
+ "bytes": 593074785,
258
+ "spans": 95677,
259
+ "negs": 69458,
260
+ "seconds": 31.0
261
  },
262
  {
263
  "shard": 17,
264
  "files": 76491,
265
+ "bytes": 607856415,
266
+ "spans": 98786,
267
+ "negs": 71772,
268
+ "seconds": 31.8
269
  },
270
  {
271
  "shard": 18,
272
  "files": 73595,
273
+ "bytes": 587845861,
274
+ "spans": 94105,
275
+ "negs": 69206,
276
+ "seconds": 30.8
277
  },
278
  {
279
  "shard": 19,
280
  "files": 77065,
281
+ "bytes": 611444809,
282
+ "spans": 99267,
283
+ "negs": 72463,
284
+ "seconds": 31.7
285
  },
286
  {
287
  "shard": 20,
288
  "files": 73881,
289
+ "bytes": 592401284,
290
+ "spans": 94943,
291
+ "negs": 69107,
292
+ "seconds": 30.4
293
  },
294
  {
295
  "shard": 21,
296
  "files": 75915,
297
+ "bytes": 609008949,
298
+ "spans": 97873,
299
+ "negs": 71138,
300
+ "seconds": 31.5
301
  },
302
  {
303
  "shard": 22,
304
  "files": 75145,
305
+ "bytes": 602087055,
306
+ "spans": 96249,
307
+ "negs": 70554,
308
+ "seconds": 30.9
309
  },
310
  {
311
  "shard": 23,
312
  "files": 76019,
313
+ "bytes": 612602995,
314
+ "spans": 97029,
315
+ "negs": 70791,
316
+ "seconds": 31.3
317
+ },
318
+ {
319
+ "shard": 24,
320
+ "files": 74954,
321
+ "bytes": 597697343,
322
+ "spans": 96405,
323
+ "negs": 70447,
324
+ "seconds": 31.0
325
+ },
326
+ {
327
+ "shard": 25,
328
+ "files": 75824,
329
+ "bytes": 598667598,
330
+ "spans": 96853,
331
+ "negs": 70800,
332
+ "seconds": 31.2
333
+ },
334
+ {
335
+ "shard": 26,
336
+ "files": 75079,
337
+ "bytes": 602335974,
338
+ "spans": 95583,
339
+ "negs": 70613,
340
+ "seconds": 30.5
341
+ },
342
+ {
343
+ "shard": 27,
344
+ "files": 74615,
345
+ "bytes": 591009169,
346
+ "spans": 95506,
347
+ "negs": 69708,
348
+ "seconds": 30.7
349
+ },
350
+ {
351
+ "shard": 28,
352
+ "files": 75692,
353
+ "bytes": 605563624,
354
+ "spans": 97319,
355
+ "negs": 71072,
356
+ "seconds": 30.9
357
+ },
358
+ {
359
+ "shard": 29,
360
+ "files": 74409,
361
+ "bytes": 585883347,
362
+ "spans": 95215,
363
+ "negs": 69672,
364
+ "seconds": 30.1
365
+ },
366
+ {
367
+ "shard": 30,
368
+ "files": 76437,
369
+ "bytes": 615154167,
370
+ "spans": 97399,
371
+ "negs": 71308,
372
+ "seconds": 31.1
373
+ },
374
+ {
375
+ "shard": 31,
376
+ "files": 74451,
377
+ "bytes": 583150261,
378
+ "spans": 95144,
379
+ "negs": 69710,
380
+ "seconds": 30.5
381
+ },
382
+ {
383
+ "shard": 32,
384
+ "files": 76588,
385
+ "bytes": 612105938,
386
+ "spans": 97796,
387
+ "negs": 71890,
388
+ "seconds": 31.7
389
+ },
390
+ {
391
+ "shard": 33,
392
+ "files": 74324,
393
+ "bytes": 593802594,
394
+ "spans": 95171,
395
+ "negs": 69476,
396
+ "seconds": 30.7
397
+ },
398
+ {
399
+ "shard": 34,
400
+ "files": 76786,
401
+ "bytes": 613622932,
402
+ "spans": 97776,
403
+ "negs": 71684,
404
+ "seconds": 32.0
405
+ },
406
+ {
407
+ "shard": 35,
408
+ "files": 74677,
409
+ "bytes": 597110242,
410
+ "spans": 95188,
411
+ "negs": 70120,
412
+ "seconds": 30.5
413
+ },
414
+ {
415
+ "shard": 36,
416
+ "files": 76331,
417
+ "bytes": 609250642,
418
+ "spans": 98390,
419
+ "negs": 71716,
420
+ "seconds": 31.8
421
+ },
422
+ {
423
+ "shard": 37,
424
+ "files": 74762,
425
+ "bytes": 594955850,
426
+ "spans": 95836,
427
+ "negs": 70273,
428
+ "seconds": 31.1
429
+ },
430
+ {
431
+ "shard": 38,
432
+ "files": 76982,
433
+ "bytes": 610517355,
434
+ "spans": 98714,
435
+ "negs": 72509,
436
+ "seconds": 31.3
437
+ },
438
+ {
439
+ "shard": 39,
440
+ "files": 73696,
441
+ "bytes": 590028866,
442
+ "spans": 94736,
443
+ "negs": 69389,
444
+ "seconds": 30.6
445
+ },
446
+ {
447
+ "shard": 40,
448
+ "files": 76805,
449
+ "bytes": 609629232,
450
+ "spans": 98720,
451
+ "negs": 72030,
452
+ "seconds": 31.3
453
+ },
454
+ {
455
+ "shard": 41,
456
+ "files": 73550,
457
+ "bytes": 585326200,
458
+ "spans": 94365,
459
+ "negs": 69266,
460
+ "seconds": 29.9
461
+ },
462
+ {
463
+ "shard": 42,
464
+ "files": 76799,
465
+ "bytes": 614933045,
466
+ "spans": 97931,
467
+ "negs": 71813,
468
+ "seconds": 31.4
469
+ },
470
+ {
471
+ "shard": 43,
472
+ "files": 74288,
473
+ "bytes": 602217237,
474
+ "spans": 95507,
475
+ "negs": 69735,
476
+ "seconds": 30.8
477
+ },
478
+ {
479
+ "shard": 44,
480
+ "files": 75757,
481
+ "bytes": 601638184,
482
+ "spans": 96573,
483
+ "negs": 70663,
484
+ "seconds": 31.0
485
+ },
486
+ {
487
+ "shard": 45,
488
+ "files": 74949,
489
+ "bytes": 601525609,
490
+ "spans": 95777,
491
+ "negs": 70890,
492
+ "seconds": 30.9
493
+ },
494
+ {
495
+ "shard": 46,
496
+ "files": 75268,
497
+ "bytes": 599280505,
498
+ "spans": 96724,
499
+ "negs": 70905,
500
+ "seconds": 30.7
501
+ },
502
+ {
503
+ "shard": 47,
504
+ "files": 75489,
505
+ "bytes": 602931158,
506
+ "spans": 96879,
507
+ "negs": 71273,
508
+ "seconds": 31.5
509
+ },
510
+ {
511
+ "shard": 48,
512
+ "files": 74391,
513
+ "bytes": 594166535,
514
+ "spans": 95069,
515
+ "negs": 69208,
516
+ "seconds": 30.7
517
+ },
518
+ {
519
+ "shard": 49,
520
+ "files": 76698,
521
+ "bytes": 614015269,
522
+ "spans": 98694,
523
+ "negs": 71601,
524
+ "seconds": 31.9
525
+ },
526
+ {
527
+ "shard": 50,
528
+ "files": 74692,
529
+ "bytes": 598207114,
530
+ "spans": 95501,
531
+ "negs": 69766,
532
+ "seconds": 30.6
533
+ },
534
+ {
535
+ "shard": 51,
536
+ "files": 76585,
537
+ "bytes": 611624465,
538
+ "spans": 98134,
539
+ "negs": 72022,
540
+ "seconds": 31.8
541
+ },
542
+ {
543
+ "shard": 52,
544
+ "files": 74806,
545
+ "bytes": 600973913,
546
+ "spans": 96834,
547
+ "negs": 70250,
548
+ "seconds": 31.4
549
+ },
550
+ {
551
+ "shard": 53,
552
+ "files": 76631,
553
+ "bytes": 612841824,
554
+ "spans": 98559,
555
+ "negs": 71658,
556
+ "seconds": 34.5
557
+ },
558
+ {
559
+ "shard": 54,
560
+ "files": 74826,
561
+ "bytes": 601986791,
562
+ "spans": 96578,
563
+ "negs": 70475,
564
+ "seconds": 34.8
565
+ },
566
+ {
567
+ "shard": 55,
568
+ "files": 76376,
569
+ "bytes": 617386650,
570
+ "spans": 97124,
571
+ "negs": 70941,
572
+ "seconds": 34.7
573
+ },
574
+ {
575
+ "shard": 56,
576
+ "files": 74130,
577
+ "bytes": 588567521,
578
+ "spans": 94804,
579
+ "negs": 69353,
580
+ "seconds": 34.3
581
+ },
582
+ {
583
+ "shard": 57,
584
+ "files": 76842,
585
+ "bytes": 607987857,
586
+ "spans": 98898,
587
+ "negs": 72404,
588
+ "seconds": 33.4
589
+ },
590
+ {
591
+ "shard": 58,
592
+ "files": 73896,
593
+ "bytes": 582690634,
594
+ "spans": 95103,
595
+ "negs": 69722,
596
+ "seconds": 31.6
597
+ },
598
+ {
599
+ "shard": 59,
600
+ "files": 75786,
601
+ "bytes": 598450116,
602
+ "spans": 96643,
603
+ "negs": 70497,
604
+ "seconds": 32.3
605
+ },
606
+ {
607
+ "shard": 60,
608
+ "files": 74908,
609
+ "bytes": 602315944,
610
+ "spans": 95900,
611
+ "negs": 70140,
612
+ "seconds": 31.8
613
+ },
614
+ {
615
+ "shard": 61,
616
+ "files": 75366,
617
+ "bytes": 595927576,
618
+ "spans": 96952,
619
+ "negs": 70353,
620
+ "seconds": 31.8
621
+ },
622
+ {
623
+ "shard": 62,
624
+ "files": 75704,
625
+ "bytes": 611601766,
626
+ "spans": 96670,
627
+ "negs": 71212,
628
+ "seconds": 32.6
629
+ },
630
+ {
631
+ "shard": 63,
632
+ "files": 74327,
633
+ "bytes": 585714976,
634
+ "spans": 95412,
635
+ "negs": 69829,
636
+ "seconds": 31.7
637
+ },
638
+ {
639
+ "shard": 64,
640
+ "files": 76282,
641
+ "bytes": 606543535,
642
+ "spans": 98099,
643
+ "negs": 71088,
644
+ "seconds": 32.6
645
+ },
646
+ {
647
+ "shard": 65,
648
+ "files": 74785,
649
+ "bytes": 595159622,
650
+ "spans": 96001,
651
+ "negs": 70460,
652
+ "seconds": 31.9
653
+ },
654
+ {
655
+ "shard": 66,
656
+ "files": 76346,
657
+ "bytes": 608772572,
658
+ "spans": 98414,
659
+ "negs": 71761,
660
+ "seconds": 32.6
661
+ },
662
+ {
663
+ "shard": 67,
664
+ "files": 74886,
665
+ "bytes": 599251778,
666
+ "spans": 95727,
667
+ "negs": 69488,
668
+ "seconds": 31.8
669
+ },
670
+ {
671
+ "shard": 68,
672
+ "files": 76642,
673
+ "bytes": 618080826,
674
+ "spans": 98144,
675
+ "negs": 72136,
676
+ "seconds": 31.9
677
+ },
678
+ {
679
+ "shard": 69,
680
+ "files": 74923,
681
+ "bytes": 599414961,
682
+ "spans": 96044,
683
+ "negs": 69684,
684
+ "seconds": 30.8
685
  }
686
  ]
687
  }