opencode-api-security-testing 5.4.7 → 5.4.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.
- package/core/collectors/__pycache__/__init__.cpython-314.pyc +0 -0
- package/core/collectors/__pycache__/api_path_finder.cpython-314.pyc +0 -0
- package/core/collectors/__pycache__/browser_collector.cpython-314.pyc +0 -0
- package/core/collectors/__pycache__/js_collector.cpython-314.pyc +0 -0
- package/core/collectors/__pycache__/url_collector.cpython-314.pyc +0 -0
- package/package.json +1 -1
- package/postinstall.mjs +17 -5
- package/src/index.ts +4 -24
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
package/postinstall.mjs
CHANGED
|
@@ -145,13 +145,25 @@ function installPlaywright(pythonCmd) {
|
|
|
145
145
|
const pipCmd = checkPip(pythonCmd);
|
|
146
146
|
if (!pipCmd) return { success: false, error: "pip not found" };
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
// 安装 Playwright 包(增加超时时间)
|
|
149
|
+
const pkgResult = runCommand(`${pipCmd} install playwright`, 180000);
|
|
150
|
+
if (!pkgResult.success) {
|
|
151
|
+
console.log(` ⚠ Failed to install playwright package: ${pkgResult.error}`);
|
|
152
|
+
return { success: false, error: pkgResult.error };
|
|
153
|
+
}
|
|
154
|
+
console.log(" ✓ Playwright package installed");
|
|
150
155
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
// 安装浏览器(增加超时时间到 10 分钟)
|
|
157
|
+
console.log(" Installing Playwright browsers (chromium) - this may take several minutes...");
|
|
158
|
+
const browserResult = runCommand(`${pythonCmd} -m playwright install chromium`, 600000);
|
|
159
|
+
if (browserResult.success) {
|
|
160
|
+
console.log(" ✓ Playwright browsers installed");
|
|
161
|
+
return { success: true, error: "" };
|
|
162
|
+
}
|
|
154
163
|
|
|
164
|
+
console.log(` ⚠ Browser installation failed: ${browserResult.error}`);
|
|
165
|
+
console.log(" → browser_collect tool will have limited functionality");
|
|
166
|
+
console.log(` → Manual fix: ${pythonCmd} -m playwright install chromium`);
|
|
155
167
|
return { success: false, error: browserResult.error };
|
|
156
168
|
}
|
|
157
169
|
|
package/src/index.ts
CHANGED
|
@@ -733,13 +733,15 @@ print(result)
|
|
|
733
733
|
const deps = checkDeps(ctx);
|
|
734
734
|
const corePath = getCorePath(ctx);
|
|
735
735
|
const collectionMode = args.mode || config.collection_mode;
|
|
736
|
+
// 使用 JSON 格式传递参数,避免字符串转义问题
|
|
737
|
+
const paramsJson = JSON.stringify({ mode: collectionMode });
|
|
736
738
|
const cmd = `${deps}python3 -c "
|
|
737
739
|
import sys
|
|
740
|
+
import json
|
|
738
741
|
sys.path.insert(0, '${corePath}')
|
|
739
742
|
from collectors.browser_collector import BrowserCollectorFacade
|
|
740
743
|
facade = BrowserCollectorFacade(headless=True)
|
|
741
|
-
result = facade.collect_all('${args.url}',
|
|
742
|
-
import json
|
|
744
|
+
result = facade.collect_all('${args.url}', ${paramsJson})
|
|
743
745
|
print(json.dumps(result, indent=2))
|
|
744
746
|
"`;
|
|
745
747
|
return await execShell(ctx, cmd);
|
|
@@ -1606,28 +1608,6 @@ ${LEVEL_PROMPTS[level]}
|
|
|
1606
1608
|
console.log(`[api-security-testing] Injected context via synthetic part, session=${sessionID}, length=${pending.merged.length}`);
|
|
1607
1609
|
},
|
|
1608
1610
|
};
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
// 会话删除或压缩 - 清理状态
|
|
1613
|
-
if (event.type === "session.deleted" || event.type === "session.compacted") {
|
|
1614
|
-
const props = event.properties as Record<string, unknown> | undefined;
|
|
1615
|
-
let sessionID: string | undefined;
|
|
1616
|
-
|
|
1617
|
-
if (event.type === "session.deleted") {
|
|
1618
|
-
sessionID = (props?.info as { id?: string })?.id;
|
|
1619
|
-
} else {
|
|
1620
|
-
sessionID = (props?.sessionID ?? (props?.info as { id?: string })?.id) as string | undefined;
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
if (sessionID) {
|
|
1624
|
-
clearSessionState(sessionID);
|
|
1625
|
-
resetFailureCount(sessionID);
|
|
1626
|
-
resetModelFailures(sessionID);
|
|
1627
|
-
}
|
|
1628
|
-
}
|
|
1629
|
-
},
|
|
1630
|
-
};
|
|
1631
1611
|
};
|
|
1632
1612
|
|
|
1633
1613
|
export default ApiSecurityTestingPlugin;
|