-
Notifications
You must be signed in to change notification settings - Fork 136
Vulnerability in downstream package #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Fixed via #487 |
Reopening. The proper fix is under development. |
Hi @tarunramsinghani , any update on this. |
FYI to workaround the vulnerability while waiting for the actual fix, this is what we added to our package.json to override the cross-spawn transitive dependency version:
Definitely not ideal long term, but seems to still work fine for building/publishing our custom ADO extensions. |
Issue: Integrating clipboardy v4 (ESM) with TypeScript/CommonJS codebaseProblem Description
Error:
Attempted Solutions1. Direct ESM import in TypeScriptimport clipboardy from "clipboardy"; Result: Failed. TypeScript compiled this to 2. Dynamic import compatibility layerlet clipboardyModule: ClipboardyModule | null = null;
const getClipboardy = async () => {
if (!clipboardyModule) {
clipboardyModule = await import('clipboardy');
}
return clipboardyModule.default;
};
export async function write(text: string): Promise<void> {
const clipboardy = await getClipboardy();
return clipboardy.write(text);
} Result: Failed. When compiled, TypeScript converted dynamic imports in ways that still triggered the ESM error. On further investigation and head-banging with some LLMs as well, it seems like the issue could be due to some tsconfig configurations. On resolving the dynamic module approach, I noticed that the compiled code still uses the require approach for fetching clipboardy instead of using the import method. Implemented a child_process bridge:
// clipboardy-helper.mjs
import clipboardy from 'clipboardy';
const action = process.argv[2];
const text = process.argv[3];
async function run() {
try {
switch (action) {
case 'write':
await clipboardy.write(text);
process.stdout.write('success');
break;
case 'read':
process.stdout.write(await clipboardy.read());
break;
// other methods...
}
} catch (error) {
process.stderr.write(error.message);
process.exit(1);
}
}
run();
// lib/clipboardyCompat.ts
import { execFile } from 'child_process';
import * as path from 'path';
const helperPath = path.join(__dirname, 'clipboardy-helper.mjs');
function runHelper(action: string, text?: string): Promise<string> {
return new Promise((resolve, reject) => {
execFile('node', [helperPath, action, text], (error, stdout, stderr) => {
if (error) reject(new Error(stderr || error.message));
else resolve(stdout);
});
});
}
export async function write(text: string): Promise<void> {
await runHelper('write', text);
}
export async function read(): Promise<string> {
return runHelper('read');
}
// other methods...
Questions
|
Regular Expression Denial of Service (ReDoS) in cross-spawn
I am getting this audit result using the latest tfx-cli package (0.18.0)
cross-spawn <6.0.6
Severity: high
Regular Expression Denial of Service (ReDoS) in cross-spawn - GHSA-3xgq-45jj-v275
fix available via
npm audit fix --force
Will install tfx-cli@0.5.14, which is a breaking change
node_modules/cross-spawn
execa 0.5.0 - 0.9.0
Depends on vulnerable versions of cross-spawn
node_modules/execa
clipboardy <=1.2.3
Depends on vulnerable versions of execa
node_modules/clipboardy
tfx-cli >=0.6.0
Depends on vulnerable versions of clipboardy
node_modules/tfx-cli
Fixing this appears to be pretty simple. Upgrading clipboardy to 4.0.0 would resolve the issue. It looks like the api has changed slightly, but since it is only used on one line in tfcommand.ts it should be quite simple to upgrade.
The text was updated successfully, but these errors were encountered: