8000 [Security] Remove logging of http request information [1.13.x] by rokatyy · Pull Request #3549 · nuclio/nuclio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Security] Remove logging of http request information [1.13.x] #3549

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 1 commit into from
Mar 19, 2025
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
3 changes: 1 addition & 2 deletions pkg/nuctl/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ func (c *NuclioAPIClient) sendRequest(ctx context.Context,
"Sending API request",
"method", method,
"url", url,
"headers", requestHeaders,
"body", string(requestBody))
"bodyLen", len(requestBody))

// create authorization headers
authHeaders, err := c.createAuthorizationHeaders(ctx)
Expand Down
3 changes: 1 addition & 2 deletions pkg/platform/abstract/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ func (i *invoker) invoke(ctx context.Context,
"Executing function",
"method", createFunctionInvocationOptions.Method,
"url", fullpath,
"bodyLength", len(createFunctionInvocationOptions.Body),
"headers", req.Header)
"bodyLength", len(createFunctionInvocationOptions.Body))

response, err := client.Do(req.WithContext(ctx))
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/processor/build/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1778,8 +1778,7 @@ func (b *Builder) downloadFunctionFromURL(tempFile *os.File,

b.logger.DebugWith("Downloading function",
"url", functionPath,
"target", tempFile.Name(),
"headers", headers)
"target", tempFile.Name())

return common.DownloadFile(functionPath, tempFile, headers)
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/processor/runtime/golang/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ func builtInHandler(context *nuclio.Context, event nuclio.Event) (interface{}, e
"Source", event.GetTriggerInfo().GetKind(),
"ID", event.GetID(),
"Time", event.GetTimestamp().String(),
"Headers", event.GetHeaders(),
"ContentType", event.GetContentType(),
"ShardID", event.GetShardID(),
"Body", string(event.GetBody()))
"ShardID", event.GetShardID())

return "Built in handler called", nil
}
Expand Down
3 changes: 0 additions & 3 deletions pkg/processor/trigger/http/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,13 @@ func (h *http) preflightRequestValidation(ctx *fasthttp.RequestCtx) bool {
corsConfiguration := h.configuration.CORS
if !corsConfiguration.OriginAllowed(origin) {
h.Logger.DebugWith("Origin is not allowed",
"origin", origin,
"allowOrigins", h.configuration.CORS.AllowOrigins)
return false
}

// request is outside the scope of CORS specifications
if !corsConfiguration.MethodAllowed(accessControlRequestMethod) {
h.Logger.DebugWith("Request method is not allowed",
"accessControlRequestMethod", accessControlRequestMethod,
"allowMethods", h.configuration.CORS.AllowMethods)
return false
}
Expand Down Expand Up @@ -361,7 +359,6 @@ func (h *http) preHandleRequestValidation(ctx *fasthttp.RequestCtx) bool {
origin := common.ByteSliceToString(ctx.Request.Header.Peek("Origin"))
if !h.configuration.CORS.OriginAllowed(origin) {
h.Logger.DebugWith("Origin is not allowed",
"origin", origin,
"allowOrigins", h.configuration.CORS.AllowOrigins)
return false
}
Expand Down
22 changes: 4 additions & 18 deletions pkg/restful/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"strings"
"time"

"github.com/nuclio/nuclio/pkg/common"
"github.com/nuclio/nuclio/pkg/common/headers"

"github.com/go-chi/chi/v5/middleware"
Expand Down Expand Up @@ -112,26 +111,13 @@ func RequestResponseLogger(logger logger.Logger) func(next http.Handler) http.Ha

// when request processing is done, log the request / response
defer func() {
logVars := []interface{}{
logger.DebugWithCtx(request.Context(),
"Handled request",
"requestMethod", request.Method,
"requestPath", request.URL,
"requestHeaders", requestHeaders,
"requestBody", string(requestBody),
"requestBodyLen", len(requestBody),
"responseStatus", responseWrapper.Status(),
"responseTime", time.Since(requestStartTime).String(),
}

// response body is too spammy
if !common.StringSliceContainsStringPrefix([]string{
"/api/functions",
"/api/function_templates",
"/api/v3io_streams",
"/kaniko",
}, strings.TrimSuffix(request.URL.Path, "/")) {
logVars = append(logVars, "responseBody", responseBodyBuffer.String())
}

logger.DebugWithCtx(request.Context(), "Handled request", logVars...)
"responseTime", time.Since(requestStartTime).String())
}()

// call next middleware
Expand Down
Loading
0