Conversation
Debug mode (--debug / TICLOUD_DEBUG) dumped full HTTP requests and responses, including the Authorization header, OAuth access/refresh tokens, the OAuth client secret, cloud storage access keys and SAS tokens in import/export/audit-log request bodies, and pre-signed URL signatures. config describe printed private-key, oauth-client-secret and access-token, and config set echoed the value of private-key and oauth-client-secret. Add internal/redact with one masking implementation for headers, JSON body fields, pre-signed URL query parameters and profile properties, plus a DebugTransport that prints masked dumps. Non-JSON bodies (file uploads, export downloads) are not read; only their size is printed. Route every debug path through it: - cloud.NewDebugTransport (Bearer and Digest API clients) - resty clients in auth login/logout/whoami, the S3 uploader and the export download helper (replaces resty SetDebug) - config describe masks private-key, oauth-client-secret, access-token - config set prints *** for private-key and oauth-client-secret - generated v1beta1 clients no longer include bodies in the cfg.Debug dump Add internal/redact tests that assert a bearer token, cloud AKSK, SAS token, pre-signed URL signature and Set-Cookie value do not appear in the dump while request and response bodies remain readable.
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.
Problem
Debug mode (
--debug/TICLOUD_DEBUG) dumped full HTTP requests and responses. The dump contained:Authorizationheader (Bearer token, Digest metadata)auth login/auth logoutbodiesconfig describeprintedprivate-key,oauth-client-secretandaccess-token(with--insecure-storage).config setechoed the value ofprivate-keyandoauth-client-secret.Change
internal/redact: one masking implementation for headers, JSON body fields, pre-signed URL query parameters and profile properties, plus aDebugTransportthat prints masked dumps. Non-JSON bodies (uploads, downloads) are not read; only their size is printed.cloud.NewDebugTransportdelegates to it (covers Bearer and Digest API clients).auth login/logout/whoami, the S3 uploader and the export download helper wrap their existing transport with it instead of calling restySetDebug.config describemasksprivate-key,oauth-client-secret,access-token.public-keystays visible.config setprints***forprivate-keyandoauth-client-secret.cfg.Debugdump passesbody=false. Auth headers are added below that layer, so the remaining dump carries no credentials. This is a mechanical patch of generated files; a regeneration would revert it, but transport-level masking still applies.Behavior notes
--debugstill prints method, URL, headers, status and JSON bodies, with only credential fields replaced by***.Tests
configdescribe/set androot_test.goexpectations updated for the mask.internal/redact/redact_test.gosends a request with a bearer token, cloud AKSK body, pre-signed URL parameters and a Set-Cookie response through the dumper and asserts none of them appear in the output while request and response bodies remain readable.go build ./...,go vet ./...,go test ./...pass.