@oim-media/spec 1.37.1 → 1.37.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CANONICAL_SPEC.md +1 -1
- package/CANONICAL_SPEC_2.md +23 -8
- package/README.md +1 -0
- package/package.json +2 -1
- package/schema/oim.schema.json +2 -2
- package/vectors-tampered/manifest.json +38 -0
- package/vectors-tampered/tampered-idat-after-iend.oim.png +0 -0
- package/vectors-tampered/tampered-idat.oim.png +0 -0
- package/vectors-tampered/tampered-payload.oim.png +0 -0
- package/vectors-tampered/tampered-signature.oim.png +0 -0
- package/vectors-tampered/tampered-trailing-idat.oim.png +0 -0
- package/vectors-tampered/valid-unknown-ancillary-chunk.oim.png +0 -0
package/CANONICAL_SPEC.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> This document describes **1.x** (legacy, no longer painted by readers). The current format is OIM 2.0: see [CANONICAL_SPEC_2.md](CANONICAL_SPEC_2.md).
|
|
4
4
|
|
|
5
|
-
**Contract version:** 1.37.
|
|
5
|
+
**Contract version:** 1.37.4
|
|
6
6
|
**Date:** 2026-11-02 (reviewed against `packages/core/src/schema.ts`; the source of truth is the schema, this document summarises it)
|
|
7
7
|
**Status:** Normative / In force
|
|
8
8
|
**License:** Apache-2.0
|
package/CANONICAL_SPEC_2.md
CHANGED
|
@@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
6
6
|
# OIM 2.0 Canonical Specification
|
|
7
7
|
|
|
8
8
|
**Document version emitted by the reference writer:** `2.0.0` (`DOCUMENT_VERSION` in `@oim-media/core/v2`)
|
|
9
|
-
**Contract release this text was checked against:** 1.37.
|
|
9
|
+
**Contract release this text was checked against:** 1.37.4
|
|
10
10
|
**Status:** Normative
|
|
11
11
|
**License:** Apache-2.0
|
|
12
12
|
**Authority:** Xue Studios LLC
|
|
@@ -77,6 +77,14 @@ pre-release string `2.0.0-draft.1` and are not re-signed: that string is still a
|
|
|
77
77
|
A `.oim` is a conforming PNG (ISO/IEC 15948) that starts with the 8-byte PNG signature. Any viewer that
|
|
78
78
|
does not know OIM shows it as an ordinary image. The pixels are the **base picture** (section 2.4).
|
|
79
79
|
|
|
80
|
+
- **Unknown ancillary chunks:** Readers MUST ignore unknown ancillary PNG chunks (chunks whose first type byte is
|
|
81
|
+
lowercase per ISO/IEC 15948, such as `iCCP`, `pHYs`, non-OIM `tEXt`, retired `OIM_Seal`, or unknown private chunks
|
|
82
|
+
like `uNkN`) placed before `IEND`. Because the signature seals `OIM_Data` and the concatenated `IDAT` payloads
|
|
83
|
+
(section 6.5), an extra unsigned ancillary chunk does not break verification (`verified`).
|
|
84
|
+
- **Scanning past `IEND`:** When collecting `IDAT` chunks for the image seal (section 6.5), readers MUST continue
|
|
85
|
+
scanning well-formed PNG chunks even after `IEND` so a smuggled trailing `IDAT` chunk changes `sha256-idat` and is
|
|
86
|
+
refused as `image_mismatch`.
|
|
87
|
+
|
|
80
88
|
### 2.2. The document chunk
|
|
81
89
|
|
|
82
90
|
The document is stored in one ancillary text chunk:
|
|
@@ -662,9 +670,10 @@ is the profile of [BINARY_SPEC.md](BINARY_SPEC.md) section 5.1, **not** RFC 8785
|
|
|
662
670
|
- Value: the 64 bytes `r ‖ s` (IEEE P1363, not ASN.1 DER), base64-encoded, in `signature`.
|
|
663
671
|
- `key_version` names the signing key (`kid`), for example `v1` or `v2`. `signed_at` is an ISO 8601 timestamp with
|
|
664
672
|
seconds and a time-zone designator, written by the signer and inside the signed bytes.
|
|
665
|
-
- The public keys are published in [`keys.json`](keys.json) and
|
|
666
|
-
`https://api.oim.media/v1/media/keys
|
|
667
|
-
`
|
|
673
|
+
- The public keys are published in [`keys.json`](keys.json) and mirrored at
|
|
674
|
+
`https://api.oim.media/v1/media/keys` for tooling and build-time packaging. Sandboxed players MUST embed the
|
|
675
|
+
public keys from `keys.json` and verify strictly offline; a player MUST NOT make automatic outbound network requests
|
|
676
|
+
to look up unknown keys.
|
|
668
677
|
|
|
669
678
|
### 6.4. Verification
|
|
670
679
|
|
|
@@ -673,9 +682,11 @@ A reader verifies in this order:
|
|
|
673
682
|
1. Extract the document (section 2). No document: the file is a plain image (`no_metadata`).
|
|
674
683
|
2. Validate the limits of section 5.3. A violation: `corrupt`, refuse.
|
|
675
684
|
3. If `signature` or `key_version` is absent: `unsigned`.
|
|
676
|
-
4. Otherwise rebuild the canonical form (6.2) and verify the signature with the key `key_version`. A
|
|
677
|
-
no canonical form, an unknown key, or a failed verification: `invalid_signature`, refuse.
|
|
678
|
-
|
|
685
|
+
4. Otherwise rebuild the canonical form (6.2) and verify the signature with the embedded key for `key_version`. A
|
|
686
|
+
number with no canonical form, an unknown key, or a failed verification: `invalid_signature`, refuse. Sandboxed
|
|
687
|
+
players MUST NOT issue outbound network calls during verification, even when `key_version` is unknown or
|
|
688
|
+
verification fails (the only network request permitted is fetching the user's `.oim` file itself when loaded
|
|
689
|
+
from a URL).
|
|
679
690
|
(Informative: for older files the reference player also retries when the document has `creator_user_id`,
|
|
680
691
|
keeping that field and using UTF-16 key order with no number normalisation. Writers and signers MUST NOT rely on it.)
|
|
681
692
|
5. If the key was retired (`not_after` earlier than `signed_at`) the signature is invalid. A key the player no
|
|
@@ -715,6 +726,10 @@ reference. A vector has no `.expected.json`: the
|
|
|
715
726
|
expectation is the golden. Known differences of a renderer go in an `exceptions.json` beside the goldens, with a
|
|
716
727
|
reason; an excepted vector that passes fails the run.
|
|
717
728
|
|
|
729
|
+
Security boundary and negative fixtures live in `vectors-tampered/` together with `vectors-tampered/manifest.json`:
|
|
730
|
+
- `cases` (5 tampered 2.0 files): files altered after signing (modified `IDAT` bytes, appended `IDAT` chunk before `IEND`, smuggled `IDAT` chunk appended after `IEND`, mutated layer metadata, and invalid signatures) that every compliant reader MUST refuse with the declared verdict (`image_mismatch` or `invalid_signature`).
|
|
731
|
+
- `accepted`: a validly signed 2.0 file carrying an extra unknown ancillary PNG chunk (`uNkN`) before `IEND` that every compliant reader MUST ignore and verify as `verified`.
|
|
732
|
+
|
|
718
733
|
Procedure (800 px wide, device pixel ratio 1, animations disabled, white background, `sans-serif` host font),
|
|
719
734
|
metric (pixel channel difference above 40, 3 × 3 erosion, fail above 0.4 % area or a 576 px blob) and
|
|
720
735
|
calibration are those of [CANONICAL_SPEC.md](CANONICAL_SPEC.md) section 9.1 and `tools/parity-core.mjs`.
|
|
@@ -783,7 +798,7 @@ A writer is checked by validating its documents against `schema/oim2.schema.json
|
|
|
783
798
|
|
|
784
799
|
## 11. Appendix D: what the schema allows and the reference painter does not draw
|
|
785
800
|
|
|
786
|
-
Checked against the working tree that follows release 1.37.
|
|
801
|
+
Checked against the working tree that follows release 1.37.4. A reader that does not draw one of these is still
|
|
787
802
|
conforming to the schema; a writer SHOULD NOT rely on them being painted.
|
|
788
803
|
|
|
789
804
|
- A `{ ref }` chain through several resources beyond four steps: not drawn.
|
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ marks-cases.json Known-answer cases for text marks, shared with the backend's
|
|
|
15
15
|
canonical-cases.json Known-answer case for the canonical form, checked by the TypeScript, Rust and Dart implementations.
|
|
16
16
|
schema/oim2.schema.json The 2.0 document, generated from @oim-media/core/v2.
|
|
17
17
|
vectors-2/ 48 signed 2.0 .oim files with web goldens (golden/).
|
|
18
|
+
vectors-tampered/ 5 tampered signed 2.0 files + unknown ancillary chunk fixture + manifest.json.
|
|
18
19
|
vectors/ 39 signed .oim files, each with <name>.expected.json.
|
|
19
20
|
tools/ Read-only checks: contract-summary.mjs, canonical-check.mjs, style-usage.mjs.
|
|
20
21
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oim-media/spec",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.4",
|
|
4
4
|
"description": "OIM format contract: JSON Schema, normative specification and conformance vectors that every OIM player must pass.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oim",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"schema",
|
|
16
16
|
"vectors",
|
|
17
17
|
"vectors-2",
|
|
18
|
+
"vectors-tampered",
|
|
18
19
|
"BINARY_SPEC.md",
|
|
19
20
|
"CANONICAL_SPEC.md",
|
|
20
21
|
"CANONICAL_SPEC_2.md",
|
package/schema/oim.schema.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://oim.media/spec/1.37.
|
|
3
|
+
"$id": "https://oim.media/spec/1.37.4/oim.schema.json",
|
|
4
4
|
"title": "OIM document metadata",
|
|
5
|
-
"specVersion": "1.37.
|
|
5
|
+
"specVersion": "1.37.4",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"description": {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Signed OIM 2.0 files modified after signing. Every compliant reader MUST refuse every file listed here.",
|
|
3
|
+
"source": "vectors-2/basic-text.oim.png",
|
|
4
|
+
"cases": [
|
|
5
|
+
{
|
|
6
|
+
"file": "tampered-idat.oim.png",
|
|
7
|
+
"expected": "image_mismatch",
|
|
8
|
+
"reason": "1 bit flipped in the first IDAT chunk payload with valid PNG CRC-32; signature verifies but sha256-idat seal breaks."
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"file": "tampered-trailing-idat.oim.png",
|
|
12
|
+
"expected": "image_mismatch",
|
|
13
|
+
"reason": "Extra IDAT chunk appended before IEND with valid PNG CRC-32; signature verifies but concatenated IDAT hash breaks."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"file": "tampered-payload.oim.png",
|
|
17
|
+
"expected": "invalid_signature",
|
|
18
|
+
"reason": "Signed layer metadata modified in OIM_Data with valid PNG CRC-32; ECDSA P-256 signature verification fails."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"file": "tampered-signature.oim.png",
|
|
22
|
+
"expected": "invalid_signature",
|
|
23
|
+
"reason": "1 byte flipped inside the 64-byte IEEE P1363 ECDSA signature (metadata and IDAT intact) with valid PNG CRC-32."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"file": "tampered-idat-after-iend.oim.png",
|
|
27
|
+
"expected": "image_mismatch",
|
|
28
|
+
"reason": "Extra IDAT chunk appended after IEND with valid PNG CRC-32; readers scan past IEND so concatenated IDAT hash breaks."
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"accepted": [
|
|
32
|
+
{
|
|
33
|
+
"file": "valid-unknown-ancillary-chunk.oim.png",
|
|
34
|
+
"expected": "verified",
|
|
35
|
+
"reason": "Validly signed file with an extra unknown ancillary PNG chunk (uNkN, valid CRC-32) inserted before IEND; compliant readers MUST ignore unknown ancillary chunks and verify the document."
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|