Skip to content

Redact query strings from logged and raised request URLs - #76

Merged
trevor-e merged 2 commits into
EmergeTools:mainfrom
bisho:redact-presigned-urls
Nov 13, 2026
Merged

trevor-e merged 2 commits into
EmergeTools:mainfrom
bisho:redact-presigned-urls

Conversation

@bisho

@bisho bisho commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Problem

Presigned upload URLs returned by the API (zip_url, uploadURL) carry signatures and temporary AWS session tokens in their query string.

The CLI prints these URLs in full in some situations:

  • --debug logs the upload URL
  • On errors, the URL is printed even with no --debug flag

CLI output often ends up in public CI logs, so anyone reading the log can use the URL to upload content until it expires.

Change

  • Add Network.redact_uri, which replaces the query string with [REDACTED].
  • Use it everywhere a request URL is logged or included in an exception message: the debug request line, the request-failure error and raise, the error after the last retry, and the snapshot batch upload debug line.
  • Add unit tests in test/utils/network_test.rb.

The redaction applies to every request URL, not only presigned ones. Emerge API query parameters aren't sensitive, but hiding them costs little debugging detail and keeps the rule simple.

Testing

bundle exec rake test: 55 tests pass. rubocop reports no offenses on the changed files.

bisho and others added 2 commits November 13, 2026 01:29
Presigned upload URLs (e.g. the S3 `zip_url` / `uploadURL` returned by
the API) carry signatures and temporary AWS session tokens in their query
string.

The CLI prints these URLs in full in some situations:
- `upload snapshots --debug` logs the upload URL
- On errors, the URL is printed even with no `--debug` flag

CLI output frequently lands in public CI logs, so anyone reading the log
could use the URL to upload arbitrary content until it expires.

This adds `Network.redact_uri`, which replaces the query string with
`[REDACTED]`, and use it everywhere a request URL is logged or included
in an exception message.
@trevor-e
trevor-e merged commit 9f15c18 into EmergeTools:main Nov 13, 2026
3 of 4 checks passed
@trevor-e trevor-e mentioned this pull request Nov 13, 2026
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