mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-16 07:24:53 +09:00
Fix path traversal on mod upload
Fix possibility of a maliciously crafted mod being written outside of the mods directory and thus possibily overwriting unrelated files.
This commit is contained in:
1 parent
94cb607930
commit
1095d2466d
4 files changed
+27
-2
No files matched your search
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "../bad_path_mod",
|
||||
"version": "1.0.0",
|
||||
"title": "Path Traversing Mod",
|
||||
"author": "Me",
|
||||
"description": "A mod who's name traverses the filesystem",
|
||||
"factorio_version": "1.1",
|
||||
"dependencies": []
|
||||
}
|
||||
@@ -934,6 +934,21 @@ describe("Integration of Clusterio", function() {
|
||||
"mod not present in mods directory"
|
||||
);
|
||||
});
|
||||
it("rejects path traversing mods", async function() {
|
||||
await libBuildMod.build({
|
||||
build: true,
|
||||
pack: true,
|
||||
sourceDir: path.join("test", "file", "path_traversing_mod"),
|
||||
outputDir: path.join("temp", "test"),
|
||||
modName: "path_traversing_mod_1.0.0",
|
||||
});
|
||||
await fs.remove(path.join("temp", "test", "bad_path_mod_1.0.0.zip"));
|
||||
await assert.rejects(execCtl("mod upload path_traversing_mod_1.0.0.zip"));
|
||||
assert(
|
||||
!await fs.pathExists(path.join("temp", "test", "bad_path_mod_1.0.0.zip")),
|
||||
"mod executed a path traversal attack",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("mod show", function() {
|
||||
|
||||
Reference in new issue
Block a user