[FEATURE] Run the SHA-2 command with explicit native file and stream authority #4

Open
opened 2026-10-24 02:31:16 +02:00 by erikinkinen · 2 comments
Owner

Problem and motivation

The shared SHA-2 command already parses before I/O and hashes incrementally, but its executable currently runs only on Linux. EriX needs the same command to hash explicitly selected files and inherited standard input during native builds.

Proposed behavior and scope

Add an EriX entry and backend for both sha256 and sha512, preserving the current grammar, records and exit statuses. Stream input in reusable chunks; file size must not determine temporary memory use. Prepare the complete invocation before binding selected input and output owners.

Reuse LibStdio's checked stream cursors and move common stream framing there. Put the shared, opt-in native command broker/file client in LibCli and migrate Coreutils to it, so these tools use one checked implementation. Use existing launch startup and capability-inventory contracts. The prepared command's allocations use an explicitly sized process-owned workspace; no allocator, filesystem or service lookup fallback is permitted. Linux behavior remains unchanged.

Authority, security and reliability

A file operand may request only an exact invocation-lifetime READ lease through the inherited, manifest-bounded job broker. Argument bytes select an operand, never a service or capability. Standard input is consumed at most once, and output uses only selected inherited descriptors. No write-file, publication, clock, network or launch route is needed.

Validate original correlations, reply framing and installed rights. Finalize a digest only after confirmed EOF and exact input retirement. Preserve the first failure, do not replay uncertain calls, and retain unresolved custody through final cleanup; ordinary command status alone cannot authorize process exit.

Acceptance criteria

  • Implement native startup, both algorithms, ordered file inputs, stdin once, stdout and diagnostics without ambient lookup or fixed operand/file-size limits.
  • Share checked stream and broker/file clients with Coreutils; keep default pure-library behavior allocation-free and effect-free.
  • Cover empty and multi-chunk inputs, denial, partial reads/writes, malformed or mismatched replies, correlation exhaustion, revocation and cleanup uncertainty with original lifecycle tests.
  • Document deployment memory, authority, errors and cleanup, and retain host/native command parity.
  • Package and exercise the native tool in EriX with file/stdin/redirection and denied-authority cases; retain this as separate guest acceptance until demonstrated.

Alternatives and tradeoffs

A second private transport would duplicate security-sensitive framing and retirement logic. A POSIX adapter would add an unnecessary authority boundary. Shared native clients keep those checks in one place; the explicit workspace still has an ordinary deployment resource limit, which must be reported rather than hidden as a command limit.

Tracking and rollout

Part of erix/integration#8. Continues #1 and #2. Land shared clients and their Coreutils migration with the native backend, then adopt the coherent supplier graph and guest fixtures in Integration.

## Problem and motivation The shared SHA-2 command already parses before I/O and hashes incrementally, but its executable currently runs only on Linux. EriX needs the same command to hash explicitly selected files and inherited standard input during native builds. ## Proposed behavior and scope Add an EriX entry and backend for both `sha256` and `sha512`, preserving the current grammar, records and exit statuses. Stream input in reusable chunks; file size must not determine temporary memory use. Prepare the complete invocation before binding selected input and output owners. Reuse LibStdio's checked stream cursors and move common stream framing there. Put the shared, opt-in native command broker/file client in LibCli and migrate Coreutils to it, so these tools use one checked implementation. Use existing launch startup and capability-inventory contracts. The prepared command's allocations use an explicitly sized process-owned workspace; no allocator, filesystem or service lookup fallback is permitted. Linux behavior remains unchanged. ## Authority, security and reliability A file operand may request only an exact invocation-lifetime READ lease through the inherited, manifest-bounded job broker. Argument bytes select an operand, never a service or capability. Standard input is consumed at most once, and output uses only selected inherited descriptors. No write-file, publication, clock, network or launch route is needed. Validate original correlations, reply framing and installed rights. Finalize a digest only after confirmed EOF and exact input retirement. Preserve the first failure, do not replay uncertain calls, and retain unresolved custody through final cleanup; ordinary command status alone cannot authorize process exit. ## Acceptance criteria - [x] Implement native startup, both algorithms, ordered file inputs, stdin once, stdout and diagnostics without ambient lookup or fixed operand/file-size limits. - [x] Share checked stream and broker/file clients with Coreutils; keep default pure-library behavior allocation-free and effect-free. - [ ] Cover empty and multi-chunk inputs, denial, partial reads/writes, malformed or mismatched replies, correlation exhaustion, revocation and cleanup uncertainty with original lifecycle tests. - [ ] Document deployment memory, authority, errors and cleanup, and retain host/native command parity. - [ ] Package and exercise the native tool in EriX with file/stdin/redirection and denied-authority cases; retain this as separate guest acceptance until demonstrated. ## Alternatives and tradeoffs A second private transport would duplicate security-sensitive framing and retirement logic. A POSIX adapter would add an unnecessary authority boundary. Shared native clients keep those checks in one place; the explicit workspace still has an ordinary deployment resource limit, which must be reported rather than hidden as a command limit. ## Tracking and rollout Part of erix/integration#8. Continues #1 and #2. Land shared clients and their Coreutils migration with the native backend, then adopt the coherent supplier graph and guest fixtures in Integration.
Author
Owner

Published the native backend at 140f0ef8, with shared clients in LibStdio521f200d and LibClia2a8001b. Coreutils988aba63 uses those same clients. File hashes require confirmed EOF and lease retirement; inherited stream aliases share their original cursors and cleanup state. Integration packaging and the guest file/stdin/redirection cases are next.

Published the native backend at 140f0ef8, with shared clients in LibStdio521f200d and LibClia2a8001b. Coreutils988aba63 uses those same clients. File hashes require confirmed EOF and lease retirement; inherited stream aliases share their original cursors and cleanup state. Integration packaging and the guest file/stdin/redirection cases are next.
Author
Owner

40087040 replaces the private heap with LibOwnedRegion’s allocator over the original packaged workspace. No new backing route is acquired. The native feature is gated consistently, and the manual inventory binds all 16 implemented source inputs.

40087040 replaces the private heap with LibOwnedRegion’s allocator over the original packaged workspace. No new backing route is acquired. The native feature is gated consistently, and the manual inventory binds all 16 implemented source inputs.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:35:13 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/sha2-tool#4
No description provided.