Bug 37125 - MachineKeySection.Validation not set correctly from web.config
Summary: MachineKeySection.Validation not set correctly from web.config
Status: CONFIRMED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: master
Hardware: PC Linux
: Normal normal
Target Milestone: Future Release
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-12-17 16:40 UTC by Csaba Halász
Modified: 2016-08-30 04:54 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
proposed patch (700 bytes, patch)
2015-12-17 17:05 UTC, Csaba Halász
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 37125 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description Csaba Halász 2015-12-17 16:40:17 UTC
1. Add <machineKey validation="SHA1" /> to web.config under <configuration>/<system.web>
2. Create sample asp application that queries MachineKeySection as ConfigurationManager.GetSection("system.web/machineKey");
3. Examine Validation property of above section. You will see HMACSHA256 (the default) and not SHA1 as expected.
4. Examine ValidationAlgorithm property. You will see it is properly set as SHA1.

I think this bug has been introduced by commit a22389fde254675e52a9da9c9bcd18afdec29d33 but I haven't verified.
Debugging through the code, it is doing puzzling things, such as Config.AutoGenerate in the static constructor recursively calling back to ConfigurationManager.GetSection which is in the process of creating the instance in the first place. Things somehow get messed up and we end up with a half-parsed instance, even though no less than 4 (four!) constructors have been called. Overkill when we only really want a single instance.
Comment 1 Csaba Halász 2015-12-17 17:05:36 UTC
Created attachment 14339 [details]
proposed patch

This seems to work around the issue.