Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

allow_constants not working !

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
sm@rty
Smarty Regular


Joined: 01 Oct 2014
Posts: 65

PostPosted: Sun Mar 15, 2015 3:36 pm    Post subject: allow_constants not working ! Reply with quote

hi

i set $smartySecurity->allow_constants = false;

but not working and can be accessed by the template !

better way using white list.

for example :

$smartySecurity->allow_constants = array('ENT_QUOTES');
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Mar 15, 2015 11:36 pm    Post subject: Reply with quote

Security->allow_constants does control access of the special $smarty variable {$smarty.const. ....}

I will put a the white list on the wish list.
Back to top
View user's profile Send private message
sm@rty
Smarty Regular


Joined: 01 Oct 2014
Posts: 65

PostPosted: Mon Mar 16, 2015 8:14 am    Post subject: Reply with quote

so how can i prevent access directly to constant in smarty.

for example :
php
Code:
<?php
define('test',1);
?>


smarty(security is enable)
Code:
{test nocache}


output : 1
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Mar 16, 2015 1:49 pm    Post subject: Reply with quote

Why do you want to do it, in first place?
Back to top
View user's profile Send private message
sm@rty
Smarty Regular


Joined: 01 Oct 2014
Posts: 65

PostPosted: Mon Mar 16, 2015 3:52 pm    Post subject: Reply with quote

because Wearers of smarty are users and no admin.
so all password or username or etc ... is define in constant.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Mar 16, 2015 4:14 pm    Post subject: Reply with quote

Back to top
View user's profile Send private message
sm@rty
Smarty Regular


Joined: 01 Oct 2014
Posts: 65

PostPosted: Mon Mar 16, 2015 5:07 pm    Post subject: Reply with quote

with example :

php
Code:
define('MYSQL_PASSWORD','my_password');


smarty
Code:
{MYSQL_PASSWORD nocache}

output : my_password

how i can prevent access user to this constant ?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon Mar 16, 2015 8:54 pm    Post subject: Reply with quote

Why EVER your MySQL password is defined as a constant? Are you insane?
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Mar 17, 2015 1:33 am    Post subject: Reply with quote

I totally agree that passwords and other sensitive data should never be defined as constants.

But anyway an update is on Github to disable direct access to defined constants by Smarty_Security->allow_constants=false;
Back to top
View user's profile Send private message
sm@rty
Smarty Regular


Joined: 01 Oct 2014
Posts: 65

PostPosted: Tue Mar 17, 2015 6:18 am    Post subject: Reply with quote

Quote:
Why EVER your MySQL password is defined as a constant? Are you insane?

so wordpress is insane or another system !

http://codex.wordpress.org/Editing_wp-config.php

Code:
I totally agree that passwords and other sensitive data should never be defined as constants.


you sure ?

Code:
print_r(get_defined_constants());


any data is constant.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Mar 17, 2015 2:35 pm    Post subject: Reply with quote

sm@rty wrote:
Quote:
Why EVER your MySQL password is defined as a constant? Are you insane?

so wordpress is insane or another system !

Wordpress don't let editors write PHP code. Or anything remotely resembling it. That's the only reason they was not bitten by their idiocy. Yet.
Database access password must be set as variable, and unset as soon as database connection is established.

Quote:
Quote:
I totally agree that passwords and other sensitive data should never be defined as constants.


you sure ?

Did he not sound sure?

Quote:
Code:
print_r(get_defined_constants());


any data is constant.

What?
http://www.rootdir.org/upload/Smarty/
Here, I put your proposed code right before the data is sent to the client. Please show me anything that is even remotely relevant to security in the list.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP