co-maintainer 0.4.0-beta.1 → 0.4.0-beta.2
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.
- package/dist/package.json +1 -1
- package/dist/src/cli/commands/serve.js +15 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -64,6 +64,21 @@ export function resolveWebhookUrl(args, port, configured) {
|
|
|
64
64
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
65
65
|
die("--webhook-url must use http or https");
|
|
66
66
|
}
|
|
67
|
+
// `new URL` is lenient: "http://http://host/:5000/x" parses with host
|
|
68
|
+
// "http" and the real URL buried in the path, and "http:///x" treats "x"
|
|
69
|
+
// as the host. GitHub needs a routable host and a real webhook path, so
|
|
70
|
+
// reject a scheme leaking into the path, a bare host with no dot or port,
|
|
71
|
+
// and a path that is just "/".
|
|
72
|
+
const hasQualifiedHost = url.hostname === "localhost" ||
|
|
73
|
+
url.hostname.includes(".") ||
|
|
74
|
+
url.port !== "";
|
|
75
|
+
if (url.pathname.startsWith("//") ||
|
|
76
|
+
url.pathname.includes("://") ||
|
|
77
|
+
url.pathname === "/" ||
|
|
78
|
+
!hasQualifiedHost) {
|
|
79
|
+
die("--webhook-url must be an absolute http(s) URL with a webhook path, " +
|
|
80
|
+
"e.g. --webhook-url=https://example.com/github/webhook");
|
|
81
|
+
}
|
|
67
82
|
return url.toString();
|
|
68
83
|
}
|
|
69
84
|
/** `co-maintainer serve --port=N [--password=...] [--disable-auth=password]
|