Skip to content

Conversation

@noghartt
Copy link

@noghartt noghartt commented Jan 16, 2024

related to this issue #99

@MaximeCheramy
Copy link

I'm surprised that this would work. I use this patch on one of my projects:

diff --git a/node_modules/openapi-snippet/index.js b/node_modules/openapi-snippet/index.js
index ea07bdf..b71ab0b 100644
--- a/node_modules/openapi-snippet/index.js
+++ b/node_modules/openapi-snippet/index.js
@@ -9,7 +9,7 @@
 'use strict';

 const OpenAPIToHar = require('./openapi-to-har.js');
-const HTTPSnippet = require('httpsnippet');
+const { HTTPSnippet, availableTargets } = require('httpsnippet');

 /**
  * Return snippets for endpoint identified using path and method in the given
@@ -147,7 +147,7 @@ const formatTarget = function (targetStr) {
   const title = capitalizeFirstLetter(language);
   let library = targetStr.split('_')[1];

-  const validTargets = HTTPSnippet.availableTargets();
+  const validTargets = availableTargets();
   let validLanguage = false;
   let validLibrary = false;
   for (let i in validTargets) {

@julian-alarcon
Copy link

julian-alarcon commented Mar 5, 2025

⚠️ ⚠️ ⚠️
This also solves a High level vulnerability in ansi-regex 2.1.1 is used by httpsnippet
https://security.snyk.io/package/npm/ansi-regex/2.1.1

Regular Expression Denial of Service (ReDoS)

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.

4 participants