Repository navigation
rapp1: conform packages/rapp1 to RAPP/1 rev-17 - #473
Merged
Merged
Conversation
…3, E-7) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…r Ed25519/P-256 (rev-17 E-1, E-8) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…NFC payload names, cofactorless Ed25519 (rev-17 E-5, E-6, E-10, E-20, E-22) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…before step 1, non-canonical §4 text at step 1 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…(rev-17 E-8) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RAPP/1 rev-17 is accepted (kody-w/rapp-1 @
f6bafe7, frame84f1975d…). Its reference implementation and 428-vectorsuite are authoritative, and five clean-room implementations agree with the reference on 60,000 differential fuzz
probes. This PR brings
@rapp-work/rapp1into agreement. rev-17 changes no wire form: the rev-14 authority fixturestill verifies, and no committed RAPP/1 artifact is touched. The repository has no vendored copy of the reference.
What changes and why
src/json.tsassertUnicode(used byparseJson,snapshotJsonandcanonicalJson) now refuses Unicode noncharacters, as italready refused unpaired surrogates. That covers U+FDD0–U+FDEF and every U+xxFFFE/U+xxFFFF, in strings and member
names (§4 (b), E-3).
hashValueaccepts only theHtags:rapp/1:particle,rapp/1:wave,rapp/1:egg-manifest,rapp/1:sealed-aadandrapp/1:sealed-key-request.hashBytesaccepts only theHbtags:rapp/1:egg,rapp/1:rappid,rapp/1:grailandrapp/1:seal.src/identity.tsisUtcnow accepts years 0000–9999 (§7.4, E-1). Before, it refused year 0000.streamFamilyno longer caps a swarm-stream label at 64 characters. §6.1.1 (swarm-stream = "net:" lclabel) setsno bound there; instance and kind labels keep 1–64.
keyedIdentityrefuses a key that is not a §10 key (§6.2, E-8). It accepts only an Ed25519 key whose pointdecodes (RFC 8032 §5.1.3), or a P-256 key with an uncompressed point.
src/signature.tsNew export
parseDetachedJws. It checks the §10 detached compact form and protected-header profile, with no keylookup or cryptography:
canonical(header), with exactlyalg,b64,critandkid;verifyFrameSignaturenow uses it.Ed25519 verification is now the cofactorless RFC 8032 §5.1.7 check with
S < L. A public key that decodes is notrefused for its order (§10, E-20).
Only public values are involved.
src/frame.tssighas the §10 form and header profile (E-10). Before, a malformedsigreached step 6.
*.re-genesispayload shape{migrated_from: {stream_id, terminal_seal, terminal_seq}}(§12.1, E-22). Step 4 refuses a re-genesis frame that is not a genesis. A valid re-genesis frame is still refused at
step 6, because this package deliberately has no owner-authorization flow (unchanged).
scanFrameJsonandscanChainnow refuse octets that are not a §4 value before the checklist (step: null), not atstep 1. This covers invalid JSON, over 1 MiB, depth over 64 and similar.
rule, unchanged).
buildFramerefuses, and never normalizes, apayloadmember name at any depth that is not NFC or that holds a codepoint unassigned in the running Unicode version (§4, E-5, E-6).
Tests and docs
tests/protocol.test.ts: three expectations now follow rev-17.utc.sigis refused at step 1 assignature-format.net:plus 65 characters is a swarm stream;net:a--bis not.A new
rev-17 clarificationsblock covers E-3, E-5/E-6, E-7, E-8, E-10, E-20 and E-22, plus the step-null andnon-canonical cases.
README.md: one paragraph lists the rev-17 rules.Before and after
Measured with the estate kit (
run_unit.py): the rev-17 vectors of each verb the adapter claims, then 3 x 20,000 differential fuzz probes against the reference (seeds 4, 5, 17). The adapter (adapters/openrappter/adapter.mjs) imports the package buildpackages/rapp1/dist, which is what the repository's callers import. Before =38d43ab, after =fc44e80. All four units reach the target: 0 failing applicable vectors and 0 fuzz disagreements.json-ts(json.ts)identity-ts(identity.ts)frame-ts(frame.ts)signature-ts(signature.ts)The kit scores n/a answers as neither pass nor fail:
json-tsidentity-tsframe-tssignature-tsThese are inputs the unit never receives:
identity-tsrappid-mint:keyedIdentitytakes aKeyObject, so it never sees octets node:crypto cannotimport as a key.
mintIdentitydraws its octets fromrandomUUID(), which only yields UUIDv4 octets.frame-ts:registry_hex: the package takes no §13 registry document. Its kind registry is the compiled-in rev-14table (
RAPP1_AUTHORITY.kindFamilies). Its keys are host-selectedRegistryKeyrecords, and translating§13.3 entries into them is host work.
unregistered-kind,kind-family): thepackage has no registry-less mode.
frame-buildwith a givensig, or with aseq/prev/prev_wavethatbuildFramedoes not take: it signswith a
FrameSignerand derives the chain fields from a head.trustmode on a signed frame: the unit verifies only against host-selected keys.signature-tsbefore:jws-parsewas n/a because the package exported no parser.Most frame fuzz probes carry a registry, so the fuzzer's frame-verify coverage is mostly n/a. The vectors cover
the registry-less checklist.
Tests
I installed only what these packages need:
npm ci --ignore-scripts, 102 packages, no electron or browsers.node_moduleswas deleted afterwards.38d43ab)fc44e80)npm run typecheck --workspace @rapp-work/rapp1npm test --workspace @rapp-work/rapp1npm test --workspace @rapp-work/securitynpm test --workspace @rapp-work/domainnpm test --workspace @rapp-work/workspace-storenode scripts/check-legacy-absence.mjsnode scripts/check-release-constitution.mjsThe apps and
tests/acceptanceneed the full install (electron) and were not run. Their callers use onlyhashValue(PARTICLE_DOMAIN, ...), anHtag.Left open
host-selected key records. A kind that an estate registers after rev-14 is refused as
unregistered-kind, buta §7.5 consumer holding that registry would accept it. §13.3 tombstones and re-anchors reach the package only
as
revoked_utcandsuperseded_utcon aRegistryKey.*.re-genesisframe is still refused at step6, because the package deliberately has no owner-authorization flow (README).
scanFrameJsonandscanChainrefuse a §4 value presented innon-canonical text at step 1, because a stored frame is never repaired. §4 accepts insignificant whitespace in
input text, so a frame another producer emits with whitespace would be refused here. No registry-less vector or
fuzz probe disagreed on this.
parseJsonnow refuses noncharacters in every JSON text it reads, including workspace files..github/workflowschange is needed. The repository has no vendored reference copy, and no committedRAPP/1 artifact was changed.
Part of the RAPP/1 rev-17 estate conformance pass: rev-17 is accepted in kody-w/rapp-1#46 (
f6bafe7), where the reference and five independent implementations agree on all 428 vectors and 60,000 fuzz probes. The before/after numbers above come from the same vectors and fuzzer, run against this repository's own code.