Skip to content

Commit

Permalink
Don't use GetRawData for logging (#10450)
Browse files Browse the repository at this point in the history
  • Loading branch information
StekPerepolnen authored Oct 15, 2024
1 parent 341b429 commit b390c9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
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

0 comments on commit b390c9d

Please sign in to comment.