Skip to content

Restore multiple HAR inputs in the CLI - #399

Open
2836048681 wants to merge 1 commit into
Kong:masterfrom
2836048681:fix/300-multiple-har-inputs
Open

2836048681 wants to merge 1 commit into
Kong:masterfrom
2836048681:fix/300-multiple-har-inputs

Conversation

@2836048681

Copy link
Copy Markdown

httpsnippet ./requests/*.json --target shell --client curl --output ./snippets currently rejects all but the first path expanded by the shell. Accept one or more HAR paths, convert each using the same target and client options, and create the output directory when needed. Without --output, write each snippet to stdout.

Fixes #300.

Validation

  • The multi-file regression test fails on the original source and passes with the fix. The single-file stdout test also passes.
  • The built CLI produced 17 nonempty snippets from the 17 fixtures matched by src/fixtures/requests/*.json using the issue's Node/Unirest example.
  • On Node.js 24.22.1, npm test -- --runInBand passed 749 tests across 21 suites. npm run build, npm run lint, and tsc --noEmit passed.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Codex seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread src/cli.ts
return;
}
for (const harFilePath of harFilePaths) {
const har = JSON.parse(readFileSync(harFilePath, 'utf8')) as HarRequest;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Potential file inclusion attack via reading file - medium severity
If an attacker can control the input leading into the ReadFile function, they might be able to read sensitive files and launch further attacks with that information.

Show fix

Remediation: Ignore this issue only after you've verified or sanitized the input going into this function. This issue is only relevant in the backend, not in the frontend!

Reply @AikidoSec ignore: [REASON] to ignore this issue.
More info

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.

regression: CLI processing of globs

2 participants