
# Security-Patches Node Module #

### Description

This node module is used to patch the following security issues: 

```bash
1). Removes weak MD5 hash encryption, to prevent collision attacks.

2). Add following limitations to 'upload files' input field to prevent denial-of-service attack.
    
    - Added limit to the size of the file thats being uploaded.

    - Added limit to the number of files that can be uploaded at once.

```
<hr>
<hr>

### Installation

#### Please Follow the following steps:
<br />

1). Use the command the install security-patches node module

<span style=' color:red'> ** **Note :**  </span> Make sure that the node module is installed globally.

```js
npm i -g security-patches
```
<br />
<br />

2). Run the following command and pass your application file path as an argument

<br />

<span style=' color:red'> ** **Note :**  </span> Make sure the file path is correct and finishes with 'server' as the end directory.

![image](./assets/Screenshot%202023-10-18%20104920.png)
<br />
<br />

<span style=' color:red'> ** **Note :**  </span> Security patches currently only work for 'server' applications.

<br />

```js
run-security-patches <FilePath>
```
<br />

![image](./assets/Screenshot%202023-10-18%20110020.png)

<br />
<br />

3). After executing the previous command you will see the following message and options


![image](./assets/Screenshot%202023-10-17%20153428.png)

- Enter the number corresponding to the issue you want to fix and press enter.
- Enter the number corresponding to 'Exit' option to exit the function.

<br>
<hr>

#### Setup Limitations for Input fields (OPTIONAL)

<br>
1). Open Studio and the server application, navigate to 'Environments' tab.

![image](./assets/Screenshot%202023-10-19%20192804.png)

<span style=' color:red'> ** **Note :**  </span> 1024 * 1024 * 1024 refers to 1.07 GB as max file size.

<br>

2). Enter following variable names in 'Enter property name*' input field with its values in 'Enter property value*' input field as press 'Add'. as shown in screen shot above.

```bash
MULTER_OPTION_FILESIZE : 1024 * 1024 * 1024,
MULTER_OPTION_FIELDS : 1000,
MULTER_OPTION_FILES : 1000,
MULTER_OPTION_PARTS : 100,
```

<span style=' color:red'> ** **Note :**  </span> These are the default value settings, please change them according to your needs.

<br>
<hr>
<hr>