portolan-python 0.1.7__tar.gz → 0.1.8__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: portolan-python
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: A lightweight Python implementation of the Portolan specification.
5
5
  Author: Portolan contributors
6
6
  License: Apache-2.0
@@ -8,8 +8,8 @@ preferred package index for published versions.
8
8
  Push a tag that matches the version in `pyproject.toml`:
9
9
 
10
10
  ```bash
11
- git tag v0.1.7
12
- git push origin v0.1.7
11
+ git tag v0.1.8
12
+ git push origin v0.1.8
13
13
  ```
14
14
 
15
15
  The release workflow runs the tests, builds both distributions, checks their
@@ -25,7 +25,7 @@ Install the wheel attached to a release:
25
25
 
26
26
  ```bash
27
27
  python -m pip install \
28
- https://github.com/jemacchi/portolan-python/releases/download/v0.1.7/portolan_python-0.1.7-py3-none-any.whl
28
+ https://github.com/jemacchi/portolan-python/releases/download/v0.1.8/portolan_python-0.1.8-py3-none-any.whl
29
29
  ```
30
30
 
31
31
  This path needs no package index account.
@@ -35,7 +35,7 @@ This path needs no package index account.
35
35
  Install a published version from PyPI with:
36
36
 
37
37
  ```bash
38
- python -m pip install portolan-python==0.1.7
38
+ python -m pip install portolan-python==0.1.8
39
39
  ```
40
40
 
41
41
  Omit the version constraint to install the latest published version.
@@ -10,14 +10,14 @@ GitHub:
10
10
 
11
11
  ```bash
12
12
  python -m pip install \
13
- https://github.com/jemacchi/portolan-python/releases/download/v0.1.7/portolan_python-0.1.7-py3-none-any.whl
13
+ https://github.com/jemacchi/portolan-python/releases/download/v0.1.8/portolan_python-0.1.8-py3-none-any.whl
14
14
  ```
15
15
 
16
16
  You can also install the source at a specific tag:
17
17
 
18
18
  ```bash
19
19
  python -m pip install \
20
- "portolan-python @ git+https://github.com/jemacchi/portolan-python.git@v0.1.7"
20
+ "portolan-python @ git+https://github.com/jemacchi/portolan-python.git@v0.1.8"
21
21
  ```
22
22
 
23
23
  ## List collections and assets
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "portolan-python"
3
- version = "0.1.7"
3
+ version = "0.1.8"
4
4
  description = "A lightweight Python implementation of the Portolan specification."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -61,6 +61,9 @@ def load_registry_entries(
61
61
  registry_id = link.get("portolan_registry:id")
62
62
  if not isinstance(href, str) or not isinstance(registry_id, str):
63
63
  continue
64
+ resolved_url = urljoin(registry_url, href)
65
+ if not _is_remote_url(resolved_url):
66
+ continue
64
67
  status = link.get("portolan_registry:status")
65
68
  if status != "valid" and not include_stale:
66
69
  continue
@@ -72,7 +75,7 @@ def load_registry_entries(
72
75
  entries.append(
73
76
  RegistryCatalogEntry(
74
77
  id=registry_id,
75
- url=urljoin(registry_url, href),
78
+ url=resolved_url,
76
79
  title=title if isinstance(title, str) else None,
77
80
  status=status if isinstance(status, str) else None,
78
81
  bbox=_horizontal_bbox(link.get("bbox")),
@@ -114,6 +117,11 @@ def _horizontal_bbox(value: object) -> tuple[float, float, float, float] | None:
114
117
  return (float(value[0]), float(value[1]), float(value[half]), float(value[half + 1]))
115
118
 
116
119
 
120
+ def _is_remote_url(url: str) -> bool:
121
+ parsed = urlparse(url)
122
+ return parsed.scheme in {"http", "https"} and bool(parsed.netloc)
123
+
124
+
117
125
  def download_registry_catalog(
118
126
  catalog_url: str,
119
127
  output_dir: Path,
@@ -178,6 +178,12 @@ def test_load_registry_entries_skips_invalid_link_shapes() -> None:
178
178
  {"rel": "item", "href": "https://example.test/item.json"},
179
179
  {"rel": "child", "href": "https://example.test/missing-id/catalog.json"},
180
180
  {"rel": "child", "href": 5, "portolan_registry:id": "bad-href"},
181
+ {
182
+ "rel": "child",
183
+ "href": "javascript:alert(1)",
184
+ "portolan_registry:id": "unsafe-scheme",
185
+ "portolan_registry:status": "valid",
186
+ },
181
187
  {
182
188
  "rel": "child",
183
189
  "href": "https://example.test/no-status/catalog.json",
@@ -468,7 +468,7 @@ wheels = [
468
468
 
469
469
  [[package]]
470
470
  name = "portolan-python"
471
- version = "0.1.7"
471
+ version = "0.1.8"
472
472
  source = { editable = "." }
473
473
 
474
474
  [package.optional-dependencies]