Repository navigation
Description
Verified against (commit SHA or released version)
Published @testsprite/[email protected] and source commit 988c0355bb05631e9c6c1785e443937ff2a88c0e. macOS 27.2 (arm64), Node.js v26.12.0.
Discord Username / User ID
shydev69
What does this improvement do?
ci init github follows a symlinked .github directory and creates its default workflow outside the repository, without --force. The default repository workflow path should reject symlinked ancestors before creating directories or writing the file.
Details / implementation notes
Steps to reproduce
The script runs the real CLI twice: once in an ordinary fixture directory and once with .github pointing to a sibling directory. Both directories are inside one temporary root. It passes a dummy project, disables telemetry/update checks, and does not request --set-secret or --force.
From a checkout of the verified commit:
npm ci
npm run buildSave the script below as workflow-symlink.mjs, then run:
node workflow-symlink.mjs ./dist/index.jsworkflow-symlink.mjs
import { mkdtempSync, mkdirSync, symlinkSync, existsSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { spawnSync } from 'node:child_process';
const cli = resolve(process.argv[2] ?? './dist/index.js');
const root = mkdtempSync(join(tmpdir(), 'testsprite-workflow-repro-'));
for (const variant of ['control', 'symlink']) {
const repo = join(root, variant);
const outside = join(root, `${variant}-outside`);
mkdirSync(repo);
mkdirSync(outside);
if (variant === 'symlink') symlinkSync(`../${variant}-outside`, join(repo, '.github'));
const result = spawnSync(process.execPath, [cli, 'ci', 'init', 'github',
'--project', 'prj_fixture', '--output', 'json'], {
cwd: repo, encoding: 'utf8', timeout: 10000,
env: { PATH: process.env.PATH, TESTSPRITE_API_KEY: 'sk-user-dummy-repro',
TESTSPRITE_NO_TELEMETRY: '1', TESTSPRITE_NO_UPDATE_NOTIFIER: '1', DO_NOT_TRACK: '1' },
});
console.log(JSON.stringify({ variant, exitCode: result.status,
insideCreated: existsSync(join(repo, '.github/workflows/testsprite.yml')),
outsideCreated: existsSync(join(outside, 'workflows/testsprite.yml')),
output: result.stdout.trim(), stderr: result.stderr.trim(), error: result.error?.message,
}));
}
console.log(`Fixture retained at ${root}`);Actual result
| Fixture | CLI exit | Workflow created in sibling *-outside directory |
|---|---|---|
| Ordinary directory | 0 | No |
.github symlink |
0 | Yes |
Both CLI responses report "wrote": true and "status": "written". In the symlink case, the physical destination is outside the fixture repository. Expected: reject that default path without writing into the sibling directory.
This report does not claim irreversible file destruction. The existing forced-overwrite path keeps a .bak backup.
Proposed fix
Check existing path components for symlinks before creating the default workflow, using the existing installer guard as a starting point. Preserve intentional custom --path behavior and existing backup semantics.
Relevant code: directory creation and exclusive final write, backup handling, and the existing installer guard.
Confirmations
- I have searched existing issues and this is not a duplicate.
- I have provided my Discord identity above for reward coordination.
Activity
fyZhang66 commentedon Oct 20, 2026
Confirmed on v0.15.0, thanks @ayush-that.
ci initrunsmkdir -pand writes through a symlinked.githubancestor without looking;agent installalready has a symlink guard thatci initdoesn't use. Accepted, scope:agent installguard..githuband a symlinkedworkflowspointing outside the repo are refused and nothing is created; a symlink that stays inside the repo still works.No new dependency. Comment
/assignto claim it.ayush-that commentedon Oct 21, 2026
/assign
testsprite-hob commentedon Oct 21, 2026
Assigned to @ayush-that. Thanks for taking this on. (2 more slots available.)
Your open assigned issues (1/3):
(none)
fix(ci): reject workflow symlinks that resolve outside the repository (…