python-inspector 0.15.3__py3-none-any.whl → 0.15.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -218,6 +218,44 @@ collect_urls = re.compile('href="([^"]+)"').findall
218
218
  ################################################################################
219
219
 
220
220
 
221
+ def _url_origin(url):
222
+ """
223
+ Return the ``(scheme, hostname, port)`` origin of ``url``, or None.
224
+ """
225
+ parsed = urlparse(url)
226
+ scheme = (parsed.scheme or "").lower()
227
+ hostname = (parsed.hostname or "").lower()
228
+ if not scheme or not hostname:
229
+ return None
230
+ try:
231
+ port = parsed.port
232
+ except ValueError:
233
+ return None
234
+ if port is None:
235
+ if scheme == "https":
236
+ port = 443
237
+ elif scheme == "http":
238
+ port = 80
239
+ else:
240
+ return None
241
+ return scheme, hostname, port
242
+
243
+
244
+ def credentials_for_linked_download(credentials, index_url, download_url):
245
+ """
246
+ Return ``credentials`` when ``download_url`` has the same origin as ``index_url``.
247
+
248
+ Credentials selected for a private index authorize that index origin only.
249
+ A wheel or sdist linked on another host must be fetched without them.
250
+ """
251
+ if not credentials:
252
+ return None
253
+ index_origin = _url_origin(index_url)
254
+ if not index_origin or index_origin != _url_origin(download_url):
255
+ return None
256
+ return credentials
257
+
258
+
221
259
  class DistributionNotFound(Exception):
222
260
  pass
223
261
 
@@ -258,7 +296,11 @@ async def download_wheel(
258
296
  )
259
297
  continue
260
298
  for wheel in supported_and_valid_wheels:
