diff --git a/test/skill-validation.test.ts b/test/skill-validation.test.ts index 03640ccb..7472676f 100644 --- a/test/skill-validation.test.ts +++ b/test/skill-validation.test.ts @@ -979,6 +979,15 @@ describe('gstack-slug', () => { expect(lines[0]).toMatch(/^SLUG=.+/); expect(lines[1]).toMatch(/^BRANCH=.+/); }); + + test('output values contain only safe characters (no shell metacharacters)', () => { + const result = Bun.spawnSync([SLUG_BIN], { cwd: ROOT, stdout: 'pipe', stderr: 'pipe' }); + const slug = result.stdout.toString().match(/SLUG=(.*)/)?.[1] ?? ''; + const branch = result.stdout.toString().match(/BRANCH=(.*)/)?.[1] ?? ''; + // Only alphanumeric, dot, dash, underscore are allowed (#133) + expect(slug).toMatch(/^[a-zA-Z0-9._-]+$/); + expect(branch).toMatch(/^[a-zA-Z0-9._-]+$/); + }); }); // --- Test Bootstrap validation ---