Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/fixtures/config-ts/repomix.config.cts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Don't import defineConfig to avoid jiti transforming src/ files during tests
// This ensures stable coverage by preventing double instrumentation
export default {
module.exports = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

A critical Arbitrary Code Execution vulnerability exists in the configuration loading logic in src/config/configLoad.ts. The loadFileConfig function (line 71) takes a path from a command-line argument (argConfigPath) and uses it to load and execute a script file (line 140) without proper validation. This allows an attacker to execute any script on the system.

Impact: This can lead to a full system compromise.

Recommendation: The vulnerability is in src/config/configLoad.ts and should be fixed there by validating that the argConfigPath resolves to a path within the project's root directory. For example:

// In src/config/configLoad.ts
const fullPath = path.resolve(rootDir, argConfigPath);
const normalizedRootDir = path.resolve(rootDir);

if (!fullPath.startsWith(normalizedRootDir)) {
  throw new RepomixError(`Security risk: Config path is outside the project directory.`);
}

This vulnerability is reported on this file because the file is processed by the vulnerable code path.

output: {
filePath: 'cts-output.xml',
style: 'plain',
Expand Down
1 change: 0 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"rootDir": "./src",
"declaration": true,
"sourceMap": false,
"declarationMap": false,
"removeComments": true
Expand Down
7 changes: 3 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"compileOnSave": false,
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "es2016",
"moduleDetection": "force",
"target": "es2022",
"outDir": "./lib",
"rootDir": ".",
"strict": true,
"esModuleInterop": true,
"noImplicitAny": true,
"verbatimModuleSyntax": true,
"skipLibCheck": true,
"lib": ["es2022"],
"declaration": true,
Expand Down
Loading