261
- wheel.credentials = repo.credentials
299
+ wheel.credentials = credentials_for_linked_download(
300
+ credentials=repo.credentials,
301
+ index_url=repo.index_url,
302
+ download_url=wheel.path_or_url,
303
+ )
262
304
  fetched_wheel_filename = await wheel.download(
263
305
  dest_dir=dest_dir,
264
306
  verbose=verbose,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-inspector
3
- Version: 0.15.3
3
+ Version: 0.15.4
4
4
  Summary: python-inspector is is a collection of utilities to collect PyPI package metadata and resolve packages dependencies.
5
5
  Home-page: https://github.com/aboutcode-org/python-inspector
6
6
  Author: nexB. Inc. and others
@@ -26,18 +26,18 @@ python_inspector/setup_py_live_eval.py.LICENSE,sha256=5wfEqJLf5ANizw20WUURuTgoZO
26
26
  python_inspector/utils.py,sha256=dTx04Fsf4YKFaOXfjQ64lZwUCGYIIriQstufDOki6Bg,4608
27
27
  python_inspector/utils_pip_compatibility_tags.py,sha256=8ZQkXLldhqqO4sJ0aVXQwWYdw3Qo1_C9MhntShVlgE8,6831
28
28
  python_inspector/utils_pip_compatibility_tags.py.ABOUT,sha256=tFhzj7qUEA9H-Tg6K1BI5QBtmQEq0vHg0X2Ws7t073U,540
29
- python_inspector/utils_pypi.py,sha256=QzMvW1IR5pc2k5VxppOF_Dob5cA_3FkaBxxW5cUGi1Y,60160
29
+ python_inspector/utils_pypi.py,sha256=PZcpT2hYTIv97mFWIgEeLkmgNtr8z05h2-fqbOOYVig,61421
30
30
  python_inspector/utils_pypi.py.ABOUT,sha256=7s9WCNmS-qJJgHC979fI4whrM5Y41-Ar-LZoIfZXPVU,635
31
31
  python_inspector/utils_pypi_supported_tags.py,sha256=SdbIlKoCgyqBZIesEdrFhVMnYikBirvSDvPUPIomTSo,2850
32
32
  python_inspector/utils_pypi_supported_tags.py.ABOUT,sha256=ndJ1kQS6u7caYmLc6XVnNIdKfpnvGjKepxpmhQJWJyA,741
33
- python_inspector-0.15.3.dist-info/licenses/AUTHORS.rst,sha256=cLH597eiqyd4cSHJ9Ny_CcbSWzTT7_VTCg3Zw43b4Ns,107
34
- python_inspector-0.15.3.dist-info/licenses/CHANGELOG.rst,sha256=T7hDSZYTn5jiDsGRJTUGulbZgGm8dkm_46FO3AsWmV8,7535
35
- python_inspector-0.15.3.dist-info/licenses/CODE_OF_CONDUCT.rst,sha256=xXDTFpYY3Y7JoxrWADihieUvhGlwJc_oxsbmLJaBvE4,3422
36
- python_inspector-0.15.3.dist-info/licenses/NOTICE,sha256=fkLIlzyP8zWNnPbFSXkTInNgYl35THH5-J8vMKuNzhc,761
37
- python_inspector-0.15.3.dist-info/licenses/README.rst,sha256=lGqwoa_zkEOLFCUS-2l0uwbFM7ZavDTrSaV4YaUULNg,7065
38
- python_inspector-0.15.3.dist-info/licenses/apache-2.0.LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
39
- python_inspector-0.15.3.dist-info/METADATA,sha256=T5-EXPkALFmehtLDtYq-ubPubat81XeGvPCd8AhGUWc,9421
40
- python_inspector-0.15.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
41
- python_inspector-0.15.3.dist-info/entry_points.txt,sha256=2s9F95rPWbgz3cOnKN3Z7PwzglPt2EsX2qf7W0Xubpk,87
42
- python_inspector-0.15.3.dist-info/top_level.txt,sha256=C-KAHTL8C6jd7QULvFk83YjOBVxDrnyefG3RikRHRlw,31
43
- python_inspector-0.15.3.dist-info/RECORD,,
33
+ python_inspector-0.15.4.dist-info/licenses/AUTHORS.rst,sha256=cLH597eiqyd4cSHJ9Ny_CcbSWzTT7_VTCg3Zw43b4Ns,107
34
+ python_inspector-0.15.4.dist-info/licenses/CHANGELOG.rst,sha256=tm9fKPwk6E2BmKPQ7iW0AyeYxH0SH0QmaxBzyWJ-_Co,8171
35
+ python_inspector-0.15.4.dist-info/licenses/CODE_OF_CONDUCT.rst,sha256=xXDTFpYY3Y7JoxrWADihieUvhGlwJc_oxsbmLJaBvE4,3422
36
+ python_inspector-0.15.4.dist-info/licenses/NOTICE,sha256=fkLIlzyP8zWNnPbFSXkTInNgYl35THH5-J8vMKuNzhc,761
37
+ python_inspector-0.15.4.dist-info/licenses/README.rst,sha256=lGqwoa_zkEOLFCUS-2l0uwbFM7ZavDTrSaV4YaUULNg,7065
38
+ python_inspector-0.15.4.dist-info/licenses/apache-2.0.LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
39
+ python_inspector-0.15.4.dist-info/METADATA,sha256=e2wkcf6jywMLaGRT8EEVi31-3Z_5kzYkj-ngWSPYrCg,9421
40
+ python_inspector-0.15.4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
41
+ python_inspector-0.15.4.dist-info/entry_points.txt,sha256=2s9F95rPWbgz3cOnKN3Z7PwzglPt2EsX2qf7W0Xubpk,87
42
+ python_inspector-0.15.4.dist-info/top_level.txt,sha256=C-KAHTL8C6jd7QULvFk83YjOBVxDrnyefG3RikRHRlw,31
43
+ python_inspector-0.15.4.dist-info/RECORD,,
@@ -1,6 +1,17 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v0.15.4
5
+ -----------
6
+ - Stop sending private-index credentials to wheel hosts that are not the index.
7
+ Netrc credentials were chosen for the index hostname and stored on the
8
+ repository. Wheel downloads then copied those credentials onto every linked
9
+ wheel, and the HTTP helper sent them as Basic authentication. A private feed
10
+ can link a wheel on another host, such as a public mirror or CDN, so that
11
+ host received the index token on a new request. Credentials are now attached
12
+ only when the wheel URL has the same origin as the index URL: scheme,
13
+ hostname, and port. A wheel served by the index itself still receives them.
14
+
4
15
  v0.15.3
5
16
  -----------
6
17
  - Add support for PEP 751 pylock.toml lock files as input.