Skip to content

Commit 0002801

Browse files
authored
judge: add message to inform sandbox upgrade (#1111)
1 parent 4dda4fe commit 0002801

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/hydrojudge/src/sandbox.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ export async function versionCheck(reportWarn: (str: string) => void, reportErro
219219
let sandboxVersion: string;
220220
let sandboxCgroup: number;
221221
let sandboxCgroupControllers: string[] | null;
222+
let fixSymlinkEscape: boolean;
222223
try {
223224
const version = await client.version();
224225
sandboxVersion = version.buildVersion.split('v')[1];
225226
const config = await client.config();
226227
sandboxCgroup = config.runnerConfig?.cgroupType || 0;
227228
sandboxCgroupControllers = config.runnerConfig?.cgroupControllers || null;
229+
fixSymlinkEscape = config.fixSymlinkEscape ?? false;
228230
} catch (e) {
229231
if (e?.code === 'ECONNREFUSED') reportError('Failed to connect to sandbox, please check sandbox_host config and if your sandbox is running.');
230232
else reportError('Your sandbox version is tooooooo low! Please upgrade!');
@@ -242,6 +244,9 @@ export async function versionCheck(reportWarn: (str: string) => void, reportErro
242244
reportWarn('The memory cgroup controller is not enabled. This could result in inaccurate memory usage measurements.');
243245
}
244246
}
247+
if (!fixSymlinkEscape) {
248+
reportError('Your sandbox version is vulnerable to symlink escape issue, please upgrade!');
249+
}
245250
return true;
246251
}
247252

0 commit comments

Comments
 (0)