team-ljyzipelo

공개
196줄20 KB
1{
2 "status": "implemented-streaming-runtime",
3 "version": 1,
4 "scope": "One job per separately spawned Rust worker; shared 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 is true for implemented ZipCrypto extraction and WinZip AES-256 extraction/creation.",
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|DiskFull",
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 "Windows native runtime, forced interruption of blocked OS I/O and a current full dependency advisory audit are not verified."
77 ],
78 "crypto": {
79 "rustcrypto_allowed": true,
80 "approval_message_id": "2966b0ad-a3e0-49b8-aef8-fb51c4e1c5a5",
81 "implementation_verified": false,
82 "policy": "Human approved pure Rust RustCrypto under MIT/Apache. No home-grown AES or password KDF; approval alone does not enable encryption capability."
83 },
84 "revision": 2,
85 "coordination": {
86 "frontend_message_id": "41a0e5a5-27d0-437f-805d-d39313082096",
87 "basis": "Revision 2 list identity, explicit raw GZip output naming and cancellation acknowledgement are implemented. Field order and tags remain unchanged.",
88 "streaming_frontend_message_id": "59142fd4-22d3-4dc5-a875-5347e1b054da",
89 "disk_full_frontend_message_id": "3b01f4c4-c9b4-4c72-a9a0-b3df39979ea1"
90 },
91 "list_identity": {
92 "ListId": {
93 "catalog_version": "u16=1; reject unsupported versions without remapping entry IDs.",
94 "format": "ZIP|TAR|GZIP|TAR_GZIP; detected parser mode, not the filename extension.",
95 "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.",
96 "archive_bytes": "u64: exact complete compressed/source byte length, bounded by worker limits.",
97 "archive_sha256": "[u8;32]: SHA-256 of every source byte, using the permitted RustCrypto implementation; not CRC or path/size/mtime alone."
98 },
99 "capture": [
100 "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.",
101 "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.",
102 "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."
103 ],
104 "extract_validation": [
105 "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.",
106 "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.",
107 "When All supplies ListId, apply the same comparison. All without ListId means extract the current captured archive without claiming it matches any earlier listing.",
108 "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."
109 ],
110 "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."
111 },
112 "gzip_output": {
113 "destination": "Always the output directory, never a full output filename.",
114 "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.",
115 "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.",
116 "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.",
117 "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."
118 },
119 "design_references": [
120 {
121 "url": "https://docs.rs/sha2/latest/sha2/",
122 "purpose": "RustCrypto SHA-256 implementation documentation; dependency version and advisories still require selection-time verification."
123 },
124 {
125 "url": "https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_id_info",
126 "purpose": "Native Windows opened-file identity fields."
127 },
128 {
129 "url": "https://man7.org/linux/man-pages/man2/stat.2.html",
130 "purpose": "Source metadata from the open file descriptor rather than a later path reopen."
131 }
132 ],
133 "format_tags": {
134 "Zip": 0,
135 "Tar": 1,
136 "Gzip": 2,
137 "TarGzip": 3,
138 "SevenZip": 4
139 },
140 "seven_zip_extension": {
141 "agreement_message_id": "5a36fd89-af36-42be-9f79-bca39415e84d",
142 "compatibility": "Existing format values 0 through 3, fields, message tags and frame version stay unchanged. Older clients reject format 4. App Format and bidirectional conversion require an update.",
143 "regression": "Preserve existing format bytes and round-trip SevenZip in ListEnd/ListId."
144 },
145 "streaming_limits": {
146 "agreement": "Revision 2 fields and frame encoding unchanged. Ratio-rejection removal and advisory disk-space checks follow manager decision d6bc0d37-89d1-4cd2-a00b-883b5eb23ec0. DiskFull tag 13 and preserving Io tag 8 for query/access failures were agreed with frontend in message 3b01f4c4-c9b4-4c72-a9a0-b3df39979ea1. The 7z/CreateZip streaming extension follows manager task c4acbf18-0845-49a2-ae10-a92e7934042d; this extension was agreed with frontend in message 81b585cb-84be-494d-a953-1c8220300176 (PR 78 review 5864130366). Existing numeric quotas, frame fields and error tags remain unchanged.",
147 "default_input_bytes": 18446744073709551615,
148 "default_output_bytes": 17179869184,
149 "default_entries": 10000,
150 "lower_limits": "Callers can lower the input, output and entry quotas. input=u64::MAX means no input-size quota; resource and duration checks still apply.",
151 "zip_ratio": "No compression-ratio rejection. Validate declared and actual output sizes, stream end, CRC and HMAC; sum of declared output sizes must fit output quota before decoding.",
152 "gzip_ratio": "No compression-ratio rejection, including concatenated members. Aggregate decoded bytes, including TAR headers/padding, cannot exceed output quota.",
153 "tar_ratio": "Plain TAR copies declared nonoverlapping ranges within the captured input. The sum of file sizes cannot exceed output quota.",
154 "arithmetic": "Checked u64 offsets and totals; free-space block-to-byte conversion uses u128 to avoid multiplication overflow.",
155 "memory_target": "ZIP/TAR/GZ/TAR.GZ/7z List/Extract and ZIP creation: worker process peak RSS <=64 MiB in Linux regression with independently generated 1 GiB payloads. This is a measured target, not an OS-enforced RSS cap. Metadata budget remains 8 MiB.",
156 "staging": "64 KiB buffers; immutable input capture and verified decoded content use private temporary files that are removed on last-handle close. No decoded content is published until the entire catalog and integrity checks succeed. Temporary disk usage can include the archive plus expanded content plus current destination temporary file; disk exhaustion fails with DiskFull and closes/removes unpublished data.",
157 "legacy": "The slice parser keeps 64 MiB input /128 MiB output caps; the slice ZIP builder keeps 128 MiB source/result caps. Runtime 7z and ZIP creation use streaming file paths.",
158 "parent_lifetime": "Capture native parent before reading Start. At decode/read/write/password checkpoints, fail Io if parent is gone; close anonymous staging and remove current unpublished destination temp. stdin EOF alone remains valid for one-shot requests. Already published entries and directories are reported and retained. A blocked OS file operation cannot be forcibly interrupted by this cooperative guard.",
159 "disk_space": "Advisory free-space checks use opened Linux x86_64 filesystem handles (fstatvfs) or the Windows handle-derived directory (GetDiskFreeSpaceExW). Before ZIP/7z decoding and before publication, group remaining staging and selected output logical bytes by volume. For GZip with unknown expanded size, check staging space before each decoded chunk, then preflight selected output. Input capture also checks its snapshot space. Insufficient space returns DiskFull tag 13. Query failure and other I/O errors retain Io tag 8. Checks do not reserve space or account for every metadata/block-allocation overhead; later ENOSPC still closes staging and removes current unpublished output.",
160 "remaining_risk": "High compression ratios within 16 GiB may expand fully onto disk. Resource duration, cooperative cancellation and measured memory target remain. Free-space checks can race with other disk users; already published outputs are retained on failure.",
161 "seven_zip": "Copy, LZMA and LZMA2 use file-backed solid output with checked declared/actual output totals. Encoded headers remain limited to 8 MiB. Dictionary size remains at most 64 MiB; only the last 8 MiB is cached in memory and older dictionary bytes are read from the temporary output.",
162 "create_zip": "The sum of source logical bytes cannot exceed min(input,output) quotas. output defaults to 16 GiB of uncompressed source content; ZIP container/encryption overhead may exceed that logical content quota. Capture one immutable source at a time, stream Store/Deflate and optional AES-256 through 64 KiB buffers, then publish the completed ZIP without replacing existing files. Emit ZIP64 sizes/offsets only when their 32-bit fields would overflow or equal the sentinel. Check staging and destination free space; StorageFull maps to DiskFull tag 13 and other I/O failures retain Io tag 8."
163 },
164 "validation": "Implementation results belong in the PR verification record. No OS sandbox or native Windows execution claim.",
165 "error_tags": {
166 "None": 0,
167 "Integrity": 1,
168 "UnsupportedFormat": 2,
169 "UnsupportedFeature": 3,
170 "WrongPassword": 4,
171 "UnsafePath": 5,
172 "Conflict": 6,
173 "Limit": 7,
174 "Io": 8,
175 "Protocol": 9,
176 "Internal": 10,
177 "SourceChanged": 11,
178 "InvalidRequest": 12,
179 "DiskFull": 13
180 },
181 "disk_full_extension": {
182 "agreement_message_id": "3b01f4c4-c9b4-4c72-a9a0-b3df39979ea1",
183 "compatibility": "Existing error tags 0 through 12, fields, message tags, revision 2 and frame version stay unchanged. Older clients reject error 13; app error mapping and worker must be updated together before integration.",
184 "mapping": "Insufficient preflight space and StorageFull I/O failures return DiskFull 13. Windows ERROR_HANDLE_DISK_FULL 39 and ERROR_DISK_FULL 112 also map to DiskFull. Query failure, permission errors and other I/O failures return Io 8. No error classification by localized detail text.",
185 "detail": "디스크 여유 공간이 부족합니다. 공간을 확보한 뒤 다시 시도하세요",
186 "publication": "Keep existing publication, durability and cleanup semantics. DiskFull does not imply rollback or absence of previously published outputs."
187 },
188 "create_zip_sources": {
189 "agreement": "Proposed semantic extension under manager task 82093f56-73b7-4be4-ba6d-2597ffc2c6f7; frontend joint agreement is pending. Revision 2 fields, encoding, numeric quotas and error tags are unchanged.",
190 "roots": "Each source may be a regular file or directory. archive_name names that root inside the ZIP; directory descendants retain relative paths and every directory, including empty directories, gets a trailing-slash ZIP entry.",
191 "links": "Reject the whole job with UnsafePath for symbolic links, Windows reparse points, special files or unsafe/non-UTF-8 descendant names. Do not skip entries or follow external links. Open each path component without following links; enumerate pinned directories.",
192 "limits": "All expanded file and directory entries count toward entries (default 10000). Only file logical bytes count toward min(input,output), default output 16 GiB. Preserve 8 MiB metadata and 64-component name limits. Validate the complete plan and case-insensitive/path-prefix conflicts before requesting a password.",
193 "consistency": "Capture each file from its validated open handle. Compare planned object identity, kind, size and modification time before capture and check planned objects again before publishing the completed ZIP; detected changes fail SourceChanged. This is not an atomic snapshot of an entire directory tree.",
194 "encryption": "AES-256 protects file contents using the existing AE-2 encoding. Directory entries are stored as zero-byte unencrypted directory records; entry names remain visible, as with other ZIP entries."
195 }
196}