fix(sspi): remove stale rewrite docs and harden credential diagnostics - #178
Merged
Richard Markiewicz (thenextman) merged 1 commit intoAug 7, 2026
Merged
Conversation
Richard Markiewicz (thenextman)
requested review from
Marc-André Moreau (mamoreau-devolutions)
and
a balanced review from Copilot
August 7, 2026 02:02
Copilot started reviewing on behalf of
Richard Markiewicz (thenextman)
August 7, 2026 02:02
View session
There was a problem hiding this comment.
Pull request overview
Removes obsolete SSPI rewrite documentation and hardens credential diagnostics and environment initialization.
Changes:
- Replaces stale smart-card provider rewrite documentation.
- Removes dead CSP lookup code.
- Bounds credential parsing and serializes environment initialization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
README.md |
Documents current credential and middleware behavior. |
dll/Sspi.cpp |
Removes dead code and hardens diagnostics and initialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Aug 7, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Richard Markiewicz (thenextman)
force-pushed
the
rdmw/kerb-cert-logon-review-followup
branch
from
August 7, 2026 02:06
91e5348 to
ef66c4a
Compare
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.
Follow-up to #177, addressing review comments.
Stale documentation for a rewrite that no longer exists
#177 removed the Base CSP → KSP provider rewrite, but left behind a README section and a doc comment above
sspi_CreatePackedCertificateLogonthat still describe it. Both are removed here.To be explicit, since the review suggested implementing the rewrite instead: that would regress the fix. The credential that works names
Microsoft Base Smart Card Crypto ProviderwithKeySpec = 1— the legacy CAPI provider — and the KSP retarget was in the arm that failed during testing. The claim was wrong, not the code.The README text is replaced with something accurate and more useful: the credential is passed through as
CredPackAuthenticationBufferWproduced it, and the provider and container names it records are resolved by the server through the redirected reader — so the same smart card middleware must be installed on both ends. A mismatch surfaces as "the key container does not exist on the smart card", which is a real failure mode and easy to misattribute to the client.Dead code
sspi_TryGetCspInfolost its last caller when the rewrite was removed and is deleted.Bounded credential dump
sspi_GetLocalAllocSizeAsDwordreturns 0 when the incomingpSpnegoCredis not aLocalAllocblock, which is common — a reconnect passes such a buffer. Zero disables the extent check insspi_ResolvePackedField, so walking the blob would then trustCspDataLengthalone and could read past the credential.MsRdpEx_CanReadUnsafePtrstill guarded every access, so this could not fault or touch unmapped memory; the exposure was logging bytes beyond the allocation. Now the fixed-size header is still reported and only theCspDatawalk is skipped when the size is unknown, which keeps the diagnostic useful in exactly the reconnect case that produces it.Thread-safe environment initialisation
MsRdpEx_PcapEnvInitguarded initialisation with a plainboolwhile writing shared globals, including astrcpy_sintog_PcapFilePath. It is reached fromAcquireCredentialsHandleWand from the message paths, both of which run concurrently on several connection worker threads.This race predates #177 — the message-path caller is older and hotter — and the written values are idempotent, so impact was minimal. It is now
InitOnceExecuteOnce, matching the two existing uses in the same file.