Skip to content

What sourceledger's checks establish

sourceledger helps a researcher connect a built file to a recorded download and notice changes. Its checks establish consistency between files and records you trust. They do not establish that a publisher's data is correct, that a record is authentic, or that you have permission to publish the data.

This page explains the case for those checks. Safe use gives the instructions, and architecture explains the files and stages.

What you must trust

Review the manifest and the code that runs it. The manifest chooses URLs, local files, credentials by environment-variable name, reuse terms and optional checksum pins. A custom reader is Python code with the same access as the process. Neither is sandboxed.

The working directory and the machine must be under your control. Another process that can rewrite both data and records can replace the evidence. A checksum is not a signature. Keep the manifest and fetch log in version control, and review changes to them.

Dataset recipients must obtain datapackage.json from a source they trust. An attacker who replaces both that descriptor and its files can produce matching checksums. Software release attestations authenticate the sourceledger distribution; they do not sign your dataset or its fetch records.

Claims and evidence

The evidence below is executable regression coverage in tests/test_manifest.py, tests/test_ledger.py, tests/test_fetcher.py, tests/test_builder.py, tests/test_report.py, tests/test_releaser.py and tests/test_golden.py. It supports the stated behavior; it is not an independent security certification.

Claim Safeguard Regression evidence
A fixed source can be tied to expected bytes. Fetch, build and validate check a declared SHA-256 pin; build also re-hashes the raw file against its record. test_fetch_refuses_bytes_that_miss_the_pinned_sha256, test_build_checks_the_pin_too, test_validate_rehashes_the_raw_file
A revision can be detected without silently accepting an old output. Fetch logs changed bytes. Validate compares output provenance with the current fetch record and checks package hashes. test_validate_catches_a_stale_data_package, test_the_whole_pipeline_runs_from_a_local_file
A public server cannot redirect a direct connection into a private service. The connection checks the actual peer before sending the redirected request. test_a_redirect_to_a_name_that_rebinds_inward_is_refused, test_the_peer_check_refuses_a_loopback_peer_over_tls
Redirects do not forward manifest credentials to another origin. A change of scheme, host or port drops the extra headers. Header values come from the environment and are omitted from records. test_a_redirect_to_another_host_drops_the_credentials, test_a_redirect_to_plain_http_on_the_same_host_drops_the_credentials, test_a_header_comes_from_the_environment
Downloads have bounded body size and a checked time budget. Streaming reads enforce max_bytes; socket waits and retry waits use the remaining timeout_s. Redirect bodies are closed without draining. test_fetch_refuses_a_download_over_the_size_cap, test_a_server_trickling_bytes_is_stopped_near_the_budget, test_source_timeout_includes_retry_waits, test_redirects_do_not_need_the_redirect_response_body
A failed write does not expose a partially written replacement file. A fresh temporary file is flushed and renamed into place. Fetch serializes writers with a lock, logs before writing the record and recovers a cut-off last log line. test_a_failed_write_raises_its_own_error_and_leaves_no_temp_file, test_a_cut_off_last_log_line_is_dropped_not_fatal, test_a_whole_last_log_line_without_its_newline_is_kept
A recipient can check a package without fetching its sources. Verify checks listed files against size and SHA-256, and refuses paths that escape the dataset folder, including through symlinks. test_verify_checks_a_published_dataset_against_its_package, test_verify_reports_a_package_it_cannot_check
A provenance report can be read offline without executing displayed metadata. Standalone HTML escapes metadata, omits raw values and headers, redacts HTTP URL credentials, queries and fragments, and blocks remote assets and scripts. Free text and URL paths still need review before sharing. test_report_escapes_metadata_and_omits_credentials, test_report_displays_the_built_metadata_and_security_policy, test_report_does_not_echo_credentials_from_an_invalid_file_url
A file another tool downloaded is held to the same rules as a fetch, and marked as such. record copies the file into data/raw/, checks the pin under the fetch lock, refuses credentials in the URL, and writes the log line and record through the code fetch uses. The record keeps recorded_at, and states no download time unless one is given. Validators from another URL are not kept. test_a_recorded_file_builds_like_a_fetched_one, test_record_refuses_what_it_cannot_record_honestly, test_record_states_no_download_time_it_was_not_given, test_a_recorded_file_verifies_and_reads_back
A release folder holds no file from a source marked redistribute = false. release takes the file list from sources.toml, not from the folder. It then hashes every file written and refuses the bytes of a restricted raw file or output under any name. The validators run with python -I, so code planted in the folder does not run. test_a_restricted_source_never_reaches_the_release, test_flipping_redistribute_after_build_keeps_the_file_out, test_the_hash_pass_refuses_restricted_bytes_under_any_name, test_the_hash_pass_holds_when_the_file_list_ships_everything, test_check_runs_no_code_planted_in_the_folder
Records, logs, packages and reports keep their format, and a 0.4.0 project still reads. Golden files pin each written format byte for byte. A project written by 0.4.0 validates and rebuilds to the same bytes. A fetch over it writes the same record keys. test_a_full_dataset_matches_its_goldens, test_a_minimal_dataset_matches_its_goldens, test_a_0_4_0_project_validates_and_rebuilds_unchanged, test_a_fetch_over_a_0_4_0_project_writes_the_0_4_0_format
The same input records give repeatable build outputs. Build writes no current timestamps into outputs or package metadata. test_the_same_records_build_the_same_package, test_the_package_is_written_exactly

Where these claims stop

  • Network: HTTPS uses Python's certificate checks. HTTP has no transport authenticity. The inward-redirect peer check is skipped through proxies; apply network restrictions at the proxy. Initial manifest URLs may deliberately point to internal or local files.
  • Resources: DNS resolution and HTTP header parsing can exceed the fetch budget. The size cap is not a process-memory limit. JSON, Excel and custom readers can hold the data and parsed rows in memory. Parquet writing and validation use row batches, but wide rows, metadata and encoded dictionaries can still need substantial memory. See download behavior and table output formats.
  • Writes: Atomic replacement covers one file, not a whole fetch or build. A stopped run can leave files from different stages; run validate before using its output. Do not run build and fetch concurrently. These checks do not defend against a hostile local process changing files while they are being checked.
  • Meaning: Validate checks recorded provenance and file integrity. It does not recompute the scientific result or prove that a custom reader used the input correctly. Domain checks belong in the consuming project's tests.
  • Permission: Reuse terms and redistribute are declarations supplied by the manifest's author. Local builds may contain restricted files. Passing validation or verification grants no publication permission. Review the terms for both raw files and derived values.

Check the evidence

Run just check for the tests, types, lint and dependency audit. Run just py-mutation for the full mutation check against the recorded survivor baseline; coverage alone does not show that every incorrect implementation would be detected.

Dependencies are covered in how dependencies are chosen and the dependency policy. The release workflow tests the source and the built wheel before it publishes. Release verification explains the attestations and the reproducible-build check.

Report a suspected vulnerability through the private reporting process.