
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Serilog.Enrichers.AspNetCore.RequestHeader
Advanced tools
Serilog enrichers with HTTP Request Header (.NET 8)
Enrich log with AspNetCore 8 request headers data.
Focus to retrieve common and custom headers from HTTP request. This includes:
WithHeaderCorrelationId
: Enrich with X-Correlation-ID
header or custom key as you want. Able to generate new correlation id if not found.
keyName
: Header key name for CorrelationId
.propertyName
: Property name to enrich. Default is CorrelationId
.generatedWhenNotExist
: Generate new correlation id and added to HTTP header if not fond. this generate by Guid.NewGuid()
method. Default is true
.generatedFormat
: Format of generated correlation id. Default is N
. more information see Guid.ToString(String).WithHeaderKey
: Enrich with custom header key.
keyName
: Header key name.propertyName
: Proerty name to enrich. If not set, keyName
will be used.Apply enricher to LoggerConfiguration
:
Log.Logger = new LoggerConfiguration()
.Enrich.WithHeaderCorrelationId(
keyName: "X-Correlation-ID",
generatedWhenNotExist: true,
generatedFormat: "N")
.Enrich.WithHeaderKey(
keyName: "CustomKey",
propertyName: "CustomProperty")
.CreateLogger();
another way, you can apply in appsettings.json
file with Serilog.Settings.Configuration
package:
{
"Serilog": {
"Using": [ "Serilog.Enrichers.AspNetCore" ],
"Enrich": [
{
"Name": "WithHeaderCorrelationId",
"Args": {
"keyName": "X-Correlation-ID",
"generatedWhenNotExist": true,
"generatedFormat": "N"
}
},
{
"Name": "WithHeaderKey",
"Args": {
"keyName": "CustomKey",
"propertyName": "CustomProperty"
}
},
{
"Name": "WithHeaderKey",
"Args": {
"keyName": "SameKeyNProperty"
}
}
]
}
}
Then add propertyName
to outputTemplate
:
{
"Serilog": {
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}][{CorrelationId}]{CustomProperty|SameKeyNProperty} {Message:lj} {Properties:j}{NewLine}"
}
}
]
}
}
FAQs
Serilog enrichers with HTTP Request Header (.NET 8)
We found that serilog.enrichers.aspnetcore.requestheader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.