smarty-php / smarty-php/smarty

4.5.3: Function whitelist via Smarty_Security is being ignored

Open
#1,029 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
2.3k
Forks
709
PR merge metrics
No merged PRs in 30d

Description

Smarty_Internal_TemplateCompilerBase::compilePHPFunctionCall() checks whether the given function $name is a trusted function via $this->smarty->security_policy->isTrustedPhpFunction($name, $this).

However, in Line 661 $name is checked against a hardcoded set of function names instead of using the security policy, completely ignoring the given security policy whitelist and causing errors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in libs/sysplugins/smarty_internal_templatecompilerbase.php at the compilePHPFunctionCall() checks around lines 618 and 661. Compare the security-policy trust check with the hardcoded function-name check, then verify that the configured whitelist is respected and the resulting errors no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.