Datasets:
Modalities:
Text
Formats:
json
Languages:
English
Size:
10K - 100K
Tags:
cybersecurity
defensive-security
detection-engineering
incident-response
threat-intelligence
vulnerability-management
License:
|
Download research/DECISIONS_LOG.md from ansulev/HolyCyber-Dataset: direct link, hf CLI and curl.
- Browser
- Download file 24.6 kB
-
https://huggingface.co/datasets/ansulev/HolyCyber-Dataset/resolve/main/research/DECISIONS_LOG.md
- Command line
-
hf download hf://datasets/ansulev/HolyCyber-Dataset/research/DECISIONS_LOG.md
-
curl -L -o DECISIONS_LOG.md https://huggingface.co/datasets/ansulev/HolyCyber-Dataset/resolve/main/research/DECISIONS_LOG.md
24.6 kB
| # Decisions log — HolyCyber dataset | |
| The plan asks that every choice (source, filter, label rule, split) is written | |
| down so another person can reproduce the dataset. This is that log. Each | |
| entry states the decision, why it was taken, and what it cost. | |
| --- | |
| ## D1 — Task and threat model (step 1) | |
| **Decision.** The deliverable is an instruction-tuning corpus for a *defensive* | |
| cybersecurity assistant. One row = one entity of one domain, asked one | |
| question, answered with a long-form grounded briefing of at least 2,000 tokens | |
| (user + assistant, `cl100k_base`). | |
| **Why.** The brief asks for "every point of cybersecurity", a 2,000-token floor | |
| and at least 1,000 (now 2,000) rows per domain. A per-entity briefing is the | |
| only row shape that can reach 2,000 tokens without padding a fact with | |
| invented text: the framework records themselves are that long. | |
| **Metric.** Row count per domain, token floor per row, duplicate rate, | |
| decontamination rate, split integrity. No accuracy metric — the dataset is | |
| not a classifier training set. | |
| --- | |
| ## D2 — Layering: one dataset per domain (step 2, 8) | |
| **Decision.** The corpus is partitioned into 17 datasets, one per taxonomy | |
| domain (`scripts/taxonomy.py`), each built from its own sources only, plus a | |
| global dataset that is their concatenation. | |
| **Why.** A user asked for one focused dataset per domain with the others | |
| frozen. It also makes the coverage auditable: `dataset/layers/INDEX.md` shows | |
| rows, groups, splits and tokens per domain, and a domain that is thin is | |
| visible rather than hidden inside a global average. | |
| **Cost.** The same framework record (an ATT&CK technique, a CWE) appears in | |
| several domains, because a technique is simultaneously a threat, a detection | |
| opportunity, a mitigation and a pentest step. Each appearance is a different | |
| question; the *source text* is shared, the *rows* are not. | |
| --- | |
| ## D3 — How a domain reaches 2,000 rows without inventing anything | |
| Three mechanisms, in order of how much new material each contributes: | |
| 1. **Task shapes** (`scripts/shapes.py`). One record, up to 11 different | |
| defensive questions asked of it: what it is, where it sits in the framework, | |
| who uses it, how it nests in the tree, how to detect it, how to mitigate it, | |
| what it needs as a precondition, how it maps to other frameworks, which | |
| weaknesses it relates to, what follows from it, what the code looks like. | |
| Each shape is built from a *disjoint* set of sections of that record, so two | |
| shapes never repeat the same text. | |
| 2. **Reference pack.** A record too short to fill a 2,000-token row is topped | |
| up with compact descriptions of other entities *of the same domain*, taken | |
| from that domain's own source text. The window rotates per row, so two | |
| rows never carry the same padding. | |
| 3. **More sources** (step 2). For the domains the existing corpus cannot | |
| carry, new public material is fetched and parsed (see `SOURCE_TABLE.md`). | |
| **Guard against duplication.** A shape is only emitted if its sections are | |
| *not* already present in the entity's base rows (`shapes.build_shape_rows` | |
| drops any section whose normalised text already appears in the base cell). A | |
| record that is entirely covered by its base row therefore produces one row, not | |
| five copies of the same paragraph. | |
| **Measured result.** 70–98 % of a row's tokens are the entity's own content; | |
| the rest is the shared index material. Across the whole corpus no two rows | |
| share an answer (checked by `scripts/verify_layers.py`). | |
| --- | |
| ## D4 — Decontamination happens at entity level (step 5) | |
| **Decision.** Before a domain is built, every entity is checked against the | |
| benchmark corpora in `decontam/`: a 25-word shared span, or a CVE id the | |
| benchmark uses, disqualifies the entity. Disqualified entities are dropped | |
| and never enter the reference pack. | |
| **Why.** The first version filtered *rows* only, after packing. A clean row | |
| was then dragged into the benchmark by its own padding — the pack was full of | |
| records that the benchmark also contains — and 40–60 % of the rows in the | |
| KEV-heavy domains were thrown away for text that had nothing to do with the | |
| row's subject. Filtering entities first makes the pack clean by construction | |
| and the loss is limited to the entities that genuinely appear in the benchmark. | |
| **Cost.** The KEV entities that the benchmark also lists are gone from the | |
| `vulnerability_management` layer. That is the intended behaviour of the rule | |
| (the benchmark must not be trained on), and the loss is recorded per layer in | |
| `build/layers/stats.json`. | |
| --- | |
| ## D5 — Duplicates are removed before splitting (step 5) | |
| **Order:** parse → quality gate → exact duplicate removal → near-duplicate | |
| removal (MinHash-LSH, 5-word shingles, 112 permutations, 14 bands, Jaccard | |
| ≥ 0.90, compared **within a task type only**) → decontamination → split. | |
| **Why.** The plan is explicit: "remove exact and near-duplicate rows *before* | |
| splitting, so copies cannot land on both sides". Comparing only within a | |
| task type is deliberate — a detection row and a mitigation row about the same | |
| entity answer different questions and are not duplicates of each other. | |
| **Global merge.** After the layers are built, the global dataset drops rows | |
| whose answer already appears in another layer, and re-cuts the split on | |
| `group_key` across the whole corpus. Result: 0 duplicate ids, 0 repeated | |
| answers, 0 groups spanning two splits. | |
| --- | |
| ## D6 — The split is by source, not at random (step 6) | |
| **Decision.** The split unit is `group_key` — the source entity (an ATT&CK | |
| technique, a CWE, a KEV entry, a Sigma rule, a paper, a document). All rows | |
| about one entity land in the same split. | |
| **Why.** This is "split by source" from the plan's checklist, and it is the | |
| only split that is meaningful for a corpus of framework records: a random | |
| split would put the same technique's detection row in train and its mitigation | |
| row in test, which is exactly the leakage the plan warns about. | |
| **Time split.** The plan asks for a time split where the data has a time axis. | |
| The framework corpora (ATT&CK, CWE, CAPEC, D3FEND, ATLAS, KEV, Sigma) are | |
| versioned catalogues, not a time series, so there is no time axis to cut on; | |
| the "vintage" of each record is carried in the row metadata instead. The | |
| paper corpus does have a time axis (arXiv versions), and its rows are split by | |
| paper, so a paper's sections never straddle the split. | |
| **Test set.** Locked: the split is computed once from `group_key` with a | |
| fixed seed (1337) and every transform (dedup, decontamination, quality) runs | |
| *before* it. | |
| --- | |
| ## D7 — Labels come from the source, not from a model (step 4) | |
| **Decision.** Every row's answer is either a verbatim section of a source | |
| record or a deterministic re-assembly of such sections. No row is written by | |
| a language model; there is no model in the pipeline at all. | |
| **Ground-truth check.** `scripts/validate_ground_truth.py` re-derives the | |
| source text for a sample of rows and measures how much of each answer is | |
| present in that source. The result is reported in `research/GROUND_TRUTH.md`. | |
| **Uncertain bucket.** Nothing in the corpus is inferred: a weakness with no | |
| stated consequence produces a row about what the catalogue *does* state, and | |
| the `CWE` "not specified" fields are rendered as "not specified" rather than | |
| guessed. | |
| --- | |
| ## D8 — No synthetic data, no attack generation (step 3) | |
| **Decision.** The plan allows generating data in an isolated lab, and names | |
| generators (NetSecBed, LMDG, MalDataGen). This dataset contains **no | |
| generated or synthetic rows**: every row is a quote of a public source. | |
| **Why.** The owner controls no lab, and generated attack traffic would have to | |
| be labelled by a log the plan itself has to be trusted on. Everything here is | |
| traceable to a cited public document, which is the stronger property. | |
| **Consequence.** The plan's stage 7 ("validate on a second, independent | |
| dataset") is answered differently: the second dataset is the *source* — every | |
| row is checked against the record it claims to come from — rather than another | |
| lab's captures. | |
| --- | |
| ## D9 — Privacy and secrets (step 5) | |
| **Decision.** The corpus is built from public framework catalogues and public | |
| standards. CISA KEV entries name products and CVE ids, which are public | |
| vulnerability metadata, not personal data. No credentials, keys, personal | |
| names, or real IP addresses are present in the sources, and nothing is | |
| synthesised into them. The decontamination filter also drops any row that | |
| mentions a benchmark CVE id. | |
| **Personal data.** The paper corpus is the one place where author names | |
| appear; they are part of the scholarly record and are not removed (removing | |
| them would corrupt the citation). No email addresses, affiliations of private | |
| individuals, or dataset content of private citizens is included. | |
| --- | |
| ## D10 — Defensive framing (plan's "stay defensive and isolated") | |
| **Decision.** Rows describe how to *detect, prevent, scope and remediate*. | |
| They contain no functional exploit code, no malware, no weaponised jailbreak | |
| prompts, and no operational attack tooling. Where a row names an attack | |
| technique, the answer is about the defender's side of it. | |
| **The pentest layer** is the one that needs care: its questions are about | |
| *authorised* testing ("how do I validate this in an authorised engagement, and | |
| what evidence does the report need?"), and the answers are the technique's | |
| own defensive record. No exploitation procedure is written. | |
| --- | |
| ## D12 — Expanding the corpus to reach 2,000 rows per domain (step 2) | |
| **Decision.** The corpus was grown from 82 papers to **2,700+ documents**: | |
| 2,383 arXiv preprints, 81 IETF RFCs, 137 OWASP cheat sheets and 45 NIST | |
| publications. Every fetch is logged in `research/fetch_manifest.csv` with its | |
| url, retrieval date and licence. | |
| **Why.** At the 1,000-row target the corpus was adequate. At 2,000 rows per | |
| domain it was not: the framework catalogues alone give 3,000-8,000 rows in the | |
| deep domains and 150-200 in the thin ones, and the only honest way to close a | |
| 2,000-row gap is more source material. The arXiv API was queried per domain | |
| (`scripts/fetch_sources.py`), and each paper's *sections* are routed to the | |
| domain its content is about — a jailbreak-defence section lands in | |
| `safety_boundary`, an evaluation-protocol section in | |
| `ml_security_methodology` — so the new material lands where it belongs | |
| instead of piling up in one domain. | |
| **Rejected instead:** paraphrasing the framework records into more rows. It | |
| produces rows that read like more data but say the same thing, which is | |
| exactly the duplication the brief forbids. | |
| **Cost.** 137 MB of source text, ~2,400 HTTP requests, and a corpus that is | |
| now dominated by paper-derived rows in the AI, methodology and safety domains. | |
| Those rows are quoted verbatim from the paper and carry its arXiv id in | |
| `references`, so the citation chain is intact. | |
| --- | |
| ## D13 — Papers carry only the sections their domain owns | |
| **Decision.** A paper usually contributes sections to several domains. When a | |
| domain builds its rows, the paper's "record" is built from *that domain's own | |
| rows* for that paper, not from the whole file. | |
| **Why.** The first implementation used the whole paper as the padding pool, | |
| which meant the same paragraph appeared in the `ai_ml_security` layer and the | |
| `safety_boundary` layer with two different questions. That is duplication | |
| across the corpus, and the global merge was dropping 2,070 rows because of it. | |
| **Cost.** A paper's rows are now its own sections plus padding from the same | |
| domain's other sections — slightly less context per row, and no repeated text | |
| between domains. | |
| --- | |
| ## D11 — Versioning and reproduction (step 8) | |
| **Decision.** The dataset is versioned (`dataset/VERSION`), every layer has a | |
| datasheet (`dataset/layers/<domain>/DATASET_CARD.md`), the global dataset has | |
| one (`dataset/DATASET_CARD.md`), and the whole corpus is rebuilt by: | |
| ``` | |
| python scripts/domains.py # parse -> compose -> gates -> split -> write | |
| python scripts/verify_layers.py # independent verification | |
| python scripts/validate_ground_truth.py | |
| ``` | |
| The build is deterministic (seed 1337) and resumable: a layer that already | |
| exists in `build/layers/stats.json` is skipped unless `FORCE=1` is set. | |
| **Source audit trail.** Every fetched document is recorded in | |
| `research/fetch_manifest.csv` with its url, retrieval date and licence, and | |
| `research/SOURCE_TABLE.md` is generated from it. | |
| --- | |
| # Audit round (v2.1.0) | |
| Version 2.0.0 met every structural requirement (17 layers, 52,856 rows, floor, | |
| splits, no benchmark overlap) and still read badly. An independent audit | |
| (`scripts/audit_dataset.py`) measured what the builder could not see about its | |
| own output. The findings and their fixes are recorded here and in | |
| `research/AUDIT_REPORT.md`. | |
| ## D14 — The audit is a separate, replayable stage | |
| **Decision.** Auditing is a first-class stage with its own code path | |
| (`core`, `dup`, `meta`, `contam`), not an assertion inside the builder. It | |
| re-reads the written files and reports counts and examples. | |
| **Why.** The builder checks what it enforces (floor, ids, splits). It cannot | |
| see, for example, that 80% of rows repeat a heading, because no rule forbids it. | |
| The audit found defects the build had no concept of. | |
| ## D15 — Questions are built from core sections only | |
| **Decision.** The bullet list in the user question is drawn only from the | |
| entity's own sections. When a row needed the reference appendix, the question | |
| says so in one sentence instead of listing the appendix headings. | |
| **Why.** In v2.0.0 the question enumerated every heading of the answer, | |
| including the 5–8 appendix records. 80% of rows asked a question that was | |
| partly "summarise these unrelated records", and the bullet list leaked the | |
| padding. Two rows of one domain could also share a user text. | |
| **Cost.** Padded rows now carry one extra sentence, which is a modest amount of | |
| additional text and is true: the appendix is requested, not disguised. | |
| ## D16 — One labelled block per reference entity | |
| **Decision.** A reference-pack entry is flattened into a single block | |
| (`## Reference: <name>`); nested headings become bold labels inside it. | |
| **Why.** The pack used to paste the neighbour record with all its headings, so a | |
| row could contain `## Aliases` twice, or a heading followed by one word (62,981 | |
| near-empty sections in v2.0.0). A reader could not tell answer from appendix. | |
| ## D17 — A document is parsed once | |
| **Decision.** `parse_papers.py` accepts only arXiv ids; RFCs, OWASP sheets and | |
| NIST publications go through `parse_docs.py` only. | |
| **Why.** 675 rows were produced by parsing a document a second time as if it | |
| were a paper (`paper:nist_...`), with a different question. That inflated the | |
| row count and duplicated text across two entities. | |
| ## D18 — A reference must resolve | |
| **Decision.** `common.norm_reference()` normalises every reference: a bare or | |
| `arXiv:` id becomes `https://arxiv.org/abs/<id>`; strings that are not URLs are | |
| dropped. | |
| **Why.** 12,015 rows carried `arXiv:2401.01234`-style strings (and malformed | |
| ones such as `arXiv:rfc9000`) in a field a consumer would try to dereference. | |
| ## D19 — Difficulty follows the task, not the parser | |
| **Decision.** `dossier.difficulty_for()` maps task types to a level | |
| (definition/identification → beginner, mapping/analysis → advanced, | |
| review/remediation → intermediate). | |
| **Why.** v2.0.0 was 0.3% beginner, 47% intermediate and 53% advanced because | |
| each parser passed its own constant. A beginner asking for a definition got an | |
| "advanced" row. | |
| ## D20 — The corpus is cleaned at the boundary | |
| **Decision.** `common.clean()` decodes HTML entities twice, unwraps LaTeX text | |
| commands, removes `\ref`/`\cite`/`\begin`, joins PDF hyphenation, and drops | |
| U+FFFD, zero-width and control characters. `parse_papers.py` removes the arXiv | |
| landing-page block (title, stamp, authors, affiliations, thanks), repeated page | |
| furniture and bibliographies. `parse_docs.py` removes the per-page RFC header | |
| and footer. | |
| **Why.** The audit found the arXiv stamp inside answers, `\url` fragments, | |
| `<` in prose, `[Page 5]` running footers, U+FFFD in 140 rows and mojibake. | |
| ## D21 — Every corpus file has provenance | |
| **Decision.** `scripts/fix_manifest.py` removes the duplicate copies of papers | |
| that were fetched both under a bare id and a versioned id, and adds a manifest | |
| row for every file that lacked one. The manifest is now exactly one row per | |
| corpus file. | |
| **Why.** 17 papers were parsed twice (16 byte-identical) and 65 files had no | |
| provenance row, so a row's `license` field could not be traced. | |
| ## D22 — A long cell is delivered in numbered parts | |
| **Decision.** When one cell is split into several rows, each question says | |
| "This is part N of M". | |
| **Why.** The chunks of one cell shared an identical user text (2,331 rows in the | |
| v2.1 draft), so a consumer would see the same question with different answers. | |
| ## D23 — Reuse is measured, not denied | |
| **Decision.** Each layer card reports the share of a row's tokens that is the | |
| entity's own material, and the appendix is always labelled. The README no | |
| longer claims a quotation percentage that was never measured. | |
| **Why.** With a 2,000-token floor, 2,000 rows per domain and a source corpus | |
| only about twice the size of the output, some text must be reused. The honest | |
| answer is to make the reuse visible and measure it, not to claim it does not | |
| happen. | |
| ## D24 — Four defects the audit found, fixed at the source | |
| **Decision.** The v2.2 build fixes four classes of defect rather than patching | |
| the files: | |
| 1. A heading that occurs twice inside one answer is marked as a continuation | |
| (`## Introduction (continued)`), because a repeated heading reads like a build | |
| error. | |
| 2. Structural labels (`Answer`, `Context`, `Role note`, `Direct answer`) are no | |
| longer used as question bullets: asking a model to "cover Answer" is noise. | |
| 3. A block larger than the row ceiling is split at sentence boundaries, not at a | |
| token boundary, so a row does not end mid-sentence. | |
| 4. Two cells of one entity that share a question now get an explicit `Angle:` | |
| line naming the cell's subdomain and task — a duplicate question in an | |
| instruction set is a defect even when the answers differ. | |
| Publisher stamps (`©`, `ISBN`, `ISSN`) are stripped from paper text, and | |
| U+FFFD/mojibake residue is removed as a final pass. | |
| **Second pass (same version).** Re-reading the written rows found four more, so | |
| the fix is bigger than the first list: | |
| 5. A structural label was also used as a *heading*: 6,476 rows opened with | |
| `## Answer`, `## Context` or `## Role note`. The renderer now renames the two | |
| that carry meaning (`Answer`/`Direct answer` → `Summary`, `Context` → | |
| `Background`, `Role note` → `Scope note`) and drops the rest. A shaped row | |
| now opens with `## Summary` instead of a bare framing sentence. | |
| 6. A trailing fragment of at most 25 words with no sentence end is dropped | |
| (`_trim_tail`). Paper text arrives from PDF extraction and can stop | |
| mid-sentence or on a figure caption; the checker went from 38 % of rows in a | |
| paper layer to 5 %, and the remainder is table rows, citations and page | |
| numbers. | |
| 7. Duplicate questions are handled where they occur: within a layer, at the | |
| entity (not the cell) level, with an `Angle:` line that names the subdomain, | |
| the task and the entity; across layers, the global merge drops the second | |
| copy. A question is unique in the delivered dataset. | |
| 8. A one-word section (`## Platforms` / `Windows`) is not an empty section — | |
| only `n/a`-style bodies are. The audit's definition was corrected rather | |
| than the data. | |
| **What this cost.** Four full rebuilds (each ~20 minutes) and the audit re-run | |
| with them. What it bought is measurable in `research/AUDIT_REPORT.md` §2.13 and | |
| §5. | |
| ## D25 — Reviewing a comparable public dataset, and taking only its presentation | |
| **Decision.** `Vyber07/cyber-security` (gated, ~95 GB, Apache-2.0, 5,203 | |
| downloads/month) was reviewed structurally. Its data organisation was **not** | |
| adopted: 264 of 965 files carry a `__dup` marker, the same file is stored at the | |
| root and in a per-domain folder, there are no train/val/test splits, no | |
| per-record provenance, and the licence is asserted over scraped text it cannot | |
| cover. | |
| What was adopted is its **notation**: a per-domain card that opens with an | |
| overview and a coverage table, an explicit record format with a JSON example and | |
| a field table, a "what a record contains" section, a sources table, a statistics | |
| table, a usage section, and a licence section. This dataset adds what that one | |
| lacks: verified splits, measured duplication, per-row provenance and a | |
| limitations section. See `research/EXTERNAL_REVIEW.md`. | |
| **Why.** Presentation is what makes a dataset readable; substance is what makes | |
| it usable. Copying the first without the second is how a 95 GB file dump gets | |
| 5,203 downloads a month, and copying neither is how a good dataset stays | |
| unread. | |
| ## D26 — Measuring four public cyber instruction datasets, and adopting metadata not prose | |
| **Decision.** Four public sets were downloaded in full and measured | |
| (`scripts/external_compare.py`, results in `build/external/compare.json`): | |
| Trendyol (53,201 rows), Fenrir (99,870), Kimi (997), WhiteHatMom (2,040). The | |
| fifth proposed link, `cyberagent/crello`, is a graphic-design dataset and was | |
| excluded. | |
| What was **adopted**: per-row measured metadata (`tokens`, plus `core_share` and | |
| `appendix` that are specific to this design), a dated changelog, a | |
| `## Using the metadata` section with filter and mask snippets, and rendered sample | |
| rows (`dataset/SAMPLES.md`). What was **rejected**: LLM-distilled reasoning | |
| traces without a source (Kimi), instruction-hierarchy override prompts (Kimi), | |
| slot-filled question templates (Fenrir: 9,214 duplicate questions), literal | |
| `\n` stored as text (95.4% of Trendyol, 91.2% of Fenrir), split claims that the | |
| files do not contain (Trendyol), and blanket Apache-2.0 over harvested text. | |
| **Why.** The measurements show the two largest sets are one lineage: every one of | |
| Trendyol's 52,526 unique questions appears in Fenrir, so training on both | |
| double-counts them while appearing to offer 153k rows. Copying their prose would | |
| copy their defects; copying their *presentation* and adding measurements is what | |
| makes this dataset checkable. Verbatim paragraph overlap between HolyCyber and | |
| all four is 0, which rules out text-level contamination in either direction. | |
| ## D27 — Repairing text after a build: id, stats and metadata must move together | |
| **Decision.** A post-build text repair (`scripts/fix_part1_phrase.py`, 2,073 | |
| global rows that said "part 1 of N ... continuing where the previous part | |
| stopped") recomputes the row `id` (it hashes user + assistant), then | |
| `scripts/add_row_metadata.py` recomputes `tokens` / `core_share`, then | |
| `scripts/recompute_stats.py` recomputes the aggregates in `build/stats.json` and | |
| `build/layers/stats.json`, then cards and README are re-rendered. | |
| **Why.** Without the id recompute the content hash would silently lie; without | |
| the stats recompute the cards would keep reporting the pre-repair token total | |
| (127,661,406) and floor. The measured post-repair figures are 51,805 rows / | |
| 127,643,325 tokens / min 2,050 / 0 rows under the floor. | |
| ## D28 — A question must not name a section the answer does not cover | |
| **Decision.** The document lead read "The section "1. Introduction" is the part | |
| I need", but a long document is split into parts: 1,010 part rows carried that | |
| pointer and 971 of them named a section the part does not start with (105 named | |
| page furniture such as `100 Bureau Drive`). The pointer is now removed for part | |
| rows (builder: `dossier.lead_for_part`; written files: | |
| `scripts/fix_lead_section.py`, 2,020 rows including layer copies, ids | |
| recomputed). Quoting the part's own first heading was tried and rejected: the | |
| headings are often resource-record dumps, so it would swap one wrong pointer for | |
| another. | |
| **Why.** A wrong pointer is worse than no pointer: it tells the reader to check | |
| a section the answer is not about, and it is the kind of defect that survives a | |
| token-floor check because it does not change length. The bullet list already | |
| names the headings the part covers. | |
| **Known residue.** The same parsing weakness still turns a few RFC record dumps | |
| into headings and question bullets; fixing it needs a page-furniture filter in | |
| the document parser and is listed as open in `research/AUDIT_REPORT.md` (2.14). | |