-
Notifications
You must be signed in to change notification settings - Fork 9
Add .NET 9,.NET 10. Drop .NET 10. Upgrade to latest L3 specification draft. #24
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
base: main
Are you sure you want to change the base?
Conversation
…OptionsFactory` and enhance certificate handling logic in tests. Fix all tests.
…ss to simplify NET version-specific conditional logic and improve comments readability.
| var element = JsonSerializer.Deserialize<JsonElement>(json); | ||
| var intendedJson = JsonSerializer.Serialize(element, _jsonSerializerOptions); | ||
| _logger.LogInformation($"Request {context.Request.Method} {context.Request.GetEncodedPathAndQuery()}{Environment.NewLine}Body:{Environment.NewLine}{intendedJson}"); | ||
| _logger.LogRequestInformation(context.Request.Method, context.Request.GetEncodedPathAndQuery(), intendedJson); |
Check failure
Code scanning / CodeQL
Log entries created from user input High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 1 month ago
The best way to fix this issue is to sanitize any user-controlled values before logging them. Specifically, the HTTP method (context.Request.Method), path and query (context.Request.GetEncodedPathAndQuery()), and body (intendedJson) should be stripped of any new line or carriage return characters that could lead to log spoofing. For plain text logs, using string.Replace("\r", "") and string.Replace("\n", "") will remove line breaks. The changes should be made in the middleware, prior to logging (i.e., in InvokeAsync). Only these arguments need to be sanitized before being passed to the logger.
Thus, update the arguments on line 41 as follows:
- Sanitize
context.Request.Method - Sanitize
context.Request.GetEncodedPathAndQuery() - Sanitize
intendedJson
No new imports are needed; use string.Replace methods.
-
Copy modified lines R41-R45
| @@ -38,7 +38,11 @@ | ||
| var json = Encoding.UTF8.GetString(ms.ToArray()); | ||
| var element = JsonSerializer.Deserialize<JsonElement>(json); | ||
| var intendedJson = JsonSerializer.Serialize(element, _jsonSerializerOptions); | ||
| _logger.LogRequestInformation(context.Request.Method, context.Request.GetEncodedPathAndQuery(), intendedJson); | ||
| // Sanitize user-controlled values to prevent log forging | ||
| string sanitizedMethod = context.Request.Method.Replace("\r", "").Replace("\n", ""); | ||
| string sanitizedPathAndQuery = context.Request.GetEncodedPathAndQuery().Replace("\r", "").Replace("\n", ""); | ||
| string sanitizedIntendedJson = intendedJson.Replace("\r", "").Replace("\n", ""); | ||
| _logger.LogRequestInformation(sanitizedMethod, sanitizedPathAndQuery, sanitizedIntendedJson); | ||
| await next(context); | ||
| } | ||
| } |
…ification links with stable references.
…ticationResponseJSON`.
…WebAuthn Level 3 specification links.
…thn specification link and improve comments readability.
… specification links and improve comments readability
…specification links and improve comments readability
…n specification links and improve comments readability
… specification link and improve comments readability
…specification links and improve comments readability
…uthn specification links and improve comments readability
…thentication response handling while updating WebAuthn links with stable references.
…specification links and improve readability.
…specification links.
…n specification links and improve comments readability.
…able WebAuthn specification links and improve comments readability
…le WebAuthn specification links and improve comments readability
… specification links and refine comments for clarity
… stable WebAuthn specification links and refine comments for clarity
…etAttestationStatementVerifier` documentation to use stable WebAuthn specification links and refine comments for clarity
…to use stable WebAuthn specification links
… use stable WebAuthn specification links
…able WebAuthn specification links
…e WebAuthn specification links
…ble WebAuthn specification links
… WebAuthn specification links
…cation links and remove unused `GetRootRsaKeys` method
…rename existing files for contextual clarity, and add a new certificate.
…to use stable WebAuthn specification links and improve comment clarity
…WebAuthn specification links and refine comment clarity
…roidSafetyNetRoots` documentation to use stable WebAuthn specification links and improve comment clarity
…ion to use stable WebAuthn specification links and improve comment clarity
…Authn specification links
…use stable WebAuthn specification links
… stable WebAuthn specification links
…WebAuthn specification links
…se stable WebAuthn specification links
…foDecoder` documentation to use stable WebAuthn specification links
…ble WebAuthn specification links
…PathValidator` documentation to use stable WebAuthn specification links
…specification links
…otAttestedAuthenticatorData`, `AttestedAuthenticatorData`, and `DefaultChallengeGenerator`
…specification links
…le updating to stable WebAuthn links in client data processing
No description provided.