Add timeout to GitHub update-check HTTP client#201
Merged
Conversation
The ASHIRT API client already sets connect/request timeouts, but the GitHub release update check built a bare reqwest client with none, so an unresponsive api.github.com could hang the update check indefinitely. Build the update-check client with the same 10s connect / 30s request timeouts as the ASHIRT client. Addresses F-04 (CWE-400).
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
The ASHIRT API client already sets connect/request timeouts (
src/ashirt/http.rs), but the GitHub release update check built a barereqwest::blocking::Client::new()with no timeout, so an unresponsiveapi.github.comcould hang the update check indefinitely.This builds the update-check client with the same 10s connect / 30s request timeouts as the ASHIRT client.
Context
This addresses F-04 (CWE-400), originally raised against the pre-rewrite Go codebase in #142. That PR is stale (the Go code is gone after the Rust rewrite in #159); this reapplies the fix to the current Rust code.
While reviewing the other stale security PRs against the current codebase:
Testing
cargo buildclean;cargo testfor the update module passes (21 tests).