Repository navigation
Commit 50e4654
Redact credentials from logged URLs, VEX product ids and hosted Composer locks (#1026)
* Redact credentials from every URL the CLI shows or logs
Add utils::redact, the one place a URL is made safe to show: userinfo,
the Socket grant-token path level (the level before the patch uuid under
/patch/ or /patch-registry/) and secret query values become <redacted>.
Route every emission through it:
- VendorWarning::new redacts its detail, so the vendor_prebuilt_downloaded
advisory (8 hand-written copies, now one VerifiedArchive::
downloaded_warning builder) no longer puts the grant URL into --json
events and --verbose output;
- registry_fetch::download and maven_repo::fetch_registry_bytes errors
(GOPROXY / .npmrc / mirror userinfo, reqwest's own error text);
- api::client debug_log, network_error_detail and the artifact
not-found / still-building / non-http errors;
- telemetry::sanitize_error_message; patch_fetch_failed now reports the
uuid field only when the identifier is a uuid, not a CVE, purl or
private package name.
Consolidation: redirect::redact_grant_token (1 caller, vlt preflight) is
deleted and the caller routed through redact_urls_in; the userinfo-safe
host extractor hosted::guidance::url_host and the upstream/uv.rs copy
are replaced by utils::redact::url_host. A ratchet test pins the
download advisory to its single builder.
Audit B26.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Keep git remote credentials out of the VEX product @id
remote_url_to_purl fell back to the raw origin URL for any host other
than github.com / gitlab.com / bitbucket.org and for any non owner/repo
path (a GitLab subgroup), so a CI clone's
https://gitlab-ci-token:<job token>@host/... or https://<PAT>@host/...
was published verbatim in the OpenVEX document. The fallback now goes
through utils::redact::strip_url_credentials (userinfo and secret query
parameters dropped); an ssh login name (ssh://git@host/...) and
scp-like remotes stay as they were, so existing product ids do not move.
Audit B21.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Drop Composer transport-options in the hosted lock rewrite
Composer copies a repository's options (http.header auth tokens, ssl
client certificates, http.proxy) into every lock entry it resolves from
it as transport-options, and applies them to that entry's dist download.
The hosted rewrite retargeted dist.url to the patch host but kept
transport-options, so every composer install sent the private
repository's credentials to the hosted patch server.
The origin-bound entry members are now one list,
formats::composer::ORIGIN_BOUND_ENTRY_KEYS (source, transport-options),
used by both backends: the vendored rewrite_lock_entry (which already
dropped both by hand) and the hosted apply_dist_edit, which now drops
each member, re-scanning between removals so adjacent members never
leave a dangling comma, and widens the recorded edit to cover every
changed byte so the ledger's fragment revert restores them. A new
warning, redirect_composer_transport_options_removed, says so.
New golden case composer-lock/transport-options (plus its vex-discover
golden entry) and a unit test over five member layouts.
Fixes #399. Audit B02.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Tighten the URL redactor and share its host parser
Each element of a comma-joined URL list (GOPROXY) is now redacted on its
own, an ssh login name without a password is kept, and short secret
markers (auth, key, sig, pass) only match whole words of a query
parameter name, so author/keyword/design are no longer redacted.
The gem mirror and vex-consumed cargo registry host parsers now use the
new utils::redact::url_hostname instead of their own userinfo-stripping
authority split. The VEX product test pins that a username-only https
remote loses its user@ in the product @id.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Send every debug line through one redacting printer
telemetry, jvm_cache and the API client each had their own debug_log,
and socket_cli_config, reuse, concurrent and process printed raw
eprintln! lines. Only the API client redacted URLs, so the telemetry
endpoint and the socket-cli apiBaseUrl were printed with any userinfo.
env_compat::debug_log (and debug_message for the API client's deferred
lines) is now the one printer and redacts every URL. A ratchet test
fails when a core module prints its own [socket-patch ...] line again.
The CLI update notifier redacts its lines too. Adds a client test that
the artifact errors never quote the grant token or userinfo.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Redact hosted skip details with the shared redactor
wheel_metadata_unavailable and npm_manifest_unavailable replaced only a
byte-exact copy of the artifact URL with <hosted artifact>, so a URL
reqwest re-rendered, or any other URL in the text, kept its grant token.
They and the vlt ARTIFACT_UNVERIFIABLE warning now go through
engine::redact_artifact_text: utils::redact::redact_urls_in, then the
artifact's own grant token (known from its patch uuid), which also
covers a custom --api-url serve root or a non-canonical patch id.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Pin redaction at the vendor warning and download error sites
Regression tests for B26 at the routing points: VendorWarning::new, the
vendor_prebuilt_downloaded advisory, and registry_fetch::download for a
refused scheme, an HTTP 404 and a refused connection. Removing the
redact call from any of them now fails a test.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Bound the composer dist edit to its entry
apply_dist_edit cloned the whole composer.lock and diffed it end to end
for every redirected package. It now edits a copy of the entry object
alone and splices it back once. Output is unchanged: the in-place sweep
passes against the golden blessed before this change.
The sweep now also generates entries with transport-options and
requires a case to reach redirect_composer_transport_options_removed;
its golden is re-blessed for the new inputs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Pin the redacted hosted skip details in the scan tests
The npm manifest and wheel metadata skip details no longer hide the
whole artifact URL behind <hosted artifact>; they quote it through the
shared redactor. The yarn berry test now checks the grant-token level is
redacted. The wheel fixture's URL has no grant token, so that test only
checks a detail is present; core's
hosted_skip_details_never_carry_the_grant_token covers the redaction.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Rename the secret loop variable in the redaction tests
CodeQL's rust/cleartext-logging matched the variable name `secret` in
two test assertion messages (alerts 195, 196). The values are test
literals that the assertions prove absent; renaming the binding clears
the false positive without changing what the tests check.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Warn that Composer rollback cannot restore transport-options
The hosted rewrite drops a lock entry's transport-options so a private
repository's auth headers, client certificates and proxy settings are
not sent to the patch host. The upstream restore used by rollback and
remove rebuilds only dist and source from packagist, so those options
do not come back. Say so in the pin-time warning, warn again at restore
time when composer.json declares repository options, and correct the
doc comments that claimed a ledger revert always restores them.
Co-Authored-By: Claude <noreply@anthropic.com>
* Scope the Composer restore warning to packagist options
Composer copies a repository's options only into the lock entries it
resolves from that repository, and the upstream restore only restores
packagist-origin entries. Warn only when composer.json gives packagist
itself options, so a private repository's auth headers no longer make
every packagist restore claim it lost transport-options. Also stop
recommending a bare `composer update <pkg>`, which can move the package
and its dependents to newer versions: tell the user to re-lock it at the
locked version instead.
Co-Authored-By: Claude <noreply@anthropic.com>
* Read the packagist host through url_hostname
A packagist repository URL with user:pass@ userinfo was read as the
username, so the transport-options restore warning was skipped for it.
Use the shared url_hostname helper, which skips userinfo and the port.
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent f84535b commit 50e4654
46 files changed
Lines changed: 1755 additions & 575 deletions
File tree
- crates
- socket-patch-cli
- src
- commands
- tests/scan
- socket-patch-core
- src
- api
- crawlers
- formats
- composer
- gem
- hosted
- patch/redirect
- upstream
- utils
- vendor
- vex/discover
- tests
- equivalence
- fixtures
- redirect/composer/composer-lock/transport-options
- expected
- input
- restored
- vex-discover-golden
- docs/testing
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
364 | 359 | | |
365 | 360 | | |
366 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
150 | 153 | | |
151 | 154 | | |
152 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
238 | 239 | | |
239 | | - | |
240 | | - | |
| 240 | + | |
| 241 | + | |
241 | 242 | | |
242 | 243 | | |
243 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | | - | |
| 47 | + | |
45 | 48 | | |
46 | 49 | | |
47 | 50 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
99 | 104 | | |
100 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
101 | 109 | | |
102 | 110 | | |
103 | 111 | | |
| |||
1694 | 1702 | | |
1695 | 1703 | | |
1696 | 1704 | | |
1697 | | - | |
| 1705 | + | |
| 1706 | + | |
1698 | 1707 | | |
1699 | 1708 | | |
1700 | 1709 | | |
| |||
1843 | 1852 | | |
1844 | 1853 | | |
1845 | 1854 | | |
1846 | | - | |
1847 | | - | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
1848 | 1863 | | |
1849 | 1864 | | |
1850 | 1865 | | |
| |||
2831 | 2846 | | |
2832 | 2847 | | |
2833 | 2848 | | |
2834 | | - | |
| 2849 | + | |
| 2850 | + | |
2835 | 2851 | | |
2836 | 2852 | | |
2837 | 2853 | | |
| |||
2883 | 2899 | | |
2884 | 2900 | | |
2885 | 2901 | | |
2886 | | - | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
2887 | 2906 | | |
2888 | 2907 | | |
2889 | 2908 | | |
2890 | 2909 | | |
2891 | 2910 | | |
2892 | | - | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
2893 | 2915 | | |
2894 | 2916 | | |
2895 | 2917 | | |
| |||
5121 | 5143 | | |
5122 | 5144 | | |
5123 | 5145 | | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
| 5160 | + | |
| 5161 | + | |
| 5162 | + | |
| 5163 | + | |
| 5164 | + | |
| 5165 | + | |
| 5166 | + | |
| 5167 | + | |
| 5168 | + | |
| 5169 | + | |
| 5170 | + | |
| 5171 | + | |
| 5172 | + | |
| 5173 | + | |
| 5174 | + | |
| 5175 | + | |
5124 | 5176 | | |
5125 | 5177 | | |
5126 | 5178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 141 | + | |
144 | 142 | | |
145 | 143 | | |
146 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
263 | 264 | | |
264 | 265 | | |
265 | 266 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
25 | 43 | | |
26 | 44 | | |
27 | 45 | | |
| |||
0 commit comments