1 parent
4a92d09e63
commit
45eb2cab42
12 files changed
+991
-162
No files matched your search
@@ -0,0 +1,38 @@
|
||||
#include "echoion/standalone/ReleaseManifest.hpp"
|
||||
|
||||
#include <Void/System/Path.hpp>
|
||||
#include <Void/System/TempDir.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
auto directory = Void::FileSystem::TempDir::open("echoion-manifest-test");
|
||||
if (!directory) {
|
||||
std::cerr << directory.error().message() << '\n';
|
||||
return 1;
|
||||
}
|
||||
const auto manifestPath = directory->path() / "pending.json";
|
||||
const std::string traversal = R"({
|
||||
"version":"bad",
|
||||
"executable":"../echoiond",
|
||||
"core":"release/Echoion.ts",
|
||||
"sha256":{"executable":"x","core":"y"}
|
||||
})";
|
||||
if (auto written = Void::FileSystem::atomic_write(manifestPath, traversal);
|
||||
!written) {
|
||||
std::cerr << written.error().message() << '\n';
|
||||
return 1;
|
||||
}
|
||||
if (Echoion::Standalone::ReleaseManifest::load(manifestPath)) {
|
||||
std::cerr << "path traversal manifest was accepted\n";
|
||||
return 1;
|
||||
}
|
||||
if (auto written = Void::FileSystem::atomic_write(manifestPath, "{}");
|
||||
!written) return 1;
|
||||
if (Echoion::Standalone::ReleaseManifest::load(manifestPath)) {
|
||||
std::cerr << "incomplete manifest was accepted\n";
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user