ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ ,Qc@sdZddlZddlmZddlmZddlmZmZm Z ddlm Z m Z ddl m Z mZmZddlmZd efd YZd efd YZd efdYZdZdS(s jinja2.testsuite.security ~~~~~~~~~~~~~~~~~~~~~~~~~ Checks the sandbox and other security features. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. iN(t JinjaTestCase(t Environment(tSandboxedEnvironmenttImmutableSandboxedEnvironmenttunsafe(tMarkuptescape(t SecurityErrortTemplateSyntaxErrortTemplateRuntimeError(t text_typet PrivateStuffcBs)eZdZedZdZRS(cCsdS(Ni((tself((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pytbarscCsdS(Ni*((R ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pytfooscCsdS(NR ((R ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt__repr__!s(t__name__t __module__R RRR(((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR s t PublicStuffcBs#eZdZdZdZRS(cCsdS(Ni((R ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt&tcCsdS(Ni*((R ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR'RcCsdS(NR((R ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR)s(RRR t_fooR(((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR%s  tSandboxTestCasecBsPeZdZdZdZdZdZdZdZdZ RS(cCst}|jt|jdjdt|j|jdjdtd|jt|jdjdt|j|jdjdtd|j|jdjddd|j|jd jdd d|jt|jd jdddS( Ns{{ foo.foo() }}Rs{{ foo.bar() }}t23s{{ foo._foo() }}s{{ foo.__class__ }}i*Rs{{ foo.func_code }}cSsdS(N(tNone(((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR9Rs${{ foo.__class__.__subclasses__() }}(Rt assert_raisesRt from_stringtrenderR t assert_equalR(R tenv((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt test_unsafe/s  ( (%(cCsEt}|jt|jdj|jt|jdjdS(Ns{{ [].append(23) }}s{{ {1:2}.clear() }}(RRRRR(R R((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyttest_immutable_environment>s   cCs9t}|jt|jd|jt|jddS(Ns.{% for item.attribute in seq %}...{% endfor %}s,{% for foo, bar.baz in seq %}...{% endfor %}(RRRR(R R((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyttest_restrictedEs  cCskd}td}||tt|t|ks>ttdddksZttdidd6dks}tttdd tksttd}|j|kstd tfd Y}t|d ksttd |dksttddks+ttdjdksIttdjdksgtdS(Ns?susernames %ss s<bad user>s%(username)stusernameRR tFoocBseZdZdZRS(cSsdS(Nsawesome((R ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt__html__bscSsdS(Ntawesome((R ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt __unicode__ds(RRR#R%(((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR"as sawesomes%ss!awesomes"<>&'s"<>&'sFoo & Bars Foo & Bars <test>s( RR RtAssertionErrorttypeR#tobjectt striptagstunescape(R RtsafetxR"((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyttest_markup_operationsLs$ ,  " cCstdt}|jd}d}|j|ks<tt|j|ksWtt|j|ksrt|jjd|kstt|jjd|kstdS(Nt autoescapesf{% macro say_hello(name) %}

Hello {{ name }}!

{% endmacro %}{{ say_hello("foo") }}s,

Hello <blink>foo</blink>!

sfoo( RtTrueRRR&R tmoduleRt say_hello(R Rttt escaped_out((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyttest_template_dataoscCs5t}|jd}|jt|jdtdS(Ns"{{ cls|attr("__subclasses__")() }}tcls(RRRRRtint(R Rttmpl((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyttest_attr_filter{s cCsd}xdidfdidd6dffD]\}}}t}||jd<|jd |}|j||ksttdg|_|jd |}y|j|Wntk r}q/X|jd q/WdS( NcSstddS(Nsthat operator so does not work(R (tlefttright((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt disable_opss1 + 2t3sa + 2itat4t+s{{ %s }}sexpected runtime error( Rt binop_tableRRR&t frozensettintercepted_binopsR tfail(R R;texprtctxtrvRR2te((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt!test_binary_operator_interceptings 5  cCsd}xdidfdidd6dffD]\}}}t}||jd<|jd|}|j||ksttdg|_|jd|}y|j|Wntk r}q/X|jd q/WdS( NcSstddS(Nsthat operator so does not work(R (targ((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR;ss-1s-aiR=s-2t-s{{ %s }}sexpected runtime error( Rt unop_tableRRR&RAtintercepted_unopsR RC(R R;RDRERFRR2RG((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt test_unary_operator_interceptings 5  ( RRRRR R-R4R8RHRM(((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyR-s    #  cCs&tj}|jtjt|S(N(tunittestt TestSuitetaddTestt makeSuiteR(tsuite((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyRRs (t__doc__RNtjinja2.testsuiteRtjinja2Rtjinja2.sandboxRRRRRtjinja2.exceptionsRRR tjinja2._compatR R(R RRRR(((sJ/opt/alt/python27/lib/python2.7/site-packages/jinja2/testsuite/security.pyt s  v