You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by snowch <sn...@coralms.com> on 2009/04/25 07:39:05 UTC

security - http parameters override setAttributes?

In my controller postprocessor, I would like to add an event that sets the a
list of companies that the user can access.  I.e. if the user is an external
user, I only want them to have access to their own data.

companyCodeList = // lookup in db based on userLoginId
Security security = (Security)request.getAttribute("security");
if (security.hasPermission("INTERNAL_STAFF", request.getSession())) {
	request.removeAttribute("companyCodeList");
} else {
	request.setAttribute("companyCodeList", companyCodeList);
}

In the entity condition for the form:

<condition-expr field-name="companyCode" operator="in"
value="${parameters.companyCodeList}" ignore-if-empty="true"
ignore-if-null="true"/>

It seams that it is possible for malicious users to try to override this by
adding http parameters, e.g.
http://localhost/myapp/control/something?companyCodeList=ABC

What is the recommended way of passing data from my controller event without
using parameters?

Many thanks in advance,

Chris
-- 
View this message in context: http://www.nabble.com/security---http-parameters-override-setAttributes--tp23228799p23228799.html
Sent from the OFBiz - User mailing list archive at Nabble.com.


Re: security - http parameters override setAttributes?

Posted by snowch <sn...@coralms.com>.
Hi BJ,

What I'm trying to achieve is row level security when accessing an entity
consisting of legacy data.  The data has a foreign key (companyCode).  Each
userLoginId is assigned a list of company codes that they have permission to
view.

For the parameter overriding, my example was using an HTTP GET, but
companyCode's could be added by a malicious user using a HTTP POST call. 
Either way, a malicious user can override the companyCodeList that was added
in my event using request.setAttribute("companyCodeList")?

Many thanks,

Chris
-- 
View this message in context: http://www.nabble.com/security---http-parameters-override-setAttributes--tp23228799p23230043.html
Sent from the OFBiz - User mailing list archive at Nabble.com.