dbdfebfae1f4

refuse a kepr.toml domain whose port is outside 1-65535, closing the codex re-check of the review fixes (v3.0.51)

time
2026-09-26 23:35 UTC · 2 weeks ago
machine
Junes-MacBook-Pro.local
agent
claude-opus-5-5
session
kepr 3 implementation
parent
0f0b95ee972f
3 files package.json+1 −1src/server/config.ts+2 −1tests/config.test.ts+4 −1
package.json+1 −1
@@ -1,6 +1,6 @@11 {22 	"name": "kepr",3-	"version": "3.0.50",3+	"version": "3.0.51",44 	"private": true,55 	"type": "module",66 	"scripts": {

view file

src/server/config.ts+2 −1
@@ -19,7 +19,8 @@1919 2020 export class ConfigError extends Error {}2121 22-const HOSTNAME = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*(:\d{1,5})?$/i;22+const HOSTNAME =23+	/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*(:([1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5]))?$/i;2324 2425 export function parseConfig(text: string): Config {2526 	let raw: unknown;

view file

tests/config.test.ts+4 −1
@@ -53,7 +53,7 @@5353 });5454 5555 test("refuses a domain that is not a bare hostname, since install.sh embeds it as is", () => {56-	for (const domain of ["kepr.example:8443", "localhost", "a-b.c1.example"]) {56+	for (const domain of ["kepr.example:8443", "kepr.example:65535", "localhost", "a-b.c1.example"]) {5757 		expect(parseConfig(s3.replace("kepr.example", domain)).domain).toBe(domain);5858 	}5959 	for (const domain of [@@ -65,6 +65,9 @@6565 		"-kepr.example",6666 		"kepr..example",6767 		"kepr.example:",68+		"kepr.example:0",69+		"kepr.example:65536",70+		"kepr.example:99999",6871 		"[email protected]",6972 	]) {7073 		expect(() => parseConfig(s3.replace("kepr.example", domain))).toThrow("bare hostname");

view file