Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is there some kind of row-based security approach in postgres?

Let's say I run a hosting company, and when a user logs in, I want to limit DB access of this particular connection to rows that actually matter to the logged-in customer (like purchased services, associated accounts) and still allow access to general-purpose information (like list of available TLDs, stock prices for services etc.). Can I do that somehow?

Then I'd use authentication outside of the database (like with LDAP), and only allow access to the database after login; that way information leaks should be pretty much contained to the logged-in customer.

EDIT: Seems it's a work in progress: https://wiki.postgresql.org/wiki/Row-security



The SE-PostgreSQL project provides row and column-level security. It's based off the work of SELinux, so it may be overkill for what you're looking for. Plus, it has all of the inherent complexities of SELinux, so that may be a turnoff for you. But, if you're REALLY paranoid about security, it's a great tool.


WITH CHECK OPTION is coming in 9.4 . It's already done apparently.

You can sorta do it now with security_barrier views, but they aren't auto-updatable, so you need to write more code, which is a PITA.


In addition to the work in progress, you could use security barrier views.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: