On Friday, May 13, 2011 9:47:41 PM UTC-4, pbreit wrote: 
>
> If you access a component without the ".load" extension, it automatically 
> uses the "generic.load" view which is a BEAUTIFY of all the returned data. 
> So since my data included an auth_user record, all the auth_user fields were 
> displayed in the browser window, including the password (encrypted, but 
> still!).

 
Are you talking about calling the component via a regular URL (i.e., not via 
the LOAD function) without the .load extension? In that case, web2py should 
assume a .html extension, and assuming there is no func.html view, it will 
use generic.html (not generic.load). The only case in which it should use 
generic.load is if you explicitly call it with the .load extension and there 
is no func.load view.
 
In any case, you still have the same problem with generic.html, which also 
does a BEAUTIFY (and probably a similar problem with all the generic views). 
This is a good observation -- the generic views can be dangerous if your 
function returns more data than you really want to expose. All a user has to 
do is call your function with any extension for which you have not defined 
an explicit view, and they'll get the generic view, which may show more than 
you want. I've seen some people use "return locals()" instead of returning a 
dict with explicit values, which may be dangerous if locals() includes some 
other variables that you don't want to expose to the public. It may be wise 
to return in the dict only objects that you truly want exposed by the 
function.
 
Anthony
 

Reply via email to