| 1 |
Safe Delegation |
| 2 |
=============== |
| 3 |
|
| 4 |
|
| 5 |
Safe delegation, as provided by Zope and Allaire's Spectra, is not |
| 6 |
implemented in Cheetah. The core aim has been to help developers |
| 7 |
and template maintainers get things done, without throwing |
| 8 |
unnecessary complications in their way. So you should give write |
| 9 |
access to your templates only to those whom you trust. However, |
| 10 |
several hooks have been built into Cheetah so that safe delegation |
| 11 |
can be implemented at a later date. |
| 12 |
|
| 13 |
It should be possible to implement safe delegation via a future |
| 14 |
configuration Setting {safeDelegationLevel} (0=none, 1=semi-secure, |
| 15 |
2-alcatraz). This is not implemented but the steps are listed here |
| 16 |
in case somebody wants to try them out and test them. |
| 17 |
|
| 18 |
Of course, you would also need to benchmark your code and verify it |
| 19 |
does not impact performance when safe delegation is off, and |
| 20 |
impacts it only modestly when it is on." All necessary changes can |
| 21 |
be made at compile time, so there should be no performance impact |
| 22 |
when filling the same TO multiple times. |
| 23 |
|
| 24 |
|
| 25 |
#. Only give untrusted developers access to the .tmpl files. |
| 26 |
(Verifying what this means. Why can't trusted developers access |
| 27 |
them?) |
| 28 |
|
| 29 |
#. Disable the {#attr} directive and maybe the {#set} directive. |
| 30 |
|
| 31 |
#. Use Cheetah's directive validation hooks to disallow references |
| 32 |
to {self}, etc (e.g. {#if $steal(self.thePrivateVar)} ) |
| 33 |
|
| 34 |
#. Implement a validator for the $placeholders and use it to |
| 35 |
disallow '\_\_' in $placeholders so that tricks like |
| 36 |
{$obj.\_\_class\_\_.\_\_dict\_\_} are not possible. |
| 37 |
|
| 38 |
|
| 39 |
|