Skip to content

Don't use GetRawData for logging #10450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class TMonitoringRestServiceActor : public NActors::TActor<TMonitoringRestServic
.Build()
);
auto ticket = CredentialsProvider->GetAuthInfo();
LOG_D(httpRequest->GetRawData() << " using ticket " << NKikimr::MaskTicket(ticket));
LOG_D(httpRequest->GetObfuscatedData() << " using ticket " << NKikimr::MaskTicket(ticket));
httpRequest->Set("Authorization", ticket);

auto httpSenderId = Register(NYql::NDq::CreateHttpSenderActor(SelfId(), HttpProxyId, NYql::NDq::THttpSenderRetryPolicy::GetNoRetryPolicy()));
Expand All @@ -83,7 +83,7 @@ class TMonitoringRestServiceActor : public NActors::TActor<TMonitoringRestServic
forwardResponse->Issues.AddIssue(error);
Send(request->Sender, forwardResponse.release(), 0, request->Cookie);
return;
}
}

try {
NJson::TJsonReaderConfig jsonConfig;
Expand Down
4 changes: 3 additions & 1 deletion ydb/library/actors/http/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,13 @@ class THttpResponse {

template <typename HeaderType, typename BufferType>
class THttpBase : public HeaderType, public BufferType {
public:
protected:
// Returns raw, non-obfuscated data
TStringBuf GetRawData() const {
return TStringBuf(BufferType::Data(), BufferType::Size());
}

public:
TString GetObfuscatedData() const {
THeaders headers(HeaderType::Headers);
TStringBuf authorization(headers["Authorization"]);
Expand Down
2 changes: 1 addition & 1 deletion ydb/mvp/oidc_proxy/oidc_protected_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void THandlerSessionServiceCheck::HandleProxy(NHttp::TEvHttpProxy::TEvHttpIncomi
}
} else {
static constexpr size_t MAX_LOGGED_SIZE = 1024;
LOG_DEBUG_S(ctx, EService::MVP, "Can not process request to protected resource:\n" << event->Get()->Request->GetRawData().substr(0, MAX_LOGGED_SIZE));
LOG_DEBUG_S(ctx, EService::MVP, "Can not process request to protected resource:\n" << event->Get()->Request->GetObfuscatedData().substr(0, MAX_LOGGED_SIZE));
httpResponse = CreateResponseForNotExistingResponseFromProtectedResource(event->Get()->GetError());
}
ctx.Send(Sender, new NHttp::TEvHttpProxy::TEvHttpOutgoingResponse(httpResponse));
Expand Down
Loading