Home All Groups Group Topic Archive Search About

Use of Unrestricted flag ???

Author
27 Jul 2006 8:17 AM
serge calderara
Dear all,

I have seen in samples following assembly atribute :

<Assembly:
Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.RequestOptional, Unrestricted:=True)>

What does the Unrestricted Flag means ?

regards
serge

Author
27 Jul 2006 1:47 PM
oldbear
Hi

With Code Access Security permissions, the Unrestricted flag means that
(surprisingly) there are no restrictions on accessing the particular
resource. For instance, the unrestricted flag on the FileIOPermission means
that all files can be accessed.

The other state for this permission is to have file and directory access
restricted to a particular set of files and directories. For instance, a
FileIOPermission could be created that has read access to the C:\ drive, and
read/write access to c:\Misc. This would restrict access to those particular
resources.

Hope this helps

--
----------------------------------
Chris Seary
http://blog.searyblog.com/




Show quoteHide quote
"serge calderara" wrote:

> Dear all,
>
> I have seen in samples following assembly atribute :
>
> <Assembly:
> Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.RequestOptional, Unrestricted:=True)>
>
> What does the Unrestricted Flag means ?
>
> regards
> serge
Author
27 Jul 2006 1:47 PM
Nicole Calinoiu
Unrestricted FileIOPermission confers the ability to read and write any file
on a local or remote drive.  Since your particular example is an
assembly-level RequestOptional for unrestricted FileIOPermission, it
basically ends up causing your assembly to be granted whatever
FileIOPermission it is allowed under CAS policy.  (Sort of a "I'd like
everything, but I'll run with whatever you're willing to give me" result.)


Show quoteHide quote
"serge calderara" <sergecalder***@discussions.microsoft.com> wrote in
message news:7349EA91-D94C-4DF9-A6B4-D6D497E0D49A@microsoft.com...
> Dear all,
>
> I have seen in samples following assembly atribute :
>
> <Assembly:
> Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.RequestOptional,
> Unrestricted:=True)>
>
> What does the Unrestricted Flag means ?
>
> regards
> serge
Author
27 Jul 2006 5:07 PM
serge calderara
SOunds not so logic for me.
If we aply to an asembly a security permission that means that we would like
forcely to restrict from one way or an other. So why using that Unrestricted
flag then, why not simply skip it all if we want to restrict or simply remove
the assembly permission IO attribute if we want UNrestricted no ?



Show quoteHide quote
"Nicole Calinoiu" wrote:

> Unrestricted FileIOPermission confers the ability to read and write any file
> on a local or remote drive.  Since your particular example is an
> assembly-level RequestOptional for unrestricted FileIOPermission, it
> basically ends up causing your assembly to be granted whatever
> FileIOPermission it is allowed under CAS policy.  (Sort of a "I'd like
> everything, but I'll run with whatever you're willing to give me" result.)
>
>
> "serge calderara" <sergecalder***@discussions.microsoft.com> wrote in
> message news:7349EA91-D94C-4DF9-A6B4-D6D497E0D49A@microsoft.com...
> > Dear all,
> >
> > I have seen in samples following assembly atribute :
> >
> > <Assembly:
> > Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.RequestOptional,
> > Unrestricted:=True)>
> >
> > What does the Unrestricted Flag means ?
> >
> > regards
> > serge
>
>
Author
27 Jul 2006 7:24 PM
Nicole Calinoiu
"serge calderara" <sergecalder***@discussions.microsoft.com> wrote in
message news:06745F79-0C7F-4296-A233-7ED484A12A5B@microsoft.com...
> SOunds not so logic for me.
> If we aply to an asembly a security permission that means that we would
> like
> forcely to restrict from one way or an other.

Not always.  For example, sometimes assembly-level permission attributes are
used to communicate security information to machine administrators.


> So why using that Unrestricted
> flag then, why not simply skip it all if we want to restrict or simply
> remove
> the assembly permission IO attribute if we want UNrestricted no ?

RestrictOptional has the additional property of implicitly rejecting all
other permissions, so the attribute you gave as an example has more
consequences than you seem to think.

Also, in the particular case of FileIOPermission, choosing an assembly-level
permission attribute can be tricky since the path(s) the application needs
to use may only be known at runtime.  In such a scenario, a RequestOptional
for unrestricted FileIOPermission may be the best of a less than ideal set
of choices if one is attempting to develop a least CAS privilege
application.  It at least gives the administrator the option to set a CAS
policy that restricts the application to only those paths it really needs to
use.



Show quoteHide quote
> "Nicole Calinoiu" wrote:
>
>> Unrestricted FileIOPermission confers the ability to read and write any
>> file
>> on a local or remote drive.  Since your particular example is an
>> assembly-level RequestOptional for unrestricted FileIOPermission, it
>> basically ends up causing your assembly to be granted whatever
>> FileIOPermission it is allowed under CAS policy.  (Sort of a "I'd like
>> everything, but I'll run with whatever you're willing to give me"
>> result.)
>>
>>
>> "serge calderara" <sergecalder***@discussions.microsoft.com> wrote in
>> message news:7349EA91-D94C-4DF9-A6B4-D6D497E0D49A@microsoft.com...
>> > Dear all,
>> >
>> > I have seen in samples following assembly atribute :
>> >
>> > <Assembly:
>> > Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.RequestOptional,
>> > Unrestricted:=True)>
>> >
>> > What does the Unrestricted Flag means ?
>> >
>> > regards
>> > serge
>>
>>