mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
C#: Add LogForging testcase based on ASP.NET.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Headers;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
public class AspController : ControllerBase
|
||||
{
|
||||
public void Action1(string username)
|
||||
{
|
||||
var logger = new ILogger();
|
||||
// BAD: Logged as-is
|
||||
logger.Warn(username + " logged in");
|
||||
}
|
||||
|
||||
public void Action1(DateTime date)
|
||||
{
|
||||
var logger = new ILogger();
|
||||
// GOOD: DateTime is a sanitizer. (FALSE POSITIVE)
|
||||
logger.Warn($"Warning about the date: {date:yyyy-MM-dd}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user