fix: reject http:// URLs in PostGuardConfig to prevent plaintext credential leaks#15
Merged
Merged
Conversation
Reject non-https URLs in the PostGuard constructor to prevent the SDK from sending API keys and signing keys over plaintext connections after a config typo. Add AllowInsecureUrls opt-in for local development against http://localhost. Closes #14 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
rubenhensen
approved these changes
May 12, 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.
Summary
PkgUrlandCryptifyUrlare absolutehttps://URLs inPostGuard's constructor; throwArgumentExceptionotherwise.AllowInsecureUrls(defaultfalse) to permithttp://localhostfor local development and testing.tests/E4A.PostGuard.Tests) covering the rejection path (http, ftp, ws, relative, empty), the happy path, and the escape hatch.Why
Closes #14.
PostGuardConfigpreviously accepted any string for the URLs. A caller misconfigured withhttp://pkg.postguard.eu(typo, leaked dev config, etc.) would send their PostGuard API key as aBearertoken over plaintext — exactly the failure mode an IBE SDK should fail closed on.Test plan
dotnet build E4A.PostGuard.slnx --configuration Release— green locallydotnet test E4A.PostGuard.slnx --configuration Release— 13/13 passNotes
build.ymldoes not currently invokedotnet test. The bot doesn't have theworkflowspermission to update it in this PR; a follow-up will wire the test step in.http://URL will now hitArgumentExceptiononnew PostGuard(config). The README only documents the productionhttps://URL, so this should be an empty set in practice — but worth flagging.Reviewer quickstart