Permit \r, \n, \t and space after PEM encapsulation boundary in PrivateKeyPattern#1804
Draft
Copilot wants to merge 3 commits into
Draft
Permit \r, \n, \t and space after PEM encapsulation boundary in PrivateKeyPattern#1804Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
Copilot
AI
changed the title
Support inline PEM private keys where newlines were replaced by spaces (CI/CD injection)
Support inline PEM private keys (newlines replaced by spaces by CI/CD injection)
Jun 13, 2026
Copilot created this pull request from a session on behalf of
Rob-Hague
June 13, 2026 15:37
View session
…M encapsulation boundary
Copilot
AI
changed the title
Support inline PEM private keys (newlines replaced by spaces by CI/CD injection)
Permit \r, \n, \t and space after PEM encapsulation boundary in PrivateKeyPattern
Jun 13, 2026
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.
PEM keys injected via CI/CD environment variables (e.g. Azure DevOps) have their newlines replaced by spaces, producing a single-line key that the existing
PrivateKeyPatternregex rejected.Changes
PrivateKeyPatternregex: replaced all\r?\nwith[\r\n\t ]+, accepting any mix of CR, LF, tab, or space as line separators throughout the PEM block — after-----BEGIN...-----, between header fields (Proc-Type,DEK-Info,Comment), between base64 data lines, and before-----END...-----.Convert.FromBase64Stringalready ignores whitespace so the captureddatagroup decodes correctly regardless.InlinePemPattern,InlinePemRegex,NormalizePemText, and the two-pass fallback inOpen— the updated regex handles inline keys directly on the first match attempt.A key like the following now parses successfully: