mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-10-19 14:33:17 +00:00
Write behaviors downloaded from URL to tempdir (#816)
Follow-up to #368 This makes download locations consistent between custom behaviors downloaded from URLs and those downloaded from Git repos, and resolves a container security issue in Browsertrix.
This commit is contained in:
parent
28241c824e
commit
2961d3b9f2
2 changed files with 4 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "browsertrix-crawler",
|
"name": "browsertrix-crawler",
|
||||||
"version": "1.5.10",
|
"version": "1.5.11",
|
||||||
"main": "browsertrix-crawler",
|
"main": "browsertrix-crawler",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": "https://github.com/webrecorder/browsertrix-crawler",
|
"repository": "https://github.com/webrecorder/browsertrix-crawler",
|
||||||
|
|
|
@ -83,7 +83,9 @@ async function collectGitBehaviors(gitUrl: string): Promise<FileSources> {
|
||||||
|
|
||||||
async function collectOnlineBehavior(url: string): Promise<FileSources> {
|
async function collectOnlineBehavior(url: string): Promise<FileSources> {
|
||||||
const filename = crypto.randomBytes(4).toString("hex") + ".js";
|
const filename = crypto.randomBytes(4).toString("hex") + ".js";
|
||||||
const behaviorFilepath = `/app/behaviors/${filename}`;
|
const tmpDir = `/tmp/behaviors-${crypto.randomBytes(4).toString("hex")}`;
|
||||||
|
await fsp.mkdir(tmpDir, { recursive: true });
|
||||||
|
const behaviorFilepath = path.join(tmpDir, filename);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(url, { dispatcher: getProxyDispatcher() });
|
const res = await fetch(url, { dispatcher: getProxyDispatcher() });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue