Skip to content

fix: harden update checker (sanitize tag, add HTTP timeout)#29

Merged
fslongjin merged 3 commits intofslongjin:masterfrom
staryxchen:bugfix/update_checker
Mar 3, 2026
Merged

fix: harden update checker (sanitize tag, add HTTP timeout)#29
fslongjin merged 3 commits intofslongjin:masterfrom
staryxchen:bugfix/update_checker

Conversation

@staryxchen
Copy link
Contributor

Changes

  • Sanitize tag field: Filter update_info.tag to only allow alphanumeric, ., -, _ characters before embedding it in the cargo install command shown to users, preventing potential command injection via MITM-poisoned responses.
  • Add HTTP timeout: Replace bare reqwest::get() with a client configured with 5s connect timeout and 10s total timeout, preventing the tool from blocking indefinitely when the update server is unreachable.
  • Bump version to 0.7.2

Context

The update checker had two issues:

  1. The tag field from the server response was used directly in a displayed cargo install command with no validation.
  2. No timeout was set on the HTTP request, causing the entire tool to stall when cache was cold and the server was slow/unreachable.

- Sanitize tag input to allow only alphanumeric, '.', '-', '_' characters.
- Use sanitized tag in the installation command output.

Signed-off-by: staryxchen <staryxchen@tencent.com>
- Set connect_timeout and timeout for improved request reliability

Signed-off-by: staryxchen <staryxchen@tencent.com>
- Update version in Cargo.toml to 0.7.2
- Update installation commands in README files to v0.7.2

Signed-off-by: staryxchen <staryxchen@tencent.com>
@fslongjin fslongjin merged commit 8161487 into fslongjin:master Mar 3, 2026
4 checks passed
@staryxchen staryxchen deleted the bugfix/update_checker branch March 3, 2026 03:04
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.

2 participants