Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > XslTransform "Invalid Xml" Security Problem

Reply
Thread Tools

XslTransform "Invalid Xml" Security Problem

 
 
Matthias Truxa
Guest
Posts: n/a
 
      07-09-2005
Hello,

I've got a serious Problem from out of nowhere that I'm not able to solve.
Can someone please help me here?

I'm trying to instantiate a Xslt document build in as a resource using:

htmlTransformator = new XslTransform();
using (Stream mrs =
typeof(MyType).Assembly.GetManifestResourceStream( "MyNSp.my.xslt"))
{
XmlTextReader r = new XmlTextReader(mrs);
htmlTransformator.Load (r, null, typeof(MyType).Assembly.Evidence); //
<<< "Invalid Xml"
r.Close();
}

The document is valid, well-formatted and is not the source of error since I
tried to pass a nearly empty one and it didn't work out neither.
All the procedure has run for a long time. The error occurred as I wanted to
change the Xsl (I already undid this for test).
You may not reproduce this error since it seems to be only not working on my
local machine.
I've found a similar thing at
http://www.dotnet247.com/247referenc...48/241599.aspx.
All things as restarting computer and webserver, clearing the caches,
resetting security policies didn't solve the prob.

So I think its a local security problem, based on the stack trace I get:
[ArgumentException: Ungültiger Xml.]
System.Security.Policy.PolicyStatement.FromXml(Sec urityElement et,
PolicyLevel level) +570
System.Security.Policy.PolicyLevel.CheckCache(Int3 2 count, Char[]
serializedEvidence, Boolean& xmlError) +164
System.Security.Policy.PolicyLevel.Resolve(Evidenc e evidence, Int32
count, Char[] serializedEvidence) +54
System.Security.PolicyManager.Resolve(Evidence evidence, PermissionSet
request) +147
System.Security.SecurityManager.ResolvePolicy(Evid ence evidence) +133
System.Xml.Xsl.Compiler.Compile(NavigatorInput input, XmlResolver
xmlResolver, Evidence evidence) +372
System.Xml.Xsl.XslTransform.Compile(XPathNavigator stylesheet,
XmlResolver resolver, Evidence evidence) +215
System.Xml.Xsl.XslTransform.Load(XPathNavigator stylesheet, XmlResolver
resolver, Evidence evidence) +124
System.Xml.Xsl.XslTransform.Load(XmlReader stylesheet, XmlResolver
resolver, Evidence evidence) +74

Does someone have had this problem and solved it?

Thanx for any assistence.
Matt


 
Reply With Quote
 
 
 
 
Joseph Bittman MCAD
Guest
Posts: n/a
 
      07-13-2005
July 13, 2005

I'm not quite sure, but which line is causing the crash? I have a feeling
it is the htmlTransformator.load method. You might check and make sure that
your assembly/web application has the "Allow Evidence Control" under the
SecurityPermission. I do believe it is caused by this because of the stack
walk. Please check this out and let me know..... Thanks and have a great
day!

--
Joseph Bittman
Microsoft Certified Application Developer

Web Site: http://71.39.42.23
Static IP




"Matthias Truxa" <prefix-> wrote in message
news:...
> Hello,
>
> I've got a serious Problem from out of nowhere that I'm not able to solve.
> Can someone please help me here?
>
> I'm trying to instantiate a Xslt document build in as a resource using:
>
> htmlTransformator = new XslTransform();
> using (Stream mrs =
> typeof(MyType).Assembly.GetManifestResourceStream( "MyNSp.my.xslt"))
> {
> XmlTextReader r = new XmlTextReader(mrs);
> htmlTransformator.Load (r, null, typeof(MyType).Assembly.Evidence); //
> <<< "Invalid Xml"
> r.Close();
> }
>
> The document is valid, well-formatted and is not the source of error since
> I tried to pass a nearly empty one and it didn't work out neither.
> All the procedure has run for a long time. The error occurred as I wanted
> to change the Xsl (I already undid this for test).
> You may not reproduce this error since it seems to be only not working on
> my local machine.
> I've found a similar thing at
> http://www.dotnet247.com/247referenc...48/241599.aspx.
> All things as restarting computer and webserver, clearing the caches,
> resetting security policies didn't solve the prob.
>
> So I think its a local security problem, based on the stack trace I get:
> [ArgumentException: Ungültiger Xml.]
> System.Security.Policy.PolicyStatement.FromXml(Sec urityElement et,
> PolicyLevel level) +570
> System.Security.Policy.PolicyLevel.CheckCache(Int3 2 count, Char[]
> serializedEvidence, Boolean& xmlError) +164
> System.Security.Policy.PolicyLevel.Resolve(Evidenc e evidence, Int32
> count, Char[] serializedEvidence) +54
> System.Security.PolicyManager.Resolve(Evidence evidence, PermissionSet
> request) +147
> System.Security.SecurityManager.ResolvePolicy(Evid ence evidence) +133
> System.Xml.Xsl.Compiler.Compile(NavigatorInput input, XmlResolver
> xmlResolver, Evidence evidence) +372
> System.Xml.Xsl.XslTransform.Compile(XPathNavigator stylesheet,
> XmlResolver resolver, Evidence evidence) +215
> System.Xml.Xsl.XslTransform.Load(XPathNavigator stylesheet, XmlResolver
> resolver, Evidence evidence) +124
> System.Xml.Xsl.XslTransform.Load(XmlReader stylesheet, XmlResolver
> resolver, Evidence evidence) +74
>
> Does someone have had this problem and solved it?
>
> Thanx for any assistence.
> Matt
>
>



 
Reply With Quote
 
 
 
 
Matthias Truxa
Guest
Posts: n/a
 
      07-18-2005
Sorry for my late answer, I didn't expect one to my question either *]. So
thanx for yours.

You may be right. I've got another assembly doing nearly the same without
problems.
I could not figure out the differences between the two. But I disassembled
the routine where the error occurs
(System.Security.Policy.PolicyLevel.CheckCache(int count, char[]
serializedEvidence, out bool xmlError)).
There should be such any Security Exception instead of an Argument
Exception, so I thought of kind of a bug.
Btw, how do I check whether my assembly/web application has the "Allow
Evidence Control" permission?

Here's the code (see "<<<" for error position):

private PolicyStatement CheckCache(int count, char[] serializedEvidence, out
bool xmlError)
{
char[] chArray1;
PolicyStatement statement2;
PolicyStatement statement1 = null;
xmlError = false;
if (!Config.GetCacheEntry(this.m_configId, count, serializedEvidence,
out chArray1))
{
return null;
}
statement1 = new PolicyStatement();
Parser parser1 = null;
try
{
parser1 = new Parser(chArray1);
statement1.FromXml(parser1.GetTopElement()); // <<<
ArgumentException "Invalid Xml"
statement2 = statement1;
}
catch (XmlSyntaxException)
{
xmlError = true;
statement2 = null;
}
return statement2;
}

Thanx for your advice,
Matt


"Joseph Bittman MCAD" <> schrieb im Newsbeitrag
news:%...
> July 13, 2005
>
> I'm not quite sure, but which line is causing the crash? I have a feeling
> it is the htmlTransformator.load method. You might check and make sure
> that your assembly/web application has the "Allow Evidence Control" under
> the SecurityPermission. I do believe it is caused by this because of the
> stack walk. Please check this out and let me know..... Thanks and have a
> great day!
>
> --
> Joseph Bittman
> Microsoft Certified Application Developer
>
> Web Site: http://71.39.42.23
> Static IP
>
>
>
>
> "Matthias Truxa" <prefix-> wrote in message
> news:...
>> Hello,
>>
>> I've got a serious Problem from out of nowhere that I'm not able to
>> solve. Can someone please help me here?
>>
>> I'm trying to instantiate a Xslt document build in as a resource using:
>>
>> htmlTransformator = new XslTransform();
>> using (Stream mrs =
>> typeof(MyType).Assembly.GetManifestResourceStream( "MyNSp.my.xslt"))
>> {
>> XmlTextReader r = new XmlTextReader(mrs);
>> htmlTransformator.Load (r, null, typeof(MyType).Assembly.Evidence); //
>> <<< "Invalid Xml"
>> r.Close();
>> }
>>
>> The document is valid, well-formatted and is not the source of error
>> since I tried to pass a nearly empty one and it didn't work out neither.
>> All the procedure has run for a long time. The error occurred as I wanted
>> to change the Xsl (I already undid this for test).
>> You may not reproduce this error since it seems to be only not working on
>> my local machine.
>> I've found a similar thing at
>> http://www.dotnet247.com/247referenc...48/241599.aspx.
>> All things as restarting computer and webserver, clearing the caches,
>> resetting security policies didn't solve the prob.
>>
>> So I think its a local security problem, based on the stack trace I get:
>> [ArgumentException: Ungültiger Xml.]
>> System.Security.Policy.PolicyStatement.FromXml(Sec urityElement et,
>> PolicyLevel level) +570
>> System.Security.Policy.PolicyLevel.CheckCache(Int3 2 count, Char[]
>> serializedEvidence, Boolean& xmlError) +164
>> System.Security.Policy.PolicyLevel.Resolve(Evidenc e evidence, Int32
>> count, Char[] serializedEvidence) +54
>> System.Security.PolicyManager.Resolve(Evidence evidence, PermissionSet
>> request) +147
>> System.Security.SecurityManager.ResolvePolicy(Evid ence evidence) +133
>> System.Xml.Xsl.Compiler.Compile(NavigatorInput input, XmlResolver
>> xmlResolver, Evidence evidence) +372
>> System.Xml.Xsl.XslTransform.Compile(XPathNavigator stylesheet,
>> XmlResolver resolver, Evidence evidence) +215
>> System.Xml.Xsl.XslTransform.Load(XPathNavigator stylesheet, XmlResolver
>> resolver, Evidence evidence) +124
>> System.Xml.Xsl.XslTransform.Load(XmlReader stylesheet, XmlResolver
>> resolver, Evidence evidence) +74
>>
>> Does someone have had this problem and solved it?
>>
>> Thanx for any assistence.
>> Matt
>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XslTransform in .NET v1.1 George Durzi ASP .Net 11 12-03-2005 01:29 AM
XslTransform problem Ruprict ASP .Net 1 04-02-2004 03:49 AM
Re: Need a pop-up window to open when doc opens with xslTransform Natty Gur ASP .Net 8 11-05-2003 04:41 AM
Weird question? Two <HTML> sections when XslTransform used? Kathy Burke ASP .Net 10 11-04-2003 11:43 PM
XslTransform.transform does not generate xhtml Bob Yuan ASP .Net 1 07-31-2003 08:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57