| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -125,10 +125,31 @@ jobs: | |||
| 125 | 125 | runs-on: macos-latest | |
| 126 | 126 | needs: check_source | |
| 127 | 127 | if: needs.check_source.outputs.run_tests == 'true' | |
| 128 | + env: | ||
| 129 | + HOMEBREW_NO_ANALYTICS: 1 | ||
| 130 | + HOMEBREW_NO_AUTO_UPDATE: 1 | ||
| 131 | + HOMEBREW_NO_INSTALL_CLEANUP: 1 | ||
| 128 | 132 | steps: | |
| 129 | 133 | - uses: actions/checkout@v2 | |
| 130 | 134 | - name: Configure CPython | |
| 131 | - run: SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev | ||
| 135 | + run: | | ||
| 136 | + brew install pkg-config openssl@1.1 xz gdbm tcl-tk | ||
| 137 | + brew install zlib bzip2 ncurses readline sqlite | ||
| 138 | + SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk \ | ||
| 139 | + CC=clang \ | ||
| 140 | + CPPFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include \ | ||
| 141 | + -I$(brew --prefix zlib)/include -I$(brew --prefix bzip2)/include \ | ||
| 142 | + -I$(brew --prefix ncurses)/include -I$(brew --prefix readline)/include \ | ||
| 143 | + -I$(brew --prefix sqlite)/include" \ | ||
| 144 | + LDFLAGS="-L$(brew --prefix gdbm)/lib -L$(brew --prefix xz)/lib \ | ||
| 145 | + -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib \ | ||
| 146 | + -L$(brew --prefix ncurses)/lib -L$(brew --prefix readline)/lib \ | ||
| 147 | + -L$(brew --prefix sqlite)/lib" \ | ||
| 148 | + ./configure --prefix=/opt/python-dev \ | ||
| 149 | + --with-pydebug \ | ||
| 150 | + --with-openssl="$(brew --prefix openssl@1.1)" \ | ||
| 151 | + --with-tcltk-libs="$(pkg-config --libs tk)" \ | ||
| 152 | + --with-tcltk-includes="$(pkg-config --cflags tk)" | ||
| 132 | 153 | - name: Build CPython | |
| 133 | 154 | run: make -j4 | |
| 134 | 155 | - name: Display build info | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ | |||
| 9 | 9 | __all__ = ["version", "bootstrap"] | |
| 10 | 10 | _PACKAGE_NAMES = ('setuptools', 'pip') | |
| 11 | 11 | _SETUPTOOLS_VERSION = "47.1.0" | |
| 12 | - _PIP_VERSION = "22.0.4" | ||
| 12 | + _PIP_VERSION = "23.0.1" | ||
| 13 | 13 | _PROJECTS = [ | |
| 14 | 14 | ("setuptools", _SETUPTOOLS_VERSION, "py3"), | |
| 15 | 15 | ("pip", _PIP_VERSION, "py3"), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -777,7 +777,7 @@ def list_directory(self, path): | |||
| 777 | 777 | displaypath = urllib.parse.unquote(self.path, | |
| 778 | 778 | errors='surrogatepass') | |
| 779 | 779 | except UnicodeDecodeError: | |
| 780 | - displaypath = urllib.parse.unquote(path) | ||
| 780 | + displaypath = urllib.parse.unquote(self.path) | ||
| 781 | 781 | displaypath = html.escape(displaypath, quote=False) | |
| 782 | 782 | enc = sys.getfilesystemencoding() | |
| 783 | 783 | title = 'Directory listing for %s' % displaypath | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -413,6 +413,14 @@ def test_undecodable_filename(self): | |||
| 413 | 413 | self.check_status_and_reason(response, HTTPStatus.OK, | |
| 414 | 414 | data=support.TESTFN_UNDECODABLE) | |
| 415 | 415 | ||
| 416 | + def test_undecodable_parameter(self): | ||
| 417 | + # sanity check using a valid parameter | ||
| 418 | + response = self.request(self.base_url + '/?x=123').read() | ||
| 419 | + self.assertRegex(response, f'listing for {self.base_url}/\?x=123'.encode('latin1')) | ||
| 420 | + # now the bogus encoding | ||
| 421 | + response = self.request(self.base_url + '/?x=%bb').read() | ||
| 422 | + self.assertRegex(response, f'listing for {self.base_url}/\?x=\xef\xbf\xbd'.encode('latin1')) | ||
| 423 | + | ||
| 416 | 424 | def test_get_dir_redirect_location_domain_injection_bug(self): | |
| 417 | 425 | """Ensure //evil.co/..%2f../../X does not put //evil.co/ in Location. | |
| 418 | 426 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,6 +145,34 @@ def test_newlines_escaped(self): | |||
| 145 | 145 | uu.encode(inp, out, filename) | |
| 146 | 146 | self.assertIn(safefilename, out.getvalue()) | |
| 147 | 147 | ||
| 148 | + def test_no_directory_traversal(self): | ||
| 149 | + relative_bad = b"""\ | ||
| 150 | + begin 644 ../../../../../../../../tmp/test1 | ||
| 151 | + $86)C"@`` | ||
| 152 | + ` | ||
| 153 | + end | ||
| 154 | + """ | ||
| 155 | + with self.assertRaisesRegex(uu.Error, 'directory'): | ||
| 156 | + uu.decode(io.BytesIO(relative_bad)) | ||
| 157 | + if os.altsep: | ||
| 158 | + relative_bad_bs = relative_bad.replace(b'/', b'\\') | ||
| 159 | + with self.assertRaisesRegex(uu.Error, 'directory'): | ||
| 160 | + uu.decode(io.BytesIO(relative_bad_bs)) | ||
| 161 | + | ||
| 162 | + absolute_bad = b"""\ | ||
| 163 | + begin 644 /tmp/test2 | ||
| 164 | + $86)C"@`` | ||
| 165 | + ` | ||
| 166 | + end | ||
| 167 | + """ | ||
| 168 | + with self.assertRaisesRegex(uu.Error, 'directory'): | ||
| 169 | + uu.decode(io.BytesIO(absolute_bad)) | ||
| 170 | + if os.altsep: | ||
| 171 | + absolute_bad_bs = absolute_bad.replace(b'/', b'\\') | ||
| 172 | + with self.assertRaisesRegex(uu.Error, 'directory'): | ||
| 173 | + uu.decode(io.BytesIO(absolute_bad_bs)) | ||
| 174 | + | ||
| 175 | + | ||
| 148 | 176 | class UUStdIOTest(unittest.TestCase): | |
| 149 | 177 | ||
| 150 | 178 | def setUp(self): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -130,7 +130,14 @@ def decode(in_file, out_file=None, mode=None, quiet=False): | |||
| 130 | 130 | # If the filename isn't ASCII, what's up with that?!? | |
| 131 | 131 | out_file = hdrfields[2].rstrip(b' \t\r\n\f').decode("ascii") | |
| 132 | 132 | if os.path.exists(out_file): | |
| 133 | - raise Error('Cannot overwrite existing file: %s' % out_file) | ||
| 133 | + raise Error(f'Cannot overwrite existing file: {out_file}') | ||
| 134 | + if (out_file.startswith(os.sep) or | ||
| 135 | + f'..{os.sep}' in out_file or ( | ||
| 136 | + os.altsep and | ||
| 137 | + (out_file.startswith(os.altsep) or | ||
| 138 | + f'..{os.altsep}' in out_file)) | ||
| 139 | + ): | ||
| 140 | + raise Error(f'Refusing to write to {out_file} due to directory traversal') | ||
| 134 | 141 | if mode is None: | |
| 135 | 142 | mode = int(hdrfields[1], 8) | |
| 136 | 143 | # | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Upgrade pip wheel bundled with ensurepip (pip 23.0.1) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + Do not expose the local on-disk location in directory indexes | ||
| 2 | + produced by :class:`http.client.SimpleHTTPRequestHandler`. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments