Skip to content

fix (3/5): treat present-but-Nil property as absent in PsDeserialize#22

Merged
irvingouj@Devolutions (irvingoujAtDevolution) merged 5 commits into
stack/02-rfc12-message-derivesfrom
stack/03-writeprogress-nil
Jun 23, 2026
Merged

fix (3/5): treat present-but-Nil property as absent in PsDeserialize#22
irvingouj@Devolutions (irvingoujAtDevolution) merged 5 commits into
stack/02-rfc12-message-derivesfrom
stack/03-writeprogress-nil

Conversation

@irvingoujAtDevolution

Copy link
Copy Markdown
Collaborator

Stack 3 of 5 — base: stack/02-rfc12-message-derives (stacked on #21).

A PowerShell <Nil/> member is semantically equivalent to an absent one. For
Option/#[ps(default)] fields the derived PsDeserialize must map a present-but-Nil
property to None/Default instead of feeding it to from_ps_value (which rejects
Nil). Fixes WriteProgress being rejected when ProgressRecord.CurrentOperation
arrives as <Nil/> (the first "Preparing modules for first use." progress record).

Includes a regression test (host::test::test_write_progress_tolerates_nil_fields).

A PowerShell <Nil/> member is semantically equivalent to an absent one. For
Option/#[ps(default)] fields, a present-but-Nil property must map to None/Default
instead of being fed to from_ps_value (which rejects Nil). Fixes WriteProgress
rejection when ProgressRecord.CurrentOperation arrives as <Nil/>.
…ed auth

Over plain HTTP, SSPI message sealing is used (application/HTTP-SPNEGO-session-
encrypted). Over HTTPS, TLS provides confidentiality so the body is sent plain
(application/soap+xml) and authentication is connection-oriented (RFC 4559): the
connection is authenticated once during the handshake (the first operation rides
the SPNEGO challenge legs) and every subsequent operation reuses that authenticated
connection. requires_sspi_sealing() is therefore true only for plain HTTP.

Key points:
- SSPI INTEGRITY (sign) is requested unconditionally; CONFIDENTIALITY (seal) only
  when sealing. INTEGRITY over HTTPS lets the server trust the connection and
  produces the NTLM MIC / SPNEGO mechListMIC.
- EPA channel binding (tls-server-end-point): learned from the server cert after a
  401 and applied on a restarted auth sequence.
- AlreadyComplete is handled consistently across all four transports (tokio direct,
  gateway, sync, web).
- Fail fast on terminal auth rejection (401 -> PwshCoreError::Auth), try_join! so a
  failed handshake short-circuits, and the non-interactive client exits non-zero on
  failure / clean on success (command_completed is authoritative).
- Basic over plain HTTP is refused unless --http-insecure is given.
…lding

Add the 10-case transport_auth_matrix asserting the WinRM rule against a real
server: HTTP+SSPI seals; HTTPS+SSPI is unsealed (TLS); Basic refused over plain
HTTP unless forced, allowed (unsealed) over HTTPS. Helpers: sealed() detects the
multipart/encrypted envelope, connected() detects pipeline completion.

Also makes the shared e2e scaffolding auth-aware: e2e_pwsh_config gains
default_auth_method(); native_pty_matrix and pty_harness use it (the default DC
refuses Basic over HTTP), and fall back to the standard e2e host/creds out of the box.
test (5/5): transport × auth × sealing e2e matrix
feat (4/5): spec-correct WinRM HTTP/HTTPS transport + connection-oriented auth
@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) merged commit df73713 into stack/02-rfc12-message-derives Jun 23, 2026
@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) deleted the stack/03-writeprogress-nil branch June 23, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant