Evidence in XslTransform.Load()

  • Thread starter Thread starter Mike Schilling
  • Start date Start date
M

Mike Schilling

In 1.0, there was a method call:

XslTransform.Load(IXPathNavigable, XmlResolver)

In 1.1, compiling a call to it gives a warning that this signature is
obsolete and evidence should be suppied, that it, that a call to

XslTransform.Load(IXPathNavigable, XmlResolver, Evidence)

is preferred.

If I pass "null" as my evidence, bad things happen. Some of my custom XPath
functions, which do reflective calls on System.Xml.XPath classes, will then
fail with security violations. What sort of evidence do I provide to say
"run my XPath functions with the same privilege as any other code in this
assembly"? (I've looked at what the 2-argument form of Load does, and
there's no way to emulate it.)
 
Since no one else responded, I guess I'll throw out a little, however i'd
suggest asking in security or xml groups for more sure answers.
I would think that to approve the set of permissions the current assembly
has, you would pass something like Assembly.GetCallingAssembly().Evidence to
the evidence parameter. There are probably better ways however, hopefully
someone will post and set us both straight.
 
I use the following as the Evidience parameter successfully:
this.GetType().Assembly.Evidence


Michael R
(e-mail address removed)
 
Yeah, that should work, however I don't know if there are security
implications to it, I suspect not, but I'm always a tad careful.
 
What you propose (well, actually Assembly.GetExecutingAssembly().Evidence)
works perfectly. No warnings and the functions run with no failures.

Thanks,
Mike
 
Back
Top