| 1 | { |
| 2 | "status": "frontend-conditions-addressed-codec-not-implemented", |
| 3 | "version": 1, |
| 4 | "scope": "One job per separately spawned Rust worker; shared std-only binary codec. Process separation is not an OS sandbox.", |
| 5 | "frame": { |
| 6 | "magic": "ZAW1", |
| 7 | "header_bytes": 32, |
| 8 | "fields_le": [ |
| 9 | "magic[4]", |
| 10 | "version:u16=1", |
| 11 | "kind:u16", |
| 12 | "body_bytes:u32", |
| 13 | "reserved:u32=0", |
| 14 | "job_id:u64(nonzero)", |
| 15 | "sequence:u64" |
| 16 | ], |
| 17 | "sequence": "Independent direction counters start0 and increase exactly once; reject duplicates, gaps and wrap.", |
| 18 | "max_body_bytes": 1048576, |
| 19 | "max_frames_per_job": 1000000, |
| 20 | "payload": "Fixed enum tags and LE integers; length-prefix byte/string/vector values with allocation bounds; reject unknown tags and trailing fields." |
| 21 | }, |
| 22 | "paths": { |
| 23 | "unix": "tag1 and exact native bytes", |
| 24 | "windows": "tag2 and UTF-16LE units", |
| 25 | "rules": "Platform encoding must match. Reject NUL and nonabsolute roots; Windows UNC/device paths unsupported. No lossy execution paths.", |
| 26 | "archive_names": "Separate validated UTF-8 relative names; entry IDs are opaque ordinal u32, not paths." |
| 27 | }, |
| 28 | "commands": { |
| 29 | "Start": "Exactly once: List{archive}, Extract{archive,destination,selection:All|EntryIds{ids:[u32]},list_id:optional<ListId>,gzip_output_name:optional<UTF8>}, CreateZip{sources:[source_path,archive_name],output_file,method:Store|Deflate,encryption:None|Aes256}. App supplies job_id; caller can lower worker hard limits. Extract destination is always an absolute output directory. EntryIds requires list_id; All may supply list_id to bind extraction to a displayed list.", |
| 30 | "Password": "Matching outstanding challenge_id:u64 and max1024 UTF-8 bytes; never log, Debug, echo or persist secrets.", |
| 31 | "Cancel": "Matching header job_id and empty body; command header sequence identifies the request. See CancelAck. Request acceptance is separate from final outcome. EOF alone is not successful cancellation." |
| 32 | }, |
| 33 | "events": { |
| 34 | "Accepted": "Action and capabilities; encryption capability remains false until implementation and verification are complete.", |
| 35 | "Entry": "entry_id, name, kind File|Directory|Link|Other, declared sizes, encrypted; ordinal u32 IDs belong to this List job only until its ListEnd token and Completed Terminal are confirmed. Metadata only, no CRC success claim.", |
| 36 | "ListEnd": "entry_count:u32 and list_id:ListId for a complete listing. Entry IDs are deterministic zero-based ordinals in archive traversal order. App associates this token with this job entries only after Completed Terminal, both stream EOFs and successful child wait/exit.", |
| 37 | "PasswordRequired": "challenge_id, attempt and purpose Decrypt|Encrypt; no secret diagnostics.", |
| 38 | "Progress": "stage Scan|Read|Decode|Write|Verify|Commit, processed_bytes,total_bytes:optional,completed_entries; observational only.", |
| 39 | "Output": "entry_id:optional, relative_name, disposition Created|PartialRetained|Removed|CommitUncertain; only this job outputs.", |
| 40 | "Terminal": { |
| 41 | "outcome": "Completed|Failed|Cancelled", |
| 42 | "error": "None|Integrity|UnsupportedFormat|UnsupportedFeature|WrongPassword|UnsafePath|Conflict|Limit|Io|Protocol|Internal|SourceChanged|InvalidRequest", |
| 43 | "publication": "None|Partial|Complete|Uncertain", |
| 44 | "created_count": "u64", |
| 45 | "retained_partial_count": "u64", |
| 46 | "durability": "NotApplicable|Synced|Unconfirmed|Failed", |
| 47 | "cleanup": "Complete|Failed|Unconfirmed", |
| 48 | "detail": "Bounded local description, not a substitute for typed errors." |
| 49 | }, |
| 50 | "CancelAck": { |
| 51 | "request_sequence": "u64: echoed Cancel command header sequence; separate from this event header sequence.", |
| 52 | "status": "Requested|AlreadyRequested|TooLate|Finished", |
| 53 | "Requested": "Cancellation flag was latched for the first time before the job cancellation cutoff. Cooperative request acceptance; not a guarantee of Cancelled, no outputs or rollback.", |
| 54 | "AlreadyRequested": "Cancellation was already latched and the job can still observe it. The flag stays latched; no second request or reset.", |
| 55 | "TooLate": "Final job completion/commit decision has been sealed so cancellation can no longer influence the outcome; final outcome may still be Failed or publication Uncertain. Previously created entries alone do not make a multi-entry job TooLate.", |
| 56 | "Finished": "Business outcome has already been fixed, but Terminal has not yet been emitted. Does not establish success, EOF, child exit or reaping.", |
| 57 | "ordering": "Each well-formed Cancel consumed before Terminal is acknowledged once before Terminal. Terminal is the last worker protocol frame. A Cancel racing with Terminal/exit may remain unread and have no acknowledgement; app uses Terminal plus EOF and wait, never synthesizes a worker acknowledgement or successful cancellation." |
| 58 | } |
| 59 | }, |
| 60 | "lifecycle": [ |
| 61 | "Start once; no automatic retry or overwrite. Password/Cancel remain readable during work.", |
| 62 | "Parent drains both streams concurrently. Stdout is protocol only; stderr is bounded diagnostics without secrets.", |
| 63 | "Exactly one Terminal ends business results and is the final worker protocol frame; CancelAck can precede but never follow it. Worker exits0 after delivered terminal, including Failed/Cancelled. Malformed protocol or crash can exit nonzero without terminal.", |
| 64 | "App requires matching terminal, stdout/stderr EOF and owned child wait/exit before replacement/close. EOF/exit0 alone is not success.", |
| 65 | "Lost/killed worker preserves observed outputs; unobserved commit/cleanup stays uncertain, never synthetic Cancelled/rollback/absent output.", |
| 66 | "Cancellation retains completed outputs; cleanup removes only owned temporary files and reports any retained partial.", |
| 67 | "Completed is not OS sandboxing or release evidence. No security-setting changes." |
| 68 | ], |
| 69 | "safe_output": [ |
| 70 | "Reject absolute/dotdot/drive/UNC/device/reserved/alternate-stream names and case/path collisions before writes.", |
| 71 | "Reject archive links/special entries on extraction. Do not follow output parent symlinks/reparse points.", |
| 72 | "Create output files exclusively; never truncate or write pre-existing files. GZip FNAME does not choose destination.", |
| 73 | "CRC/size/stream-end validation precedes committed output events; preserve commit/durability/cleanup distinctions." |
| 74 | ], |
| 75 | "pending": [ |
| 76 | "Frontend draft acceptance was conditional on these three clarifications, now specified. Shared codec and app/worker integration remain unimplemented and unverified.", |
| 77 | "RustCrypto version selection, encryption implementation and verification; capability remains unavailable until complete.", |
| 78 | "Actual Linux and Windows build/runtime results; neither claimed yet." |
| 79 | ], |
| 80 | "performed": { |
| 81 | "implementation": false, |
| 82 | "cargo_build": false, |
| 83 | "tests": false, |
| 84 | "worker_runs": false, |
| 85 | "remote_branch_or_pr": false |
| 86 | }, |
| 87 | "crypto": { |
| 88 | "rustcrypto_allowed": true, |
| 89 | "approval_message_id": "2966b0ad-a3e0-49b8-aef8-fb51c4e1c5a5", |
| 90 | "implementation_verified": false, |
| 91 | "policy": "Human approved pure Rust RustCrypto under MIT/Apache. No home-grown AES or password KDF; approval alone does not enable encryption capability." |
| 92 | }, |
| 93 | "revision": 2, |
| 94 | "coordination": { |
| 95 | "frontend_message_id": "41a0e5a5-27d0-437f-805d-d39313082096", |
| 96 | "basis": "Frontend can use the draft subject to three clarifications. This revision specifies list identity, explicit raw GZip output naming and cancellation acknowledgement. It does not claim implementation or runtime verification." |
| 97 | }, |
| 98 | "list_identity": { |
| 99 | "ListId": { |
| 100 | "catalog_version": "u16=1; reject unsupported versions without remapping entry IDs.", |
| 101 | "format": "ZIP|TAR|GZIP|TAR_GZIP; detected parser mode, not the filename extension.", |
| 102 | "source_object": "Tagged native identity from the opened source handle: Unix{device:u64,inode:u64} or Windows{volume_serial:u64,file_id:[u8;16]}. Platform must match; unavailable reliable identity returns UnsupportedFeature.", |
| 103 | "archive_bytes": "u64: exact complete compressed/source byte length, bounded by worker limits.", |
| 104 | "archive_sha256": "[u8;32]: SHA-256 of every source byte, using the permitted RustCrypto implementation; not CRC or path/size/mtime alone." |
| 105 | }, |
| 106 | "capture": [ |
| 107 | "Open the regular source file once and keep its handle. Copy through bounded reads into a private job-owned snapshot while computing full SHA-256. Check source handle identity, length and modification metadata before/after capture; detected mutation rejects the capture. Check the named source still resolves to the same object at the validation boundary.", |
| 108 | "The completed private snapshot is the sole input to parsing and decoding for this job; never hash one file and later reopen the path to decode. Snapshot storage is bounded, exclusively owned and not writable through attacker-selected names. Failure to establish a stable private snapshot fails before creating destination outputs.", |
| 109 | "List builds the deterministic catalog from that snapshot and returns its ListId only with successful ListEnd. A failed/cancelled/truncated listing provides no reusable selection token." |
| 110 | ], |
| 111 | "extract_validation": [ |
| 112 | "Treat every supplied ListId and entry ID as untrusted. EntryIds without ListId, empty/duplicate IDs or IDs outside the recomputed catalog fail InvalidRequest before destination output creation.", |
| 113 | "Capture the Extract source into a new private snapshot, recompute identity/length/SHA-256/format/catalog version and compare every ListId field before creating any destination output. A mismatch returns Terminal Failed/SourceChanged with publication None and zero created/retained outputs. The app invalidates the displayed selection and asks the user to reopen/list; no automatic extraction retry or ordinal remapping.", |
| 114 | "When All supplies ListId, apply the same comparison. All without ListId means extract the current captured archive without claiming it matches any earlier listing.", |
| 115 | "EntryIds refer to the recomputed catalog ordinals, never names supplied by the app; extract the selected members in archive traversal order. Link/special-entry and output path guards remain mandatory after identity validation." |
| 116 | ], |
| 117 | "boundary": "This binds extraction to verified snapshot bytes and observed native identity at capture/validation time. It is not authorization, a signed token, an exclusive filesystem lock or a promise to detect every external edit after capture or a byte-identical change-and-restore. Later source changes cannot change the bytes decoded from the private snapshot." |
| 118 | }, |
| 119 | "gzip_output": { |
| 120 | "destination": "Always the output directory, never a full output filename.", |
| 121 | "gzip_output_name": "Required Some(nonempty validated UTF-8 single leaf filename) for raw GZIP extraction, for both All and EntryIds. Reject absolute/drive/UNC/device/alternate-stream/reserved names, separators, dot/dotdot and invalid leaf names before creating outputs. Missing/invalid value returns InvalidRequest; no implicit basename or FNAME fallback.", |
| 122 | "other_formats": "Must be None for ZIP, TAR and TAR_GZIP; reject Some as InvalidRequest rather than silently ignoring it. TAR_GZIP uses validated inner TAR member names.", |
| 123 | "gzip_catalog": "Raw GZIP is one logical stream entry with entry_id0. Its listed display name is not an output path; entry selection still requires ListId.", |
| 124 | "publication": "Resolve the supplied leaf under destination using the same no-follow and exclusive-create guards. Existing destination files return Conflict; never overwrite, rename to an automatic alternative or retry." |
| 125 | }, |
| 126 | "design_references": [ |
| 127 | { |
| 128 | "url": "https://docs.rs/sha2/latest/sha2/", |
| 129 | "purpose": "RustCrypto SHA-256 implementation documentation; dependency version and advisories still require selection-time verification." |
| 130 | }, |
| 131 | { |
| 132 | "url": "https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_id_info", |
| 133 | "purpose": "Native Windows opened-file identity fields." |
| 134 | }, |
| 135 | { |
| 136 | "url": "https://man7.org/linux/man-pages/man2/stat.2.html", |
| 137 | "purpose": "Source metadata from the open file descriptor rather than a later path reopen." |
| 138 | } |
| 139 | ] |
| 140 | } |