From 929ced2c578c561a6297403b292a5e4878cc8fab Mon Sep 17 00:00:00 2001 From: "smart-ssh-coder[bot]" <338317697+smart-ssh-coder[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 14:51:57 +0000 Subject: [PATCH 1/3] fix(license): reject array-of-tables and dotted deny.toml exceptions (#1595) Co-Authored-By: Claude Sonnet 5.5 --- .../frontend/src/licenseCompatCheck.test.ts | 25 +++++++++++++++++++ scripts/generate-third-party-notices.mjs | 10 ++++++++ 2 files changed, 35 insertions(+) diff --git a/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts b/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts index 35467ebab..58e2a3866 100644 --- a/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts +++ b/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts @@ -107,6 +107,31 @@ describe("check-license-compat", () => { ).toEqual([]); }); + it("rejects the array-of-tables form, naming the form", () => { + const body = '[[licenses.exceptions]]\ncrate = "x"\nallow = ["GPL-2.0"]\n'; + expect(() => parseExceptions(raw(body))).toThrow(/array of tables/); + }); + + it("rejects the dotted-key form", () => { + const body = 'licenses.exceptions = [{ crate = "x", allow = ["GPL-2.0"] }]\n'; + expect(() => parseExceptions(raw(body))).toThrow(/dotted key/); + }); + + it("ignores a commented-out array-of-tables header", () => { + expect(parseExceptions(raw('# [[licenses.exceptions]]\n#licenses.exceptions = []\n'))).toEqual([]); + }); + + it("check-license-compat exits non-zero for both alternative forms", () => { + for (const body of [ + '[[licenses.exceptions]]\ncrate = "x"\nallow = ["GPL-2.0"]\n', + 'licenses.exceptions = [{ crate = "x", allow = ["GPL-2.0"] }]\n', + ]) { + const bad = spawnSync(process.execPath, [SCRIPT, raw(body)], { encoding: "utf8" }); + expect(bad.status).not.toBe(0); + expect(bad.stderr).toContain("exceptions"); + } + }); + it("returns the sqlcipher-src entry of the repo deny.toml", () => { expect(parseExceptions(path.resolve(__dirname, "../../../../deny.toml"))).toEqual([ { crate: "sqlcipher-src", allow: ["blessing", "WTFPL"] }, diff --git a/scripts/generate-third-party-notices.mjs b/scripts/generate-third-party-notices.mjs index 8b11b5fb6..c0e6b4c2a 100644 --- a/scripts/generate-third-party-notices.mjs +++ b/scripts/generate-third-party-notices.mjs @@ -153,6 +153,16 @@ function parseExceptions(licensesFilePath) { .split("\n") .map((l) => l.replace(/#.*$/, "")) .join("\n"); + // Other valid TOML spellings of the same data are rejected (fail closed): + // the repo uses the `exceptions = [ … ]` block only. + const alt = content.match( + /^[ \t]*(?:\[\[[^\]\n]*\bexceptions\s*\]\]|licenses\s*\.\s*exceptions\s*=.*)$/m, + ); + if (alt) { + fail( + `Nicht unterstützte Schreibweise der Ausnahmen in ${licensesFilePath} (array of tables / dotted key): ${alt[0].trim()} — bitte den Block "exceptions = [ … ]" unter [licenses] verwenden.`, + ); + } const key = content.match(/^[ \t]*exceptions\s*=\s*\[/m); if (!key) return []; // Find the matching closing bracket (entries contain nested `allow = [..]`), From de0b2d9b60af4d4d726ffb1dd1df198c7f0d6ddb Mon Sep 17 00:00:00 2001 From: "smart-ssh-coder[bot]" <338317697+smart-ssh-coder[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 15:55:03 +0000 Subject: [PATCH 2/3] fix(ci): reject exceptions headers with trailing comment or whitespace (#1595) Co-Authored-By: Claude Sonnet 5.5 --- .../frontend/src/licenseCompatCheck.test.ts | 6 ++++++ scripts/generate-third-party-notices.mjs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts b/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts index 58e2a3866..ccc206fec 100644 --- a/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts +++ b/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts @@ -112,6 +112,12 @@ describe("check-license-compat", () => { expect(() => parseExceptions(raw(body))).toThrow(/array of tables/); }); + it("rejects headers with a trailing comment or whitespace", () => { + for (const h of ["[[licenses.exceptions]] # note", "[[licenses.exceptions]] "]) { + expect(() => parseExceptions(raw(`${h}\ncrate = "x"\n`))).toThrow(/array of tables/); + } + }); + it("rejects the dotted-key form", () => { const body = 'licenses.exceptions = [{ crate = "x", allow = ["GPL-2.0"] }]\n'; expect(() => parseExceptions(raw(body))).toThrow(/dotted key/); diff --git a/scripts/generate-third-party-notices.mjs b/scripts/generate-third-party-notices.mjs index c0e6b4c2a..ceaeea56b 100644 --- a/scripts/generate-third-party-notices.mjs +++ b/scripts/generate-third-party-notices.mjs @@ -156,7 +156,7 @@ function parseExceptions(licensesFilePath) { // Other valid TOML spellings of the same data are rejected (fail closed): // the repo uses the `exceptions = [ … ]` block only. const alt = content.match( - /^[ \t]*(?:\[\[[^\]\n]*\bexceptions\s*\]\]|licenses\s*\.\s*exceptions\s*=.*)$/m, + /^[ \t]*(?:\[\[[^\]\n]*\bexceptions\s*\]\]|licenses\s*\.\s*exceptions\s*=.*)[ \t]*$/m, ); if (alt) { fail( From f32410e74c3c4f7e6efc00d9cc65407ffc689243 Mon Sep 17 00:00:00 2001 From: "smart-ssh-coder[bot]" <338317697+smart-ssh-coder[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 16:39:31 +0000 Subject: [PATCH 3/3] fix(scripts): handle CRLF deny.toml in exceptions parser (#1595) Co-Authored-By: Claude Sonnet 5.5 --- .../frontend/src/licenseCompatCheck.test.ts | 7 +++++++ scripts/generate-third-party-notices.mjs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts b/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts index ccc206fec..2ef152ae0 100644 --- a/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts +++ b/apps/smart-ssh-community/frontend/src/licenseCompatCheck.test.ts @@ -118,6 +118,13 @@ describe("check-license-compat", () => { } }); + it("rejects a CRLF header with a trailing comment", () => { + const body = '[[licenses.exceptions]] # note\r\ncrate = "x"\r\nallow = ["GPL-2.0"]\r\n'; + expect(() => parseExceptions(raw(body))).toThrow(/array of tables/); + const bad = spawnSync(process.execPath, [SCRIPT, raw(body)], { encoding: "utf8" }); + expect(bad.status).not.toBe(0); + }); + it("rejects the dotted-key form", () => { const body = 'licenses.exceptions = [{ crate = "x", allow = ["GPL-2.0"] }]\n'; expect(() => parseExceptions(raw(body))).toThrow(/dotted key/); diff --git a/scripts/generate-third-party-notices.mjs b/scripts/generate-third-party-notices.mjs index ceaeea56b..dade203dc 100644 --- a/scripts/generate-third-party-notices.mjs +++ b/scripts/generate-third-party-notices.mjs @@ -150,7 +150,7 @@ function parseExceptions(licensesFilePath) { // Strip comments first, so commented-out entries are not counted as active. const content = fs .readFileSync(licensesFilePath, "utf8") - .split("\n") + .split(/\r?\n/) .map((l) => l.replace(/#.*$/, "")) .join("\n"); // Other valid TOML spellings of the same data are rejected (fail closed):