Fixing insufficient logging of exceptions
Security-related events such as user authentication or enabling and disabling of two-factor authentication (2FA)—when this occurs—must be recorded and kept track of. These events are essential for auditing in order to understand the sequence of events when a security incident happens.
In this recipe, we will fix the insufficient logging of security-related exceptions by utilizing ASP.NET Core's built-in logging provider.
Getting ready
For the recipes of this chapter, we will need a sample Online Banking app.
Open the command shell and download the sample Online Banking app by cloning the ASP.NET-Core-Secure-Coding-Cookbook
repository, as follows:
git clone https://github.com/PacktPublishing/ASP.NET-Core-Secure-Coding-Cookbook.git
Run the sample app to verify that there are no build or compile errors. In your command shell, navigate to the sample app folder at \Chapter11\insufficient-logging-exception\before...