Skip to content

Strip a bare https backup token when the URL does not start at the scheme - #261

Merged
smarzban merged 3 commits into
mainfrom
security-fix/backup-url-scheme
Oct 22, 2026
Merged

smarzban merged 3 commits into
mainfrom
security-fix/backup-url-scheme

Conversation

@smarzban

Copy link
Copy Markdown
Owner

Summary

Finding backup.https-bare-userinfo.scheme-prefix.

credentials() in src/backup.rs treated every byte before :// as the scheme. A leading space or newline made that string fail the exact http/https test. A colon-free userinfo then returned None, so without_credentials left the token in place. sanitized_config wrote it into the backed-up config.toml, and the backup push published it. shown_location printed the same token. redacted() already masked it, because that scan uses only the trailing ASCII scheme token.

http and https are now that shared trailing token. The raw prefix is still returned, so a leading space stays in the reconstructed URL and a non-ASCII scheme such as é:// still reconstructs. An ssh URL with a bare user name is unchanged.

Test plan

  • cargo fmt --check
  • cargo clippy --lib --tests -- -D warnings
  • cargo test --lib backup::tests:: (46 passed, including a_prefixed_bare_https_token_is_not_pushed)
  • Reverted only the http-classification hunk by hand. a_prefixed_bare_https_token_is_not_pushed failed: without_credentials returned None for https://dummy-token@example.test/repo.git. Restored the hunk; the test passed.
  • cargo clippy --all-targets -- -D warnings and full cargo test were not run
  • Manual herdr open-board smoke (not applicable: backup URL parsing only)
  • cd site && npm ci && npm test && npm run build (site unchanged)
Open in Web Open in Cursor 

…heme.

credentials() treated every byte before :// as the scheme, so a leading
space or newline left a colon-free token in the pushed config and in
shown locations. http(s) now uses the same trailing scheme token as
redacted().

Finding: backup.https-bare-userinfo.scheme-prefix

Co-authored-by: Saeed <smarzban@users.noreply.github.com>
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
herdr-tsk Ready Ready Preview Oct 22, 2026 12:23pm UTC

@smarzban
smarzban merged commit a8922b5 into main Oct 22, 2026
7 checks passed
@smarzban
smarzban deleted the security-fix/backup-url-scheme branch October 22, 2026 12:32

This branch was successfully deployed

1 active deployment
Preview — c4c87a90 Deployed Oct 22, 2026 by vercel[bot]
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