rufimelo/DeltaSecommits huggingface dataset:
Vulnerability: Eve allows execution of arbitrary code via Code Injection in the where parameter io/mongo/parser.py in Eve (aka pyeve) before 0.7.5 allows remote attackers to execute arbitrary code via Code Injection in the where parameter.
Vulnerability ID: GHSA-8jxq-75rw-fhj9
CWE: CWE-94
Severity score: 9.8
Project: https://github.com/pyeve/eve
Published: 2018-07-12
File: eve/io/mongo/parser.py
Commit message: fix mongo visitor parser
Commit author: Nicola Iarocci

Vulnerable version (before fix):
 def visit_Call(self, node):         datetime().         """         if isinstance(node.func, ast.Name):             expr = None             if node.func.id == 'ObjectId':                 expr = "('" + node.args[0].s + "')"             elif node.func.id == 'datetime':                 values = []                 for arg in node.args:                     values.append(str(arg.n))                 expr = "(" + ", ".join(values) + ")"             if expr:                 self.current_value = eval(node.func.id + expr)      def visit_Attribute(self, node):         """ Attribute handler ('Contact.Id').

Fixed version (after fix):
 def visit_Call(self, node):         datetime().         """         if isinstance(node.func, ast.Name):             if node.func.id == 'ObjectId':                 try:                     self.current_value = ObjectId(node.args[0].s)                 except:                     pass             elif node.func.id == 'datetime':                 values = []                 for arg in node.args:                     values.append(arg.n)                 try:                     self.current_value = datetime(*values)                 except:                     pass      def visit_Attribute(self, node):         """ Attribute handler ('Contact.Id').

Patch:
patch: @@ -122,16 +122,19 @@ def visit_Call(self, node):
         datetime().
         """
         if isinstance(node.func, ast.Name):
-            expr = None
             if node.func.id == 'ObjectId':
-                expr = "('" + node.args[0].s + "')"
+                try:
+                    self.current_value = ObjectId(node.args[0].s)
+                except:
+                    pass
             elif node.func.id == 'datetime':
                 values = []
                 for arg in node.args:
-                    values.append(str(arg.n))
-                expr = "(" + ", ".join(values) + ")"
-            if expr:
-                self.current_value = eval(node.func.id + expr)
+                    values.append(arg.n)
+                try:
+                    self.current_value = datetime(*values)
+                except:
+                    pass
 
     def visit_Attribute(self, node):
         """ Attribute handler ('Contact.Id').
path: eve/io/mongo/parser.py
Vulnerability: Path Traversal in browserless-chrome This affects all versions of browserless-chrome before 1.43.0. User input flowing from the workspace endpoint gets used to create a file path filePath and this is fetched and then sent back to a user. This can be escaped to fetch arbitrary files from a server.
Vulnerability ID: GHSA-8p9r-f949-699g
CWE: CWE-22
Severity score: 7.5
Project: https://github.com/browserless/chrome
Published: 2021-05-10
File: src/routes.ts
Commit message: Ensure workspace files are _in_ the workspace DIR
Commit author: Joel Griffith

