smarty-php / smarty-php/smarty
4.5.3: Function whitelist via Smarty_Security is being ignored
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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