Skip to content

fix: send the API key in the query string, not the URL path - #3

Merged
velddev merged 3 commits into
masterfrom
fix/key-in-query-string
Oct 23, 2026
Merged

velddev merged 3 commits into
masterfrom
fix/key-in-query-string

Conversation

@velddev

@velddev velddev commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Problem

The request URL was built without a ?:

https://proxycheck.io/v2/&key=<API_KEY>&vpn=0&asn=0&...

So the whole parameter list, API key included, was part of the URL path. .NET's HTTP client tracing and OpenTelemetry only redact the query string, so the proxycheck.io API key ended up in plain text in exported spans (url.full) and logs.

Fix

Build a proper query string, which is proxycheck.io's documented form:

https://proxycheck.io/v2/?key=<API_KEY>&vpn=0&asn=0&...

The URL now ends in /?, the key (when set) is followed by &, and the other parameters are unchanged. With no key, the URL is https://proxycheck.io/v2/?vpn=0&.... The public API and behaviour are otherwise unchanged.

Version

Bumped Topgg.ProxyCheck from 1.0.1 to 1.0.2 (Version, AssemblyVersion, FileVersion). CI pushes with --skip-duplicate, so without a bump nothing new would be published. Consumers should move to 1.0.2 once it is published.

Tests

  • New RequestUriTest captures the outgoing request through a substituted HttpMessageHandler and checks that AbsolutePath is exactly /v2/, that the path has no key, and that Query contains key=. It uses a dummy key.
  • The existing DeserializeTest URLs are updated to the /v2/?vpn=... form.
  • dotnet test passes 3 of 3 locally.

CI workflow change

This PR also touches .github/workflows/dotnet.yml. The "Push to Nuget" step had no if: github.ref == 'refs/heads/master' guard, unlike "Publish" (pack) and "Push to GitHub Packages". On PR and branch runs the pack step is skipped, so the NuGet push failed with Could not find a part of the path '.../artifacts' and turned the check red even though build and tests passed. The step now has the same guard, so master publishing is unchanged and PR runs no longer fail on it.

Comment thread Topgg.ProxyCheck/Topgg.ProxyCheck.cs Outdated
Comment on lines 306 to 317

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we improve this to be less error-prone?

Replaces the hand-assembled string of "&name=value" fragments with a list
of parameters joined in one place, so the separator and the key's position
can't drift again and every value is escaped.
The Push to Nuget step had no branch guard, unlike Pack and the GitHub
Packages push, so on PR and branch runs it tried to push from a missing
./artifacts folder and failed the check. Guard it the same way.
@velddev
velddev merged commit 5050b93 into master Oct 23, 2026
2 checks passed
@velddev
velddev deleted the fix/key-in-query-string branch October 23, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant