These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Using NHibernate for very secure Web application
PostPosted: Fri Apr 20, 2007 3:01 pm 
Newbie

Joined: Wed Apr 11, 2007 10:34 am
Posts: 3
Hi,

I am new to NHibernate and am before decision whether to use NHibernate or classic design Web/Database layer. We are using SQL Server 2005. Our Website contains very sensitive user information.

NHibernate
Pros
1 Easy to design, no SP writing
Cons
1 NHibernate will generate ad hoc queries - Security for ad hoc query can not be properly defined (only SELECT, INSERT, DELETE, ... can be allowed / denied for certain columns)
2 If somebody hacks, etc. our Web server she can generate any query e.g. query all sensitive user data, or delete tables; and query will execute successfully because NHibernate requires to have permissions for INSERT, DELETE, ...

Classic DB design (SP)
Pros
1 SP can have fine security permissions
Cons
1 Requires writing SP, etc.

What should you suggest me ?
Do you know some other pros / cons ?

Thank you ... :-)


Top
 Profile  
 
 Post subject: Re: Using NHibernate for very secure Web application
PostPosted: Fri Apr 20, 2007 3:12 pm 
Regular
Regular

Joined: Sun Jan 21, 2007 4:33 pm
Posts: 65
JC2007 wrote:
Cons
1 NHibernate will generate ad hoc queries - Security for ad hoc query can not be properly defined (only SELECT, INSERT, DELETE, ... can be allowed / denied for certain columns)
2 If somebody hacks, etc. our Web server she can generate any query e.g. query all sensitive user data, or delete tables; and query will execute successfully because NHibernate requires to have permissions for INSERT, DELETE, ...

If someone hacks your webserver, your last worry is what queries they'll generate, IMHO.


Top
 Profile  
 
 Post subject: Re: Using NHibernate for very secure Web application
PostPosted: Fri Apr 20, 2007 4:14 pm 
Newbie

Joined: Wed Apr 11, 2007 10:34 am
Posts: 3
Gortok wrote:
JC2007 wrote:
Cons
1 NHibernate will generate ad hoc queries - Security for ad hoc query can not be properly defined (only SELECT, INSERT, DELETE, ... can be allowed / denied for certain columns)
2 If somebody hacks, etc. our Web server she can generate any query e.g. query all sensitive user data, or delete tables; and query will execute successfully because NHibernate requires to have permissions for INSERT, DELETE, ...

If someone hacks your webserver, your last worry is what queries they'll generate, IMHO.


If there is security vulnerability in OS, Web server, etc. this can happen, it is not very probably but it is not impossible ...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 20, 2007 6:19 pm 
Newbie

Joined: Mon Apr 02, 2007 12:31 pm
Posts: 19
If you use NHibernate 1.2 RC1, you can call SP's from NHibernate. If you keep the secure items accessible only through SP's you can use NHibernate for most of the data and only call SP's when you need to access the secure data.

However I'm not convinced that security for ad-hoc queries can't be properly defined, or that using SP's gives you a security advantage. If an SP accessed by NHibernate allows access to sensitive data, then the attacker will have that access if the web server is compromised. Since Sql Server 2005 allows setting select/insert/update/delete permissions per-object and per-column, you can set the permissions to exactly what would be allowed by the SP. Whether it's easier to manage permissions for SP's or database columns is debatable.

(edit- I just realized that the above isn't true. I can think of a few occasions when an SP would allow you to restrict access to data beyond normal permissions, but I personally have never had need of them)

If you want to restrict visibility of your db structure, maybe you could map persisted objects to views instead of tables?


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 08, 2007 8:12 pm 
Contributor
Contributor

Joined: Sun Jun 26, 2005 5:03 am
Posts: 51
Location: London, UK
One point here, you can use the named connections property of ASP.NET 2.0 to secure the database connection string; that way they have to hack the user name/password used to connect to the SQL Server not just the web server

http://msdn2.microsoft.com/en-us/library/ms998280.aspx

_________________
Paul Hatcher
NHibernate Team


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 08, 2009 8:30 pm 
Newbie

Joined: Thu Jan 08, 2009 6:57 pm
Posts: 4
has anyone had an answer to this yet? I am running into the same problem.


[quote="paulh"]One point here, you can use the named connections property of ASP.NET 2.0 to secure the database connection string; that way they have to hack the user name/password used to connect to the SQL Server not just the web server

http://msdn2.microsoft.com/en-us/library/ms998280.aspx[/quote]

What about windows application?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.