Vulnerable version (before fix):
 export const getRoutes = ({       }        const filePath = path.join(workspaceDir, file);        const hasFile = await exists(filePath);        if (!hasFile) {         return res.sendStatus(404);       } export const getRoutes = ({       const filePath = path.join(workspaceDir, file);       const hasFile = await exists(filePath);        if (!hasFile) {         return res.sendStatus(404);       }

Fixed version (after fix):
 export const getRoutes = ({       }        const filePath = path.join(workspaceDir, file);       const hasFile = await exists(filePath);        if (!filePath.includes(workspaceDir)) {         return res.sendStatus(404);       }        if (!hasFile) {         return res.sendStatus(404);       } export const getRoutes = ({       const filePath = path.join(workspaceDir, file);       const hasFile = await exists(filePath);        if (!filePath.includes(workspaceDir)) {         return res.sendStatus(404);       }        if (!hasFile) {         return res.sendStatus(404);       }

Patch:
patch: @@ -157,9 +157,12 @@ export const getRoutes = ({
       }
 
       const filePath = path.join(workspaceDir, file);
-
       const hasFile = await exists(filePath);
 
+      if (!filePath.includes(workspaceDir)) {
+        return res.sendStatus(404);
+      }
+
       if (!hasFile) {
         return res.sendStatus(404);
       }
@@ -185,6 +188,10 @@ export const getRoutes = ({
       const filePath = path.join(workspaceDir, file);
       const hasFile = await exists(filePath);
 
+      if (!filePath.includes(workspaceDir)) {
+        return res.sendStatus(404);
+      }
+
       if (!hasFile) {
         return res.sendStatus(404);
       }
path: src/routes.ts
Vulnerability: Memory leak in Tensorflow ### Impact
If a graph node is invalid, TensorFlow can leak memory in the [implementation of `ImmutableExecutorState::Initialize`](https://github.com/tensorflow/tensorflow/blob/a1320ec1eac186da1d03f033109191f715b2b130/tensorflow/core/common_runtime/immutable_executor_state.cc#L84-L262):

```cc
Status s = params_.create_kernel(n->properties(), &item->kernel);
if (!s.ok()) {
  item->kernel = nullptr;
  s = AttachDef(s, *n);
  return s;           
}                     
```

Here, we set `item->kernel` to `nullptr` but it is a simple `OpKernel*` pointer so the memory that was previously allocated to it would leak.

### Patches
We have patched the issue in GitHub commit [c79ccba517dbb1a0ccb9b01ee3bd2a63748b60dd](https://github.com/tensorflow/tensorflow/commit/c79ccba517dbb1a0ccb9b01ee3bd2a63748b60dd).
The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.

### For more information 
Please consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.
Vulnerability ID: GHSA-8r7c-3cm2-3h8f
CWE: CWE-401
Severity score: 4.3
Project: https://github.com/tensorflow/tensorflow
Published: 2022-02-10
File: tensorflow/core/common_runtime/immutable_executor_state.cc
Commit message: Fix memory leak when a graph node is invalid.

If a graph node is invalid but a kernel is created then we set the kernel back to `nullptr` but we forget to delete it. Hence, we get a memory leak.

PiperOrigin-RevId: 408968108
Change-Id: I1d8a9d0d8988ed5e08be8b9f2004ce1b4cd11b7c
Commit author: Mihai Maruseac

Vulnerable version (before fix):
 Status ImmutableExecutorState::Initialize(const Graph& graph) {      Status s = params_.create_kernel(n->properties(), &item->kernel);     if (!s.ok()) {       item->kernel = nullptr;       s = AttachDef(s, *n);       return s;

Fixed version (after fix):
 Status ImmutableExecutorState::Initialize(const Graph& graph) {      Status s = params_.create_kernel(n->properties(), &item->kernel);     if (!s.ok()) {       params_.delete_kernel(item->kernel);       item->kernel = nullptr;       s = AttachDef(s, *n);       return s;

Patch:
patch: @@ -131,6 +131,7 @@ Status ImmutableExecutorState::Initialize(const Graph& graph) {
 
     Status s = params_.create_kernel(n->properties(), &item->kernel);
     if (!s.ok()) {
+      params_.delete_kernel(item->kernel);
       item->kernel = nullptr;
       s = AttachDef(s, *n);
       return s;
path: tensorflow/core/common_runtime/immutable_executor_state.cc
Vulnerability: Division by zero in TFLite's implementation of hashtable lookup ### Impact
The TFLite implementation of hashtable lookup is [vulnerable to a division by zero error](https://github.com/tensorflow/tensorflow/blob/1a8e885b864c818198a5b2c0cbbeca5a1e833bc8/tensorflow/lite/kernels/hashtable_lookup.cc#L114-L115):

```cc
const int num_rows = SizeOfDimension(value, 0); 
const int row_bytes = value->bytes / num_rows; 
```

An attacker can craft a model such that `values`'s first dimension would be 0.

### Patches
We have patched the issue in GitHub commit [5117e0851348065ed59c991562c0ec80d9193db2](https://github.com/tensorflow/tensorflow/commit/5117e0851348065ed59c991562c0ec80d9193db2).

The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.

### For more information 
Please consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.

### Attribution
This vulnerability has been reported by members of the Aivul Team from Qihoo 360.
Vulnerability ID: GHSA-8rm6-75mf-7r7r
CWE: CWE-369
Severity score: 2.5
Project: https://github.com/tensorflow/tensorflow
Published: 2021-05-21
File: tensorflow/lite/kernels/hashtable_lookup.cc
Commit message: Prevent a division by 0

PiperOrigin-RevId: 371007407
Change-Id: Iecf2718de48d6bf5a69b02a9df9deda8ec1b19d3
Commit author: Mihai Maruseac

Vulnerable version (before fix):
 TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {   TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 2, &value));    const int num_rows = SizeOfDimension(value, 0);   const int row_bytes = value->bytes / num_rows;   void* pointer = nullptr;   DynamicBuffer buf;

Fixed version (after fix):
 TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {   TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 2, &value));    const int num_rows = SizeOfDimension(value, 0);   TF_LITE_ENSURE(context, num_rows != 0);   const int row_bytes = value->bytes / num_rows;   void* pointer = nullptr;   DynamicBuffer buf;

Patch:
patch: @@ -112,6 +112,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
   TF_LITE_ENSURE_OK(context, GetInputSafe(context, node, 2, &value));
 
   const int num_rows = SizeOfDimension(value, 0);
+  TF_LITE_ENSURE(context, num_rows != 0);
   const int row_bytes = value->bytes / num_rows;
   void* pointer = nullptr;
   DynamicBuffer buf;
path: tensorflow/lite/kernels/hashtable_lookup.cc
Vulnerability: Cross-site Scripting in pimcore Pimcore settings module is vulnerable to stored cross site scripting
Vulnerability ID: GHSA-8x44-pwr2-rgc6
CWE: CWE-79
Severity score: 5.4
Project: https://github.com/pimcore/pimcore
Published: 2022-01-28
File: bundles/AdminBundle/Controller/Admin/DataObject/ClassController.php
Commit message: added escape function to the icon field
Commit author: Jia Jia Ji

Vulnerable version (before fix):
 public function getTreeAction(Request $request)                 'id' => $class->getId(),                 'text' => $text,                 'leaf' => true,                 'icon' => $class->getIcon() ? $class->getIcon() : $defaultIcon,                 'cls' => 'pimcore_class_icon',                 'propertyVisibility' => $class->getPropertyVisibility(),                 'enableGridLocking' => $class->isEnableGridLocking(),

Fixed version (after fix):
 public function getTreeAction(Request $request)                 'id' => $class->getId(),                 'text' => $text,                 'leaf' => true,                 'icon' => $class->getIcon() ? htmlspecialchars($class->getIcon()) : $defaultIcon,                 'cls' => 'pimcore_class_icon',                 'propertyVisibility' => $class->getPropertyVisibility(),                 'enableGridLocking' => $class->isEnableGridLocking(),

Patch:
patch: @@ -119,7 +119,7 @@ public function getTreeAction(Request $request)
                 'id' => $class->getId(),
                 'text' => $text,
                 'leaf' => true,
-                'icon' => $class->getIcon() ? $class->getIcon() : $defaultIcon,
+                'icon' => $class->getIcon() ? htmlspecialchars($class->getIcon()) : $defaultIcon,
                 'cls' => 'pimcore_class_icon',
                 'propertyVisibility' => $class->getPropertyVisibility(),
                 'enableGridLocking' => $class->isEnableGridLocking(),
path: bundles/AdminBundle/Controller/Admin/DataObject/ClassController.php
Vulnerability: Cross-Site Scripting in react-svg Versions of `react-svg` before 2.2.18 are vulnerable to cross-site scripting (xss). This is due to the fact that scripts found in SVG files are run by default.


## Recommendation

Update to version 2.2.18 or later.
Vulnerability ID: GHSA-8xqr-4cpm-wx7g
CWE: CWE-79
Severity score: 0
Project: https://github.com/tanem/react-svg
Published: 2019-05-31
File: src/index.js
Commit message: Changed default evalScripts prop to match documentation.
Commit author: Ron Perris

Vulnerable version (before fix):
 export default class ReactSVG extends React.Component {   static defaultProps = {     callback: () => {},     className: null,     evalScripts: 'once',     style: {},     wrapperClassName: null   }

Fixed version (after fix):
 export default class ReactSVG extends React.Component {   static defaultProps = {     callback: () => {},     className: null,     evalScripts: 'never',     style: {},     wrapperClassName: null   }

Patch:
patch: @@ -10,7 +10,7 @@ export default class ReactSVG extends React.Component {
   static defaultProps = {
     callback: () => {},
     className: null,
-    evalScripts: 'once',
+    evalScripts: 'never',
     style: {},
     wrapperClassName: null
   }
path: src/index.js
Vulnerability: Path Traversal in jsreport-chrome-pdf This affects the package jsreport-chrome-pdf before 1.10.0.
Vulnerability ID: GHSA-934w-hvj4-7fr6
CWE: CWE-22
Severity score: 6.5
Project: https://github.com/jsreport/jsreport-chrome-pdf
Published: 2021-04-13
File: lib/conversion.js
Commit message: block file requests
Commit author: BJR Matos

Vulnerable version (before fix):
 module.exports = async ({ reporter, getBrowser, htmlUrl, strategy, timeout, req,       return     }      page.on('pageerror', (err) => {       pageLog('warn', `Page error: ${err.message}${err.stack ? ` , stack: ${err.stack}` : ''}`)     }) module.exports = async ({ reporter, getBrowser, htmlUrl, strategy, timeout, req,       }        pageLog('debug', `Page request: ${r.method()} (${r.resourceType()}) ${trimUrl(r.url())}${detail}`)     })      page.on('requestfinished', (r) => {

Fixed version (after fix):
 module.exports = async ({ reporter, getBrowser, htmlUrl, strategy, timeout, req,       return     }      await page.setRequestInterception(true)      if (executionInfo.error) {       return     }      page.on('pageerror', (err) => {       pageLog('warn', `Page error: ${err.message}${err.stack ? ` , stack: ${err.stack}` : ''}`)     }) module.exports = async ({ reporter, getBrowser, htmlUrl, strategy, timeout, req,       }        pageLog('debug', `Page request: ${r.method()} (${r.resourceType()}) ${trimUrl(r.url())}${detail}`)        const isRelativeToHtmlUrl = r.url().lastIndexOf(htmlUrl, 0) === 0        if (         !isRelativeToHtmlUrl &&         // potentially dangerous request to local file         r.url().lastIndexOf('file:///', 0) === 0       ) {         r.abort('accessdenied')         return       }        r.continue()     })      page.on('requestfinished', (r) => {

Patch:
patch: @@ -38,6 +38,12 @@ module.exports = async ({ reporter, getBrowser, htmlUrl, strategy, timeout, req,
       return
     }
 
+    await page.setRequestInterception(true)
+
+    if (executionInfo.error) {
+      return
+    }
+
     page.on('pageerror', (err) => {
       pageLog('warn', `Page error: ${err.message}${err.stack ? ` , stack: ${err.stack}` : ''}`)
     })
@@ -64,6 +70,19 @@ module.exports = async ({ reporter, getBrowser, htmlUrl, strategy, timeout, req,
       }
 
       pageLog('debug', `Page request: ${r.method()} (${r.resourceType()}) ${trimUrl(r.url())}${detail}`)
+
+      const isRelativeToHtmlUrl = r.url().lastIndexOf(htmlUrl, 0) === 0
+
+      if (
+        !isRelativeToHtmlUrl &&
+        // potentially dangerous request to local file
+        r.url().lastIndexOf('file:///', 0) === 0
+      ) {
+        r.abort('accessdenied')
+        return
+      }
+
+      r.continue()
     })
 
     page.on('requestfinished', (r) => {
path: lib/conversion.js
Vulnerability: Command injection via Celery broker in Apache Airflow An issue was found in Apache Airflow versions 1.10.10 and below. When using CeleryExecutor, if an attacker can connect to the broker (Redis, RabbitMQ) directly, it is possible to inject commands, resulting in the celery worker running arbitrary commands.
Vulnerability ID: GHSA-976r-qfjj-c24w
CWE: CWE-78
Severity score: 9.8
Project: https://github.com/apache/airflow
Published: 2020-07-27
File: airflow/www_rbac/views.py
Commit message: [AIRFLOW-6351] security - ui - Add Cross Site Scripting defence (#6913)
Commit author: tooptoop4

Vulnerable version (before fix):
 def get_int_arg(value, default=0):             num_dag_to=min(end, num_of_all_dags),             num_of_all_dags=num_of_all_dags,             paging=wwwutils.generate_pages(current_page, num_of_pages,                                            search=arg_search_query,                                            showPaused=not hide_paused),             num_runs=num_runs,             tags=tags)

Fixed version (after fix):
 def get_int_arg(value, default=0):             num_dag_to=min(end, num_of_all_dags),             num_of_all_dags=num_of_all_dags,             paging=wwwutils.generate_pages(current_page, num_of_pages,                                            search=escape(arg_search_query) if arg_search_query else None,                                            showPaused=not hide_paused),             num_runs=num_runs,             tags=tags)

Patch:
patch: @@ -321,7 +321,7 @@ def get_int_arg(value, default=0):
             num_dag_to=min(end, num_of_all_dags),
             num_of_all_dags=num_of_all_dags,
             paging=wwwutils.generate_pages(current_page, num_of_pages,
-                                           search=arg_search_query,
+                                           search=escape(arg_search_query) if arg_search_query else None,
                                            showPaused=not hide_paused),
             num_runs=num_runs,
             tags=tags)
path: airflow/www_rbac/views.py
Vulnerability: Denial of Service and Content Injection in i18n-node-angular Versions of `i18n-node-angular` prior to 1.4.0 are affected by denial of service and cross-site scripting vulnerabilities. The vulnerabilities exist in a REST endpoint that was created for development purposes, but was not disabled in production in affected versions.


## Recommendation

Update to version 1.4.0 or later.
Vulnerability ID: GHSA-97gv-3p2c-xw7j
CWE: CWE-400
Severity score: 8.2
Project: https://github.com/oliversalzburg/i18n-node-angular
Published: 2019-02-18
File: i18n-node-routes.js
Commit message: [FIX] Only register translate route during development
Commit author: Oliver Salzburg

Vulnerable version (before fix):
 var configure = function( app, configObject ) {  	// Register routes 	app.get( "/i18n/:locale", i18nRoutes.i18n ); 	app.get( "/i18n/:locale/:phrase", i18nRoutes.translate ); };  /**

Fixed version (after fix):
 var configure = function( app, configObject ) {  	// Register routes 	app.get( "/i18n/:locale", i18nRoutes.i18n );  	if( process.env.NODE_ENV === "development" ) { 		app.get( "/i18n/:locale/:phrase", i18nRoutes.translate ); 	} };  /**

Patch:
patch: @@ -49,7 +49,10 @@ var configure = function( app, configObject ) {
 
 	// Register routes
 	app.get( "/i18n/:locale", i18nRoutes.i18n );
-	app.get( "/i18n/:locale/:phrase", i18nRoutes.translate );
+
+	if( process.env.NODE_ENV === "development" ) {
+		app.get( "/i18n/:locale/:phrase", i18nRoutes.translate );
+	}
 };
 
 /**
path: i18n-node-routes.js
Vulnerability: Division by zero in TFLite's implementation of Split ### Impact
The implementation of the `Split` TFLite operator is [vulnerable to a division by zero error](https://github.com/tensorflow/tensorflow/blob/e2752089ef7ce9bcf3db0ec618ebd23ea119d0c7/tensorflow/lite/kernels/split.cc#L63-L65):

```cc
TF_LITE_ENSURE_MSG(context, input_size % num_splits == 0, "Not an even split");
const int slice_size = input_size / num_splits;
```

An attacker can craft a model such that `num_splits` would be 0.

### Patches
We have patched the issue in GitHub commit [b22786e7e9b7bdb6a56936ff29cc7e9968d7bc1d](https://github.com/tensorflow/tensorflow/commit/b22786e7e9b7bdb6a56936ff29cc7e9968d7bc1d).

The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.

### For more information
Please consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.

### Attribution
This vulnerability has been reported by members of the Aivul Team from Qihoo 360.
Vulnerability ID: GHSA-97wf-p777-86jq
CWE: CWE-369
Severity score: 2.5
Project: https://github.com/tensorflow/tensorflow
Published: 2021-05-21
File: tensorflow/lite/kernels/split.cc
Commit message: Prevent division by 0

PiperOrigin-RevId: 370998952
Change-Id: I6b1d49079624ee1447d2d9b53a8976fb356cc8f5
Commit author: Mihai Maruseac

Vulnerable version (before fix):
 TfLiteStatus ResizeOutputTensors(TfLiteContext* context, TfLiteNode* node,   TF_LITE_ENSURE(context, axis_value < NumDimensions(input));    const int input_size = SizeOfDimension(input, axis_value);   TF_LITE_ENSURE_MSG(context, input_size % num_splits == 0,                      "Not an even split");   const int slice_size = input_size / num_splits;

Fixed version (after fix):
 TfLiteStatus ResizeOutputTensors(TfLiteContext* context, TfLiteNode* node,   TF_LITE_ENSURE(context, axis_value < NumDimensions(input));    const int input_size = SizeOfDimension(input, axis_value);   TF_LITE_ENSURE(context, num_splits != 0);   TF_LITE_ENSURE_MSG(context, input_size % num_splits == 0,                      "Not an even split");   const int slice_size = input_size / num_splits;

Patch:
patch: @@ -60,6 +60,7 @@ TfLiteStatus ResizeOutputTensors(TfLiteContext* context, TfLiteNode* node,
   TF_LITE_ENSURE(context, axis_value < NumDimensions(input));
 
   const int input_size = SizeOfDimension(input, axis_value);
+  TF_LITE_ENSURE(context, num_splits != 0);
   TF_LITE_ENSURE_MSG(context, input_size % num_splits == 0,
                      "Not an even split");
   const int slice_size = input_size / num_splits;
path: tensorflow/lite/kernels/split.cc