# OIP-0032: Detached evidence sidecars for scientific files: CF-NetCDF, WMO BUFR edition 4, miniSEED 3, RINEX 3 and 4

| Field | Value |
|---|---|
| Status | DRAFT |
| Function | `admit` (§5.2), `exchange` (§5.10) and `prove` (§5.11); no new function (the register keeps exactly twelve) |
| Uses | OIP-0008 (the signature envelope, the `observation` object class and the draft `key-record`) as a draft: the sidecar carries the envelope in the observation record's planned `signature` member and changes neither. The patches apply to the current tree on their own |
| Affects | new binding `bindings/sidecar/`; `registers/relations.yaml` (new row `EXT-SCIFILES`); `registers/implements-edges.json` and `registers/requirements.yaml` regenerated; new cases CT-PROVIDER-170 and CT-CONSUMER-170 (automated: golden replay, `obsp.golden`) with replay evidence in the OBSP-PROVIDER and OBSP-CONSUMER example sets and the invariant module `sdk/python/src/obsp/inv_oip0032.py`; `tools/gen_sidecar_binding_examples.py` and `tests/test_sidecar_binding.py`. No schema and no specification text change |
| Protocol version | obsp/0.1 |
| Last call | 30 days (a binding of existing functions and objects) unless the editors rule otherwise |

## Problem

Most observations leave a station or a processing centre as files: CF-NetCDF series and grids, WMO BUFR messages on the
WIS, miniSEED waveforms, RINEX GNSS observations. Those files are read by software that knows nothing of OBSP, and none
of the formats has a place for an OBSP signature or record. Today a consumer who receives such a file has nothing in the
protocol to check it against: no rule for which bytes a digest covers, where the signed statement lives, how the file
names its statement without breaking its readers, or what a verifier may conclude. Two implementations could hash a
NetCDF file before and after writing a pointer into it, add a local descriptor to a BUFR message, rewrite a miniSEED
record to carry a header, trust a key that came with the file, or show a matching digest as proof that the data are
right.

## Change

No specification text changes: §5.2 already scopes an admission to an artifact digest, §5.10 lets participants exchange
objects and §5.11 prove them; the binding requirements are the normative content. The binding follows `bindings/README.md` and the pattern of OIP-0028:
`PROFILE.md`, `binding.yaml`, `mapping.yaml` (clauses `checked: opened` where the published text was read on 2026-11-21,
else `checked: not checked`), positive and negative golden examples written by `tools/gen_sidecar_binding_examples.py`,
and `tests/test_sidecar_binding.py`, which derives every output with the reference tool and shows that each negative
example breaks the requirement it names. Status `proposed`; no claim that any file, producer or reader conforms to, or
is certified for, any of the formats.

### The sidecar (BND-SIDECAR-01 to -03)

A file `<data file>.obsp.json` next to the data file: a JSON array, written as RFC 8785 bytes, of existing objects.

| Member | Object | Carries |
|---|---|---|
| 1 | `observation-record` with the OIP-0008 envelope in its `signature` member (object class `observation`; the draft register lists the member as planned) | evidence reference `obsp-sidecar-subject` (file name, subject digest) and `source-release` (release UNI, its RFC 8785 digest); `result` naming the file; `extensions."obsp.sidecar"` (format, version, digest scope, reader facts) |
| 2 | `source-release` | `contentDigest`, `contentLength`, `mediaType`, `distributionRef`; `claim` `FILE_INTEGRITY_AND_ORIGIN_NOT_SCIENTIFIC_VALIDITY` |
| 3, optional | `key-record` (OIP-0008 draft) | the signer's public key; informative only |

No new envelope, signature format or schema. The record's `extensions` member is the schema's own extension bag.

### Digests and in-file pointers (BND-SIDECAR-04 to -08)

| Format | Subject digest | Pointer in the file |
|---|---|---|
| CF-NetCDF classic (CDF-1) and 64-bit offset (CDF-2) | SHA-256 of the file; with the global attribute `obsp_sidecar_digest` present, its 71 value bytes are replaced by `sha256:` and 64 zeros first | global attributes `obsp_observation_uni` and `obsp_sidecar_digest` (SHA-256 of the sidecar bytes) |
| WMO BUFR edition 4 | SHA-256 of the whole file, every message from `BUFR` to `7777` | none; nothing is added to a message; local descriptors are refused |
| miniSEED 3 | SHA-256 of the whole file; every record's format version and CRC-32C checked | none; no record is rewritten |
| RINEX 3.xx and 4.xx | SHA-256 of the whole file | optional header `COMMENT` line `OBSP-OBSERVATION-UNI <uni>`, written before minting |

The masked NetCDF digest breaks the cycle between a digest of the file in the sidecar and a digest of the sidecar in the
file: the minter hashes the file with the placeholder, signs, then writes the sidecar digest into the same 71 bytes, so no
offset moves. CF 1.11 §2.6 allows attributes the conventions do not define and asks applications to ignore those they do
not recognise, and both names follow §2.3; no CF attribute changes. A minter reads the file first and refuses what its
reader refuses; it never mints from metadata alone.

