feat: implement MoloApp plans 01-15 with integration
Full C++23 framework tree: runtime, observability, security, data, app, realtime, supervisor, clients, CLI, example plus enterprise tenancy, audit, operability, governance, supplychain. Postgres via docker compose for tests.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// Route: POST /uploads/file
|
||||
#include "support/Assert.hpp"
|
||||
|
||||
using namespace molo::example::test;
|
||||
using molo::example::fw::Method;
|
||||
|
||||
int main() {
|
||||
Fixture f;
|
||||
auto ok = f.client->post("/uploads/file?filename=note.txt", "hello",
|
||||
"text/plain");
|
||||
check(ok.status == 201, "allowed upload is 201");
|
||||
check(contains(ok.body, "\"size\":5"), "size reported");
|
||||
auto evil = f.client->request(Method::Post,
|
||||
"/uploads/file?filename=x.bin", "data",
|
||||
{{"Content-Type", "application/x-evil"}});
|
||||
check(evil.status == 415, "blocked content type is 415");
|
||||
auto traversal = f.client->post("/uploads/file?filename=../x.txt", "d",
|
||||
"text/plain");
|
||||
check(traversal.status == 400, "unsafe filename is 400");
|
||||
check(f.services.uploads->list().size() == 1,
|
||||
"side effect: one upload stored");
|
||||
return finish("uploads/file");
|
||||
}
|
||||
Reference in New Issue
Block a user