Repository navigation
fix: redact credentials from request URLs in error messages - #1512
Open
pcbeingused33 wants to merge 3 commits into
Open
pcbeingused33 wants to merge 3 commits into
pcbeingused33 wants to merge 3 commits into
Conversation
Failed network requests reported the full request URL, which for Cesium ion includes the access_token query parameter, so tokens leaked into logs. Add Uri::redactCredentials and use it when formatting request failures.
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.
Fixes #1498
Description
When a network request fails, several error messages include the full request URL. For Cesium ion requests that URL carries the
access_tokenquery parameter, and other providers usekey=. As a result the token ends up in logs, e.g.GET `https://api.cesium.com/v1/assets/<id>/endpoint?access_token=<token>` failed: ...fromCurlAssetAccessor.CesiumUtility::Uri::redactCredentials(uri), which replaces the values of theaccess_tokenandkeyquery parameters withREDACTED. URIs that are invalid or have neither parameter are returned unchanged.CurlAssetAccessor(both request paths),NetworkAssetDescriptor,IonRasterOverlay,CesiumIonTilesetLoaderandRasterOverlayTileProvider. The requests themselves and the endpoint cache still use the original URL.The redacted keys are limited to
access_tokenandkey; the list can be extended, or narrowed toaccess_tokenonly, if preferred.Issue number or link
Fixes #1498
Author checklist
CHANGES.mdwith a short summary of my change (for user-facing changes).Testing plan
New
Uri::redactCredentialscases inCesiumUtility/test/TestUri.cppcheck thataccess_tokenis redacted, thatkeyis redacted while other parameters are kept, and that URIs without credentials are left unchanged. They fail without the change and pass with it, and the existingTestUri.cppcases still pass. These tests ran in a standalone build ofUri.cpp+TestUri.cppagainst ada and doctest, not the full CMake/vcpkg build, so CI is the first full compile of the call-site changes. Changed files were formatted with the repo's pinned clang-format.To reproduce the original issue: load a Cesium ion asset with a valid token while network requests fail (for example, a TLS failure), and look at the logged error. On
mainit containsaccess_token=<token>; on this branch it containsaccess_token=REDACTED.This change and its tests were prepared with the help of an AI coding assistant.