status: verify TLS on the check.torproject.org request#200
Open
UncleJ4ck wants to merge 1 commit into
Open
Conversation
htrgouvea
requested changes
Jun 11, 2026
| sub new { | ||
| my $api_check = 'https://check.torproject.org/api/ip'; | ||
| my $request = HTTP::Tiny -> new -> get($api_check); | ||
| # Pure formatter, separated from the network call so the output contract can |
| # Pure formatter, separated from the network call so the output contract can | ||
| # be unit tested. $data is the decoded check.torproject.org payload, or undef | ||
| # when the request failed. | ||
| sub format_status { |
|
|
||
| if ($request -> {status} == $SUCCESS_CODE) { | ||
| my $data = decode_json($request -> {content}); | ||
| my $check_ip = $data->{'IP'}; |
Owner
There was a problem hiding this comment.
you need to follow the style guide
3d9af27 to
cdcecc2
Compare
Author
|
done. comments gone, no extra subroutine, just the |
htrgouvea
approved these changes
Jun 11, 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.
What was a problem?
HTTP::Tiny->newdefaults toverify_SSL => 0, so the status check accepted any certificate. A tor exit, or anyone on the path, could return a forged{"IsTor":true}and nipe would report you as protected when you were not.How this PR fixes the problem?
Turn on
verify_SSLfor the check.torproject.org request.IO::Socket::SSLis already a declared dependency. The response formatting is split into a pureformat_statusso the output contract is testable without a network call.Check lists (check
xin[ ]of list items)Additional Comments (if any)
t/30-status.tcovers the tor, non-tor and error branches.