I've got a Silverlight application that communications by having an ASP.Internet after sales through WCF. I've got a group of DataContract objects which i defined that (typically) match my LINQ to SQL produced types that my ASP.Internet after sales works together with. My WCF code creates cases of my DataContract objects from LINQ to SQL generator types when I have to transfer data to my Silverlight client.

My real question is the next: Do you know the security implications of subjecting a catalog (which is often used because the primary type in the database) through my DataContract objects?

A good example table (Position) during my database has got the following posts:

  • PositionIndex : int (primary key)
  • PositionName : string
  • PositionType : int

And also the corresponding object is (pretty much) this:

public class Position
{
    public int PositionIndex { get; set; }
    public string PositionName { get; set; }
    public int PositionTYpe { get; set; }
}

I am concerned because I understand how easy it's to reverse engineer Silverlight DLLs through Reflection - any potential theif knows I am giving a database index towards the client, and also, since they are able to reverse engineer Silverlight DLLs, they are able to easily obtain the Link to my WCF services and then try to break them. Now, I have been good and brought the recommendation of the numerous who came before me and I have made many, many inspections around the ASP.Internet side to ensure that my WCF services are becoming legal input, but I am still concerned that I am doing something bad by providing potential criminals some, very little, however, many, understanding of the way the after sales of my product is designed, and I have existed lengthy enough to understand that's ample for any determined person to begin with.

Exactly what do everyone think? If I am doing something bad using the index during my DataContracts, are you able to suggest an alternate? I am discovering it hard to develop a design that does not provide that index, when i need to have the Silverlight client to update rows already during my database, and getting the index is the greatest way I'm able to want to assist the ASP.Internet side pick which row within the database it must update.

One factor that will help is always to possess some type of authorization in position to ensure that you keep an eye on what clients "own" what secrets, to ensure that they cannot alter records they are not designed to alter.

http://stackoverflow.com/questions/454771/is-it-safe-to-expose-database-indices-to-silverlight-clients

It's standard practice to make use of primary secrets in Web addresses and the like. What you need to be careful about would be to make certain the customer is allowed to see the resource before delivering it back.

:)

It does not matter whether you utilize a database id or perhaps a "natural key" - the safety problem is identical: you'll need a method to distinctively identify an archive, which understanding could possibly be mistreated.

The primary benefit of an all natural key could be if you want to keep record mid-to-long-term disconnected in the system, or transfer the record between parallel systems (in which a primary key stops being helpful) - but that does not appear to become the problem here.

If security is really a major concern, you can problem transient secrets (possibly guids) for objects that only exists for a client's session - re-map it well in the server. However, this is quiet painful used.

Obviously, you could utilize Guids as the main key (uniqueidentifier): an additional of guid-based secrets is the fact that (if produced at random) they do not let you apply the "key+1, key+2" method of data querying.

In either case, you need to validate the client is permitted to [create/read/update/remove as appropriate] the record they're trying to control.