Plug-in Library: a package with an unreadable repo URL downloads nothing

When a package names a `repo` that isn't a GitHub repository URL
(`https://github.com/<owner>/<repo>`, a trailing `/` or `.git` allowed, or
a folder in one, `.../tree/<ref>/<path>`), Install, Update and Preview now
refuse its release URLs with an error naming the package. Before, such a
`repo` skipped the repository check and any GitHub release asset was
downloaded. A package without a `repo` keeps any repository's release
asset.

The example catalog's schema now holds `repo` and release `url` to the
same forms, and `scripts/validate.sh` checks that every release is an
asset of the package's `repo` before it downloads anything.
This commit is contained in:
dotCooCoo committed 2026-11-05 23:40:33 -08:00
1 parent 75fed052e3
commit 5dfcadd09b
6 files changed
+117 -29

No files matched your search

+4 -4
View File
@@ -12,9 +12,9 @@
},
"$defs": {
"version": {"type": "string", "maxLength": 32, "pattern": "^[0-9]+(\\.[0-9]+)*$"},
"github_url": {
"release_url": {
"type": "string",
"pattern": "^https://(github\\.com|raw\\.githubusercontent\\.com|objects\\.githubusercontent\\.com|release-assets\\.githubusercontent\\.com)/[^\\s]+$"
"pattern": "^(?!.*/(\\.|%2[eE]){1,2}(/|$))https://[Gg][Ii][Tt][Hh][Uu][Bb]\\.[Cc][Oo][Mm]/[A-Za-z0-9._-]+/[A-Za-z0-9._-]+/releases/download/[^/?#\\\\\\s]+(/[^/?#\\\\\\s]+)+$"
},
"package": {
"type": "object",
@@ -26,7 +26,7 @@
"author": {"type": "string"},
"description": {"type": "string"},
"license": {"type": "string"},
"repo": {"type": "string", "pattern": "^https://"},
"repo": {"type": "string", "pattern": "^(?!.*/(\\.|%2[eE]){1,2}(/|$))[Hh][Tt][Tt][Pp][Ss]://[Gg][Ii][Tt][Hh][Uu][Bb]\\.[Cc][Oo][Mm]/[A-Za-z0-9._-]+/[A-Za-z0-9._-]+(/tree(/[^/?#\\\\\\s]+)+)?/?$"},
"tags": {"type": "array", "items": {"type": "string"}},
"preview": {
"type": "object",
@@ -44,7 +44,7 @@
"version": {"$ref": "#/$defs/version"},
"api": {"type": "integer", "minimum": 0, "maximum": 4294967295},
"minApp": {"$ref": "#/$defs/version"},
"url": {"$ref": "#/$defs/github_url"},
"url": {"$ref": "#/$defs/release_url"},
"sha256": {"type": "string", "pattern": "^[0-9a-fA-F]{64}$"},
"size": {"type": "integer", "minimum": 1, "maximum": 67108864},
"effects": {"type": "array", "minItems": 1, "items": {"type": "string", "pattern": "^(?!ec\\.)[A-Za-z0-9._-]+$"}}