|
| 1 | +From ce71e5f5911b12ebc36711a7d86dab0a11bd1c4d Mon Sep 17 00:00:00 2001 |
| 2 | +From: Suresh Thelkar <sthelkar@microsoft.com> |
| 3 | +Date: Fri, 20 Sep 2024 09:55:21 +0530 |
| 4 | +Subject: [PATCH] Changed needed to upgrade jinja2 to 2.10.1 |
| 5 | + |
| 6 | +--- |
| 7 | + .../jinja2/Jinja2-2.10.1.tar.gz.md5 | 1 + |
| 8 | + .../jinja2/Jinja2-2.10.1.tar.gz.sha512 | 1 + |
| 9 | + .../jinja2/Jinja2-2.10.tar.gz.md5 | 1 - |
| 10 | + .../jinja2/Jinja2-2.10.tar.gz.sha512 | 1 - |
| 11 | + tools/inspector_protocol/jinja2/LICENSE | 62 +++++++++---------- |
| 12 | + tools/inspector_protocol/jinja2/__init__.py | 2 +- |
| 13 | + tools/inspector_protocol/jinja2/get_jinja2.sh | 4 +- |
| 14 | + tools/inspector_protocol/jinja2/sandbox.py | 17 ++++- |
| 15 | + 8 files changed, 50 insertions(+), 39 deletions(-) |
| 16 | + create mode 100644 tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.md5 |
| 17 | + create mode 100644 tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.sha512 |
| 18 | + delete mode 100644 tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.md5 |
| 19 | + delete mode 100644 tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.sha512 |
| 20 | + |
| 21 | +diff --git a/tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.md5 b/tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.md5 |
| 22 | +new file mode 100644 |
| 23 | +index 00000000..254f4371 |
| 24 | +--- /dev/null |
| 25 | ++++ b/tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.md5 |
| 26 | +@@ -0,0 +1 @@ |
| 27 | ++0ae535be40fd215a8114a090c8b68e5a Jinja2-2.10.1.tar.gz |
| 28 | +\ No newline at end of file |
| 29 | +diff --git a/tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.sha512 b/tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.sha512 |
| 30 | +new file mode 100644 |
| 31 | +index 00000000..7c379ff1 |
| 32 | +--- /dev/null |
| 33 | ++++ b/tools/inspector_protocol/jinja2/Jinja2-2.10.1.tar.gz.sha512 |
| 34 | +@@ -0,0 +1 @@ |
| 35 | ++a00153a0e07bb7d67f301b4eaf7af657726a1985e9ffc7ae2d76bdbb4c062d672efc8065e398767e1039b18a483a0092e206deac91e4047aad64920b56869623 Jinja2-2.10.1.tar.gz |
| 36 | +\ No newline at end of file |
| 37 | +diff --git a/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.md5 b/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.md5 |
| 38 | +deleted file mode 100644 |
| 39 | +index 9137ee12..00000000 |
| 40 | +--- a/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.md5 |
| 41 | ++++ /dev/null |
| 42 | +@@ -1 +0,0 @@ |
| 43 | +-61ef1117f945486472850819b8d1eb3d Jinja2-2.10.tar.gz |
| 44 | +diff --git a/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.sha512 b/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.sha512 |
| 45 | +deleted file mode 100644 |
| 46 | +index 087d24c1..00000000 |
| 47 | +--- a/tools/inspector_protocol/jinja2/Jinja2-2.10.tar.gz.sha512 |
| 48 | ++++ /dev/null |
| 49 | +@@ -1 +0,0 @@ |
| 50 | +-0ea7371be67ffcf19e46dfd06523a45a0806e678a407d54f5f2f3e573982f0959cf82ec5d07b203670309928a62ef71109701ab16547a9bba2ebcdc178cb67f2 Jinja2-2.10.tar.gz |
| 51 | +diff --git a/tools/inspector_protocol/jinja2/LICENSE b/tools/inspector_protocol/jinja2/LICENSE |
| 52 | +index 31bf900e..10145a26 100644 |
| 53 | +--- a/tools/inspector_protocol/jinja2/LICENSE |
| 54 | ++++ b/tools/inspector_protocol/jinja2/LICENSE |
| 55 | +@@ -1,31 +1,31 @@ |
| 56 | +-Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details. |
| 57 | +- |
| 58 | +-Some rights reserved. |
| 59 | +- |
| 60 | +-Redistribution and use in source and binary forms, with or without |
| 61 | +-modification, are permitted provided that the following conditions are |
| 62 | +-met: |
| 63 | +- |
| 64 | +- * Redistributions of source code must retain the above copyright |
| 65 | +- notice, this list of conditions and the following disclaimer. |
| 66 | +- |
| 67 | +- * Redistributions in binary form must reproduce the above |
| 68 | +- copyright notice, this list of conditions and the following |
| 69 | +- disclaimer in the documentation and/or other materials provided |
| 70 | +- with the distribution. |
| 71 | +- |
| 72 | +- * The names of the contributors may not be used to endorse or |
| 73 | +- promote products derived from this software without specific |
| 74 | +- prior written permission. |
| 75 | +- |
| 76 | +-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 77 | +-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 78 | +-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 79 | +-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 80 | +-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 81 | +-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 82 | +-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 83 | +-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 84 | +-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 85 | +-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 86 | +-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 87 | ++Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details. |
| 88 | ++ |
| 89 | ++Some rights reserved. |
| 90 | ++ |
| 91 | ++Redistribution and use in source and binary forms, with or without |
| 92 | ++modification, are permitted provided that the following conditions are |
| 93 | ++met: |
| 94 | ++ |
| 95 | ++ * Redistributions of source code must retain the above copyright |
| 96 | ++ notice, this list of conditions and the following disclaimer. |
| 97 | ++ |
| 98 | ++ * Redistributions in binary form must reproduce the above |
| 99 | ++ copyright notice, this list of conditions and the following |
| 100 | ++ disclaimer in the documentation and/or other materials provided |
| 101 | ++ with the distribution. |
| 102 | ++ |
| 103 | ++ * The names of the contributors may not be used to endorse or |
| 104 | ++ promote products derived from this software without specific |
| 105 | ++ prior written permission. |
| 106 | ++ |
| 107 | ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 108 | ++"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 109 | ++LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 110 | ++A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 111 | ++OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 112 | ++SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 113 | ++LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 114 | ++DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 115 | ++THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 116 | ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 117 | ++OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 118 | +diff --git a/tools/inspector_protocol/jinja2/__init__.py b/tools/inspector_protocol/jinja2/__init__.py |
| 119 | +index 42aa763d..15e13b6f 100644 |
| 120 | +--- a/tools/inspector_protocol/jinja2/__init__.py |
| 121 | ++++ b/tools/inspector_protocol/jinja2/__init__.py |
| 122 | +@@ -27,7 +27,7 @@ |
| 123 | + :license: BSD, see LICENSE for more details. |
| 124 | + """ |
| 125 | + __docformat__ = 'restructuredtext en' |
| 126 | +-__version__ = '2.10' |
| 127 | ++__version__ = '2.10.1' |
| 128 | + |
| 129 | + # high level interface |
| 130 | + from jinja2.environment import Environment, Template |
| 131 | +diff --git a/tools/inspector_protocol/jinja2/get_jinja2.sh b/tools/inspector_protocol/jinja2/get_jinja2.sh |
| 132 | +index bc6c4c30..b0fa6e8e 100755 |
| 133 | +--- a/tools/inspector_protocol/jinja2/get_jinja2.sh |
| 134 | ++++ b/tools/inspector_protocol/jinja2/get_jinja2.sh |
| 135 | +@@ -7,8 +7,8 @@ |
| 136 | + # Download page: |
| 137 | + # https://pypi.python.org/pypi/Jinja2 |
| 138 | + PACKAGE='Jinja2' |
| 139 | +-VERSION='2.10' |
| 140 | +-SRC_URL='https://pypi.python.org/packages/56/e6/332789f295cf22308386cf5bbd1f4e00ed11484299c5d7383378cf48ba47/Jinja2-2.10.tar.gz' |
| 141 | ++VERSION='2.10.1' |
| 142 | ++SRC_URL='https://files.pythonhosted.org/packages/93/ea/d884a06f8c7f9b7afbc8138b762e80479fb17aedbbe2b06515a12de9378d/Jinja2-2.10.1.tar.gz' |
| 143 | + PACKAGE_DIR='jinja2' |
| 144 | + |
| 145 | + CHROMIUM_FILES="README.chromium OWNERS get_jinja2.sh" |
| 146 | +diff --git a/tools/inspector_protocol/jinja2/sandbox.py b/tools/inspector_protocol/jinja2/sandbox.py |
| 147 | +index 93fb9d45..752e8128 100644 |
| 148 | +--- a/tools/inspector_protocol/jinja2/sandbox.py |
| 149 | ++++ b/tools/inspector_protocol/jinja2/sandbox.py |
| 150 | +@@ -137,7 +137,7 @@ class _MagicFormatMapping(Mapping): |
| 151 | + def inspect_format_method(callable): |
| 152 | + if not isinstance(callable, (types.MethodType, |
| 153 | + types.BuiltinMethodType)) or \ |
| 154 | +- callable.__name__ != 'format': |
| 155 | ++ callable.__name__ not in ('format', 'format_map'): |
| 156 | + return None |
| 157 | + obj = callable.__self__ |
| 158 | + if isinstance(obj, string_types): |
| 159 | +@@ -402,7 +402,7 @@ class SandboxedEnvironment(Environment): |
| 160 | + obj.__class__.__name__ |
| 161 | + ), name=attribute, obj=obj, exc=SecurityError) |
| 162 | + |
| 163 | +- def format_string(self, s, args, kwargs): |
| 164 | ++ def format_string(self, s, args, kwargs, format_func=None): |
| 165 | + """If a format call is detected, then this is routed through this |
| 166 | + method so that our safety sandbox can be used for it. |
| 167 | + """ |
| 168 | +@@ -410,6 +410,17 @@ class SandboxedEnvironment(Environment): |
| 169 | + formatter = SandboxedEscapeFormatter(self, s.escape) |
| 170 | + else: |
| 171 | + formatter = SandboxedFormatter(self) |
| 172 | ++ |
| 173 | ++ if format_func is not None and format_func.__name__ == 'format_map': |
| 174 | ++ if len(args) != 1 or kwargs: |
| 175 | ++ raise TypeError( |
| 176 | ++ 'format_map() takes exactly one argument %d given' |
| 177 | ++ % (len(args) + (kwargs is not None)) |
| 178 | ++ ) |
| 179 | ++ |
| 180 | ++ kwargs = args[0] |
| 181 | ++ args = None |
| 182 | ++ |
| 183 | + kwargs = _MagicFormatMapping(args, kwargs) |
| 184 | + rv = formatter.vformat(s, args, kwargs) |
| 185 | + return type(s)(rv) |
| 186 | +@@ -418,7 +429,7 @@ class SandboxedEnvironment(Environment): |
| 187 | + """Call an object from sandboxed code.""" |
| 188 | + fmt = inspect_format_method(__obj) |
| 189 | + if fmt is not None: |
| 190 | +- return __self.format_string(fmt, args, kwargs) |
| 191 | ++ return __self.format_string(fmt, args, kwargs, __obj) |
| 192 | + |
| 193 | + # the double prefixes are to avoid double keyword argument |
| 194 | + # errors when proxying the call. |
| 195 | +-- |
| 196 | +2.34.1 |
| 197 | + |
0 commit comments