-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Don't log action and page handler arguments above Trace level #9227
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which milestone is this PR intended for? Doesn't look like an approval process has begun.
As per #9121, can we please keep logging the action arguments, but just use a different log level that allows us to include possibly sensitive information? So |
@poke sure. I can log it as a separate log message at debug level. I do want to keep the log level for the current action executing \ page executing unchanged at Info. |
That’s perfect! Thanks a lot! |
1, | ||
"Executing action method {ActionName} with arguments ({Arguments}) - Validation state: {ValidationState}"); | ||
_actionMethodExecutingWithArguments = LoggerMessage.Define<string, string[]>( | ||
LogLevel.Debug, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be Trace
not debug. Debug is not supposed to include sensitive information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did consider setting this to trace. While not identical, we do log some other things including the RVD at Debug level: https://github.com/aspnet/AspNetCore/blob/ee0fb6d0e268afcb4848c64ef42a0cb0f48f8e3f/src/Mvc/Mvc.Core/src/Internal/MvcCoreLoggerExtensions.cs#L779-L782
Should I do a pass over these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't consider route values to be sensitive.
@pranavkm the next shiproom meeting is tomorrow at 11:00. Please add the requisite label and approval template before that. We aren't meeting again before the merge deadline and discussions in the room tend to go quicker. |
Approved for 2.1.11, 2.2.5 and 3.0. |
Logs from controllers and Razor Pages with this change |
With this change, is there a way now to say which overload of a method is being executed? Say there's one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pranavkm please let me know if this is ready to merge. That is, do you have additional changes you want to make?
@poke unfortunately that seems to be the case. I had a look at if there's a straightforward solution to including this information in these logs, but that not seem to be the case. We can certainly make this nicer in 3.0. For 2.1 and 2.2, a possible workaround add a trace level filter for the category
|
59bddbf
to
070e855
Compare
@pranavkm please let me know if this is ready to merge. |
🆙📅 to do the needful in PatchConfig.props |
@pranavkm What do you think about including the number of arguments in the log message? That way it should give a good idea which overload is called (not perfect but better than nothing). And it would be straight forward to do so to. (I don't want to further delay this PR with this though, so feel free to merge this for now and maybe we can look at it again for 3.0) |
We talked about including the types of the arguments on Thursday. We have some existing code that does this elsewhere. |
Once merged, will this need to be part of 2.2.x as well? If so, make sure the bot-generated PR is completed, which should be opened shortly after this PR is completed. |
b188d80
to
ad391ae
Compare
🆙 📅 |
Here's what it looks like now:
|
@natemcmaster \ @dougbu could you merge? |
Verified this change is also present in 2.2.5. |
Which version did this make it into? We are using 2.1.7 and I see no 2.1 updates since |
You can view the various downloads for 2.X releases at https://dotnet.microsoft.com/download/dotnet-core |
We're targetting .NET Framework with ASP.NET Core, I see the
Microsoft.AspNetCore package has not been updated since v 2.1.7
I've reached out to the feature team also, but may as well ask here - is
this package going to be updated for those of us on .NET Framework and
ASP.NET Core 2.1 LTS?
…On Thu, Aug 8, 2019 at 6:11 PM Vivek Mishra ***@***.***> wrote:
You can view the various downloads for 2.X releases at
https://dotnet.microsoft.com/download/dotnet-core
We are at v2.1.12 for 2.1.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#9227>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAT4R2EVGAQ2XGRX466RVULQDS75JANCNFSM4HEXDXPQ>
.
|
@fiksen99 for .NET Framework, the change would be in the corresponding |
Thanks, I initially thought that would be the case, but in the |
The changes are in AspNetCore.Mvc.Core and AspNetCore.Mvc.RazorPages, version 2.1.11 each. I am not sure why the parent package AspNetCore.Mvc wasn't updated to transitively deliver these versions. I would assume that this is actually a publishing bug, since neither Mvc.Core nor Mvc.RazorPages are packages that you usually have to depend on explicitly on netfx. |
Thanks. Do you know who owns updating the AspNetCore.Mvc package, and are they aware of this issue? Are there any potential implications of referenceing AspNetCore.Mvc 2.1.3 and then directly referencing AspNetCore.Mvc.Core 2.1.11+? Or are they intended to be backwards compatible? |
That should work. Referencing the newer version explicitly will make AspNetCore.Mvc use that version (instead of the older one) too. |
makes sense. Would be great to get the entire main Mvc package released too. I assume given 2.1 is LTS, the intention is that these packages continue to receive updates |
Fixes #9121
Impact
The contract for logging says any sensitive information would be logged at
LogLevel.Trace
. However, MVC logs some user inputs which could contain potentially sensitive information atLogLevel.Info
Workaround
Workaround is to disable Info logging for Mvc.
Risk
This should be fairly low risk. Logging MVC is disabled in production applications.