### Verification (BND-SIDECAR-09 to -11)

Offline, from the file, the sidecar and the verifier's own anchors: format, digest, binding, in-file pointer, signature,
and an optional inclusion receipt (the reference log's receipt shape, checked with RFC 9162 §2.1.3.2 against a root the
verifier trusts). Each check is PASS, FAIL, INCONCLUSIVE or NOT_RUN. A signature checked only with a key that came in the
sidecar is INCONCLUSIVE; a receipt under a root nobody trusts is INCONCLUSIVE. A report is about the file and sidecar it
was given, never a statement of scientific validity.

### Cases

Both cases are automated (kind `invariant`, level `SELF_TESTED`): the participant supplies, for each golden example the
case covers, the digest of the output it produced (`binding-sidecar-<label>` evidence, `conformance/BINDING-EVIDENCE.md`);
the suite checks that every positive output equals the golden output and no negative example's claimed output is
produced (`obsp.golden.replay`).

| Case | Function | Profile | Covers | Examples |
|---|---|---|---|---|
| CT-PROVIDER-170 | admit | OBSP-PROVIDER | BND-SIDECAR-01 to -08, -12: what a minter accepts and the digest it derives | 6 positive, 8 negative `mint.*` |
| CT-CONSUMER-170 | exchange | OBSP-CONSUMER | BND-SIDECAR-01 to -07, -09 to -12: the verifier's verdict and failing checks | 8 positive, 11 negative `verify.*` |

What a document cannot show stays outside the replay and the case procedures say so: that a producer adds nothing to a
BUFR message or miniSEED record it publishes, and that a verifier makes no network request.

## Reference tools (outside the patches)

- `reference/python/obsp_sidecar`: format readers, `mint` (from real input files only), `verify`; vectors minted from
  files written by open-source libraries (scipy for CF-NetCDF, ecCodes for BUFR, libmseed 3 for miniSEED; versions in
  `vectors/inputs/LIBRARIES.json`) and two RINEX files typed after the specification's header examples. `make sidecar`.
- `reference/rust/obsp-verify`: `obsp-verify sidecar FILE [SIDECAR] [--anchors KEYS] [--receipt R --trusted-root HEX]`,
  replaying the same vectors.
- `reference/web/site`: a sidecar page that checks a file and its sidecar in the browser with Web Crypto, offline, in
  English, French, Spanish and Arabic.

These are development aids: no conformance claim, no implementation listed.

## Compatibility

Additive: no schema, specification text or existing record changes, and nothing is asked of a participant until it
names the binding. The example sets of OBSP-PROVIDER and OBSP-CONSUMER gain one replay evidence document each, so no
case waits for an attestation. Files that already carry other global attributes, BUFR messages, miniSEED records and
RINEX files are read unchanged by their usual software: only a CF-NetCDF file that the producer chose to give the two
attributes differs, by attributes CF readers ignore.

## Tests

- `tests/test_sidecar_binding.py`: the examples equal the generator's output; every positive output is derived by the
  reference tool; each of the 19 negative examples breaks the requirement it names (a mint example is refused, a verify
  example does not PASS and fails the check that shows its requirement); every requirement a golden can show has a
  negative; the positive sidecars hold existing objects that validate (the record without its envelope against the live
  schema, the envelope and key record against the OIP-0008 draft schemas, the release against the live schema).
- `sdk/python/tests/test_inv_oip0032.py`: both invariants pass on the example sets, fail without evidence, fail on a
  changed digest, and fail when a negative example is answered with its claim.
- The negative examples: verify (tampered BUFR data, tampered miniSEED payload, BUFR edition 3, source release edited
  after signing, NetCDF pointer naming another sidecar, NetCDF data changed, wrong signer, record edited after signing,
  altered audit path, the sidecar's own key taken as an anchor, a receipt under an untrusted root shown as PASS); mint
  (BUFR edition 3, BUFR local descriptor, CDF-5, a NetCDF pointer already filled, a bad miniSEED CRC, RINEX 2.11, a RINEX
  UNI naming another observation, text that is no data file).

## Open questions

1. NetCDF-4 (HDF5) and CDF-5 files are refused, not hashed without a structural check. Should the binding add them
   (whole-file digest, and for HDF5 a masking rule for an attribute it stores elsewhere)?
2. WMO-No. 306 Volume I.2 could not be retrieved; the BUFR octet layout and the local-descriptor ranges are
   `checked: not checked` and need reading against the published edition.
3. Collections: one sidecar per file, or one signed record whose evidence references name every file of a delivery?
4. Should a WIS 2.0 notification (draft OIP-0009) or a STAC item name the sidecar of the file it announces?
5. Media types: `application/bufr` and `application/vnd.fdsn.mseed` are in the IANA register (read 2026-11-21); CF-NetCDF
   has no registered type (`application/x-netcdf` is the common name) and RINEX is carried as `text/plain`.
6. Real files from operational producers of every format are still needed as vectors; the committed inputs come from
   open-source writers and hand-typed RINEX headers, with synthetic content.
