Re: potential solution to user streams + allow_url_include=off

From: Date: Mon, 21 May 2007 19:56:04 +0000
Subject: Re: potential solution to user streams + allow_url_include=off
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-29637@lists.php.net to get a copy of this message
On Fri, May 18, 2007 10:51 am, Greg Beaver wrote: > The solution: > ============= > Add a new function: stream_wrapper_set_local() So, basically, your function would be similar to: "I'm removing the safety from the gun with which I might shoot myself in the foot." :-) :-) :-) Would it be applied on an individual stream only, or could we consider allowing something not unlike: stream_wrapper_set_local('phar://*'); as a sort of "glob" where only streams that fit the pattern are white-listed. phar://* is probably a bad example... 'phar:///usr/local/lib/php_libs/*' would seem to me to be a pretty clear way to express that phar files found in the local file system at that path are kosher, but nothing else is being white-listed in this call. This would, I think, provide a better balance between security and usability. I have no idea if what I suggest is reasonable to implement or not. It just seems like it "should" be and would be more useful to application developers than having to whitelist streams individually... In fact, I suspect that if you have to call this function on each stream individually, the masses will end up doing something that boils down to: <?php stream_wrapper_set_local($_GET['foo']); include($_GET['foo']); ?> because they'll wrap it up in 20 levels of function calls and OOP obfuscation^H^H^H^H^H^H^H^H^H abstraction, and not realize they've just blown away the safety barrier when they call: stream_wrapper_set_local($stream); down in the guts of their code. YMMV -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.internals (#29637) next »