Re: Question about Smarty [secure?]
| From: | Gavin Cowie | Date: | Fri, 22 Jun 2001 01:38:58 +0000 |
| Subject: | Re: Question about Smarty [secure?] | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-943@lists.php.net to get a copy of this message | ||
Most times this is never an issue (passing potentially dodgy stuff in the
query string) because people have a fixed set of "data keys" they are
looking to match up to (i.e. they use a database).
Using the filesystem only (as I think you're doing) means that you will have
to employ your plan to strip out all suspicious "path-type" stuff from the
dynamic URI's. That should work just fine.
Perhaps make it easier on yourself by
a) having your templates expect a particular naming convention for your data
files. (perhaps with a custom function of your devising)
b) have the template pre-pend half the data file name (say with "mydata") -
with you supplying the otherhalf in the querystring
i.e. to match a data file like "mydata_news", the template provides
"mydata_" and your querystring provides "news".
just off the top of my head though, I'm sure others here will point out it's
limitations ;)
G
> -----Original Message-----
> From: ' ' [mailto:ryadex@yahoo.com]
> Sent: Thursday, June 21, 2001 6:19 PM
> To: Gavin Cowie; smarty@lists.ispi.net
> Subject: [smarty] Re: Question about Smarty [secure?]
>
>
> Hey there...
> How would you handle dynamic URI's or dynamic strings?
> This is great stuff btw and I appreciate the feedback!
>
> Also, would calling a class seem to be the best method
> to handle this?
>
> Thanks,
> ~ryadex
>
>
> --- Gavin Cowie <squirtsomething@gavincowie.com>
> wrote:
> > > index.php
> > > ----------
> > > [...]
> > > /* Setup, get the page variable and do anything
> > you need to it. I
> > > normalise it to make it as short as possible,
> > since the value of the
> > > page variable is actually a path to a file. I
> > also have a default set
> > > if page isn't. */
> >
> > is that secure enough for you? passing the filename
> > as a var via the query
> > string I mean. Could I do something unpleasant like
> > :
> >
> >
> index.php?page=../../pics_of_siteop_nekkid/index.html
> >
> > or less amusingly
> >
> > index.php?page=/etc/passwd
> >
> > ?
> >
> > >
> > > if ($page) {
> > > // normalise
> > > } else {
> > > $page=default.html
> >
> >
> >
> > ---
> > You are currently subscribed to smarty as:
> > ryadex@yahoo.com
> > To unsubscribe send a blank email to
> > $subst('Email.Unsub')
> > Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
>
> ---
> You are currently subscribed to smarty as: squirtsomething@gavincowie.com
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>
>