Zreby's picture
Update public dataset card
47a4cc2 verified
|
Raw History Blame Contribute Delete
6.01 kB
metadata
pretty_name: NIST C/C++ Security Samples
tags:
  - code-security
  - secure-coding
  - C
  - C++
  - NIST
  - SARD
  - Juliet
size_categories: 1K<n<10K

NIST C/C++ Security Samples

This public dataset repository contains two related exports derived from the official NIST SARD Juliet C/C++ 1.3 test suite. “Juliet” identifies the source provenance, not the repository name. The original source subset is preserved at the repository root; a function-labeled pilot and its review and split artifacts are in labeled/. The code is synthetic test code, not production code. No sample was compiled or executed during preparation.

Dataset versions and files

Original source subset (repository root)

juliet_samples.jsonl and sample_index.csv contain 960 source files: the first 80 eligible files for each of 12 CWE families in upstream ZIP order. The selection is deterministic, not randomized, and is not representative of the full Juliet suite or of C/C++ code generally. The source records have split: unassigned; a CWE folder is not a file-level vulnerable/benign label. manifest.json records source and output checksums and preparation checks.

Labeled pilot (labeled/)

This is a function-level annotation derived from the same 960-file pilot; the root-level source export was not replaced.

File under labeled/ Contents
juliet_functions_labeled.jsonl Recommended supervised-learning table: one row per labeled function, with good or bad label and an explicit group split.
juliet_files_labeled.jsonl Source-file records with group/split metadata and observed function labels; file_label is null by design.
juliet_functions_review.jsonl Partial helper functions intentionally left unlabeled for review.
juliet_label_review.csv Files with partial helper roles or no confidently labeled function.
group_assignments.csv Auditable assignment of normalized Juliet case families to splits.
split_summary.csv File and labeled-function counts by CWE and split.
manifest.json Source checksum, annotation and split policies, counts, quality checks, and output checksums.
README.md Usage notes and details for the labeled pilot.

The labeled pilot contains 2,759 labeled function rows and 758 review-only helper-function rows. 233 files have no confidently labeled function. File-level summaries are 463 mixed, 232 good-only observed, 32 bad-only observed, and 233 with no confident function label. A file can contain multiple functions, so function rows are not independent observations.

Split Files Good functions Bad functions Mixed files Files without confident labels
train 672 1,562 341 317 171
validation 144 332 75 71 32
test 144 370 79 75 30

Files and functions are grouped by Juliet case family to reduce leakage. Families are assigned separately within each CWE to approximate a 70/15/15 file-count target; indivisible groups can make exact totals differ from those targets. No family is split across train, validation, and test.

Load the public data

The repository is public, so no Hugging Face authentication is needed to load it:

from datasets import load_dataset

source = load_dataset(
    "Zreby/nist-c-cpp-security-samples",
    data_files="juliet_samples.jsonl",
    split="train",
)

functions = load_dataset(
    "Zreby/nist-c-cpp-security-samples",
    data_files="labeled/juliet_functions_labeled.jsonl",
    split="train",
)
train = functions.filter(lambda row: row["split"] == "train")
validation = functions.filter(lambda row: row["split"] == "validation")
test = functions.filter(lambda row: row["split"] == "test")

Labels and limitations

Labels are based only on explicit Juliet function or class role names, not on the parent CWE directory. Terminal bad / _bad role tokens map to bad; terminal good, goodG2B, and goodB2G tokens map to good. In C++ cases, a class role can label its action method. These are Juliet's intended path labels, not proof that real-world code is exploitable or secure.

Partial helpers such as badSink, goodG2BSink, badSource, and goodB2GSource are not forced into a binary label because their function body alone may not reveal the end-to-end path. In the file-level JSONL, file_label is null by design; file_label_summary (mixed, good_only_observed, bad_only_observed, or no_confident_function_label) is descriptive, not a training target.

The extractor is a lightweight source-text scanner, not a C/C++ AST or compiler; unusual declarations may be missed, so unresolved cases should be reviewed before expanding the set. Function identifiers and inline FLAW / FIX comments may reveal labels. For model evaluation, remove or normalize such cues in a separate derived copy while retaining provenance. Results on this pilot alone do not establish detection capability or system security. Do not compile, execute, or deploy the samples outside a properly isolated test environment.

Source and rights

The complete upstream archive is not included. Source: NIST SARD Juliet C/C++ 1.3 — test suite 112. See also NIST SARD acknowledgements and test suite descriptions.

NIST's notice identifies material for which NIST holds the rights as public domain in the United States; outside the United States, CC0 1.0 applies only to the extent that NIST holds the relevant rights. This does not establish that every component or third-party-provenance item in this repository is covered by those terms. Preserve applicable notices and review relevant third-party provenance and rights before redistribution or other use. This card does not claim unconditional CC0 coverage for the entire dataset.