About      |       Articles      |      Services      |      Software      |      Contact

Latest Free SharePoint Software

ARB Security Solutions regularly releases free SharePoint software, including WebParts, Client Applications, Framework Extensions, and other Miscellaneous Components.
The most recent freeware is:

Title: Simple SharePoint Rollup WebPart
Date Published: 10/22/2009

Previous Two Free WebPart Releases:

SecureCenter For SharePoint

By SharePoint security integrators, for SharePoint security integrators.

SharePoint Security Assurance Program™

For externally facing SharePoint deployments, security is an acutely important deployment concern. Learn how through daily security scanning, you can ensure external business users and partners that they can collaborate in confidence!

Security Assurance WebPart:



Locking Down Custom SharePoint Assemblies

Regardless of its a WebPart, or a client application that is going to integrate with SharePoint, for the love of all that is great and holy, lock down your custom developed assemblies, and don't blindly give permission to things that probably shouldn't have elevated permission sets.

The best way to do this is to start from scratch, and pretty much work your way up. So, you want to begin with this:

C#:
  1. [assembly: PermissionSet(SecurityAction.RequestOptional, Name="Execution")]

Then, build up your assemblies with the relevant permission sets. You will have to use RequestOptional in this example as using RequestMinimal will not have the appropriate effect that we are looking to achieve.

Whatever you specify in the "Execution" Permmision set will obviously take effect here. Then you can just use RequestOptional following to include any permissions you need.

Let's take a brief example of where this might be a good idea.

Let's say you have a helper method that is meant to read a file, and using a string builder, build that file into a string (I know, this is pretty simple, but it is for an example). For example, I use this below method to work with my SharePoint template names in my current environment for reporting:

C#:
  1. public string pushFileIntoString(string filePath)
  2. {
  3. FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
  4. StringBuilder builder = new StringBuilder(100);
  5. byte[] buffer = new byte[0x400];
  6. for (int i = stream.Read(buffer, 0, buffer.Length); i> 0; i = stream.Read(buffer, 0, buffer.Length))
  7. {
  8. builder.Append(Encoding.UTF8.GetString(buffer, 0, i));
  9. }
  10. stream.Close();
  11. return builder.ToString();
  12. }

This would of course be using some File I/O operations. Therefore, you would have to add:

C#:
  1. [assembly: FileIOPermission(SecurityAction.RequestOptional, Name="Execution")]

And then just work your way through. Writing secure code is important, more important than functionality, so take it into consideration while you are doing your development.

  • Share/Bookmark

1 Comment »

  1. [...] Locking Down Custom SharePoint Assemblies [...]

    Pingback by Links (7/12/2007) « Steve Pietrek’s SharePoint Stuff — July 12, 2007 @ 5:44 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment