Skip to content

fix(deps): resolve csv-parse Snyk finding and upgrade cli-utilities and cli-command to 2.0.2 - #242

Open
SakshiKoli-CS wants to merge 5 commits into
developmentfrom
cl-7796
Open

SakshiKoli-CS wants to merge 5 commits into
developmentfrom
cl-7796

Conversation

@SakshiKoli-CS

@SakshiKoli-CS SakshiKoli-CS commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Jira: CL-7796

What

Fixes the csv-parse Snyk finding and upgrades @contentstack/cli-utilities and @contentstack/cli-command to 2.0.2. qs and traverse were fixed separately by #243, which is merged into this branch.

Finding Severity Status
csv-parse 4.16.3 Medium Fixed here. tty-table's csv is overridden to ^6.6.4, which brings in csv-parse 7.0.3. tty-table loads csv only in its own command-line tool, not in the table rendering cli-utilities uses.
qs, traverse High / Medium Already fixed on development by #243
deepmerge 4.3.1 Medium Still open, not ignored. No patched version has been released. It comes from @rollup/plugin-node-resolve, which only merges its own built-in defaults with it, so it can't be reached.

cli-utilities / cli-command 2.0.2

  • The two packages move together, because cli-command 2.0.2 pins cli-utilities ~2.0.2.
  • 2.x loads chalk 5 asynchronously (it's ESM-only), and any coloured print throws Chalk not loaded until loadChalk() has run. BaseCommand.init and Functions.init now call it first. If the host csdx has already loaded chalk, the call does nothing.

Side effects of changing base-command.ts

  • Lint: the pre-commit lint hook checks the whole file, and it had 4 existing errors. Fixed without changing behaviour:
    • dropped the self alias of this;
    • spread the already-imported config instead of require('./config');
    • made headers a const.
  • .cs-launch.json: getConfig now reads it with JSON.parse(readFileSync(...)) instead of require(). This resolves the path from the current directory, the same as the existsSync check before it, and doesn't cache the file.
  • Talisman: it flagged lines that were already in the file (words like configKeys and sharedConfig). Added checksums to .talismanrc for src/base-command.ts and test/unit/base-command.test.ts.

Test-only changes

  • The integration harness now patches inquirer.default.prompt, because inquirer 12 moved prompt there.
  • The integration Jest config maps chalk to chalk 4, since Jest can't load ESM-only chalk 5.
  • The unit-test mock for cli-utilities and base-command.test.ts now load chalk.

Tests

  • npm run build is clean, and eslint is clean on the changed files.
  • Jest unit tests: 141/141 pass.
  • Integration tests: 31/31 pass.
  • Mocha unit tests: the same pass/fail list as development on cli-utilities 1.x. 18 of those tests already fail on development, and nothing new fails.
  • snyk test reports only deepmerge.

Before release: run a real launch:* command inside csdx, both logged in and logged out.

SakshiKoli-CS and others added 3 commits October 15, 2026 14:02
…nd cli-command to 2.0.2

Snyk (snyk test on development) reported qs, traverse, csv-parse and
deepmerge. This fixes the first three:
- qs 6.16.0 (High): express ^4.22.3 and the qs override raised to ^6.16.1.
- traverse 0.6.11: override to ^0.6.14 (comes in through cli-utilities).
- csv-parse 4.16.3: tty-table's csv overridden to ^6.6.4, which brings
  in csv-parse 7.0.3. tty-table loads csv only in its own command-line
  tool, not in the table rendering cli-utilities uses.
deepmerge 4.3.1 (via @rollup/plugin-node-resolve) has no patched release
and stays open. It is not reachable: the plugin only merges its own
built-in defaults.

@contentstack/cli-utilities and @contentstack/cli-command move to ^2.0.2
together (cli-command 2.0.2 pins cli-utilities ~2.0.2). 2.x loads ESM-only
chalk 5 asynchronously and throws "Chalk not loaded" on any coloured print
until loadChalk() has run, so BaseCommand.init and Functions.init now call
it first. If the host csdx has already loaded chalk, the call does nothing.

Staging base-command.ts made the lint pre-commit hook check the whole
file, which had 4 existing lint errors. Fixed without changing behaviour:
dropped the `self` alias of `this`, spread the already-imported config
instead of require('./config'), made `headers` const, and kept the
dynamic require of the user's .cs-launch.json behind an eslint-disable
comment.

Test-only changes for the upgrade:
- The integration harness patches inquirer.default.prompt (inquirer 12
  moved prompt to the default export).
- The integration Jest config maps chalk to chalk 4, since Jest cannot
  load ESM-only chalk 5.
- The cli-utilities unit mock and base-command.test.ts load chalk.

Build is clean and Jest unit tests pass 141/141. Mocha unit and
integration results match the 1.x baseline.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…dded comments

launch-cli's AGENTS.md says not to add code comments, and the previous
commit added two: an eslint-disable for the require() of .cs-launch.json
and a note in jest.integration.config.js.

getConfig now reads the config with JSON.parse(readFileSync(...)) rather
than require(). The guard above it already checks the same path with
existsSync, which resolves relative to the current directory, and
readFileSync does too; require() resolved it relative to the module and
cached the result for the whole process.

Lint is clean, build passes, and Jest unit tests pass 141/141. Mocha
results match the 1.x baseline, and integration tests pass 31/31.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
… base-command files

Talisman scans only the files a push changes, so changing
src/base-command.ts and test/unit/base-command.test.ts made it report
lines that were already there. They are false positives on the words
"keys" (configKeys, keys(config)) and "shared" (sharedConfig test names),
not secrets.

Following the existing .talismanrc convention: narrow allowed_patterns
for the source file, and a checksum for the test file.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@SakshiKoli-CS
SakshiKoli-CS requested review from a team as code owners October 15, 2026 09:11
@snyk-io

snyk-io Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

Replaces the allowed_patterns entry for src/base-command.ts with a
checksum, the same as test/unit/base-command.test.ts.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
development gained #243, which fixes qs and traverse with its own
overrides and drops the brace-expansion and eslint/ajv overrides. It
conflicted with this branch in package.json's overrides block.

Resolved by taking development's overrides as they are and adding only
this branch's tty-table csv override (the csv-parse fix). This branch's
traverse override and express bump are dropped, because #243 already
covers them. package-lock.json is regenerated from development's lockfile.

Resolves to cli-utilities and cli-command 2.0.2, csv-parse 7.0.3,
qs 6.16.1 and traverse 0.6.14. Build passes, Jest unit tests pass
141/141, integration tests pass 31/31, and Mocha results match the 1.x
baseline. snyk test reports only deepmerge.

#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@SakshiKoli-CS SakshiKoli-CS changed the title fix(deps): resolve Snyk findings and upgrade cli-utilities and cli-command to 2.0.2 (+Claude) fix(deps): resolve csv-parse Snyk finding and upgrade cli-utilities and cli-command to 2.0.2 (+Claude) Oct 15, 2026
@github-actions

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 1 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 0
  • High without fixes: 0
  • Medium without fixes: 1
  • Low without fixes: 0

✅ BUILD PASSED - All security checks passed

@SakshiKoli-CS SakshiKoli-CS changed the title fix(deps): resolve csv-parse Snyk finding and upgrade cli-utilities and cli-command to 2.0.2 (+Claude) fix(deps): resolve csv-parse Snyk finding and upgrade cli-utilities and cli-command to 2.0.2 Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants