summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Core/Messaging
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging')
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
index b26deeb..084403a 100644
--- a/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/MessagingUtilities.cs
@@ -21,6 +21,7 @@ namespace DotNetOpenAuth.Messaging {
using System.Text;
using System.Web;
using System.Web.Mvc;
+ using System.Xml;
using DotNetOpenAuth.Messaging.Bindings;
using DotNetOpenAuth.Messaging.Reflection;
@@ -290,6 +291,28 @@ namespace DotNetOpenAuth.Messaging {
}
/// <summary>
+ /// Creates the XML reader settings to use for reading XML from untrusted sources.
+ /// </summary>
+ /// <returns>
+ /// The new instance of <see cref="XmlReaderSettings"/>.
+ /// </returns>
+ /// <remarks>
+ /// The default values set here are based on recommendations from
+ /// http://msdn.microsoft.com/en-us/magazine/ee335713.aspx
+ /// </remarks>
+ internal static XmlReaderSettings CreateUntrustedXmlReaderSettings() {
+ return new XmlReaderSettings {
+ MaxCharactersFromEntities = 1024,
+ XmlResolver = null,
+#if CLR4
+ DtdProcessing = DtdProcessing.Prohibit,
+#else
+ ProhibitDtd = true,
+#endif
+ };
+ }
+
+ /// <summary>
/// Clears any existing elements in a collection and fills the collection with a given set of values.
/// </summary>
/// <typeparam name="T">The type of value kept in the collection.</typeparam>