feat(workflow): example covers security, platform, enterprise and resilience features

105 route tests, matrix crawl, spec and README updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 02:19:52 +02:00
co-authored by Claude Sonnet 5.5
parent 00af65613d
commit 62fdd08da8
90 changed files with 8038 additions and 11 deletions
+21
View File
@@ -0,0 +1,21 @@
// Route: GET/POST /audit/log (hash-chained log page and append form)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto page = f.client->get("/audit/log");
check(page.status == 200 && contains(page.headers.get("Content-Type"), "text/html"), "html page");
check(contains(page.body, "Chain intact"), "intact");
auto js = f.client->request(Method::Get, "/audit/log", "", {{"Accept", "application/json"}});
check(contains(js.body, "\"records\""), "json variant");
auto bad = f.client->post("/audit/log", "actor=&action=x&subject=y", "application/x-www-form-urlencoded");
check(bad.status == 422 && contains(bad.body, "field-error"), "inline validation");
auto ok = f.client->post("/audit/log", "actor=ada&action=edit&subject=doc&detail=mail+me%40example.com", "application/x-www-form-urlencoded");
check(ok.status == 201 && contains(ok.body, "appended"), "appended");
auto after = f.client->request(Method::Get, "/audit/log", "", {{"Accept", "application/json"}});
check(contains(after.body, "[EMAIL]") && !contains(after.body, "me@example.com"), "side effect: PII redacted in record");
return finish("audit/log");
}
+18
View File
@@ -0,0 +1,18 @@
// Route: GET /audit/mask (masking and redaction patterns)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto d = f.client->get("/audit/mask");
check(d.status == 200 && contains(d.body, "a***********@example.com"), "email masked");
check(contains(d.body, "************1111"), "card keeps last 4");
check(contains(d.body, "[EMAIL]") && contains(d.body, "[SSN]") && contains(d.body, "[IP]"), "redactions");
check(contains(d.body, "\"redactions\":4"), "counted 4 hits");
auto c = f.client->get("/audit/mask?text=nothing+here");
check(contains(c.body, "\"redactions\":0"), "clean text unchanged");
check(f.client->post("/audit/mask").status == 405, "405");
return finish("audit/mask");
}
+23
View File
@@ -0,0 +1,23 @@
// Route: GET /audit/retention + hold + purge (policy, legal hold, dry run)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto page = f.client->get("/audit/retention");
check(page.status == 200 && contains(page.body, "expired"), "html page");
auto js = f.client->request(Method::Get, "/audit/retention", "", {{"Accept", "application/json"}});
check(contains(js.body, "\"r1\"") && contains(js.body, "\"r5\""), "expired listed");
auto dry = f.client->post("/audit/retention/purge", "");
check(contains(dry.body, "\"dry_run\":true") && contains(dry.body, "\"purged\":0"), "dry run by default");
check(f.client->post("/audit/retention/hold", "id=r1&hold=true").status == 200, "hold");
auto real = f.client->post("/audit/retention/purge", "confirm=yes");
check(contains(real.body, "\"purged\":2"), "held entry skipped, two purged");
auto after = f.client->request(Method::Get, "/audit/retention", "", {{"Accept", "application/json"}});
check(contains(after.body, "\"r1\"") && !contains(after.body, "\"id\":\"r5\""), "side effect: r1 kept, r5 gone");
check(f.client->post("/audit/retention/hold", "id=r1&hold=x").status == 422, "bad hold");
check(f.client->post("/audit/retention/hold", "id=zz&hold=true").status == 404, "unknown id");
return finish("audit/retention");
}
+21
View File
@@ -0,0 +1,21 @@
// Route: GET /audit/subject, export, POST erase (data subject rights)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto page = f.client->get("/audit/subject");
check(page.status == 200 && contains(page.headers.get("Content-Type"), "text/html"), "form page");
auto ex = f.client->get("/audit/subject/export?subject=ada@example.com");
check(ex.status == 200 && contains(ex.body, "order=1001") && contains(ex.body, "profiles"), "export across tables");
check(f.client->get("/audit/subject/export").status == 400, "missing subject");
auto bad = f.client->post("/audit/subject/erase", "subject=nope&confirm=no", "application/x-www-form-urlencoded");
check(bad.status == 422 && contains(bad.body, "field-error"), "inline errors");
auto ok = f.client->post("/audit/subject/erase", "subject=ada%40example.com&confirm=yes", "application/x-www-form-urlencoded");
check(ok.status == 200 && contains(ok.body, "4 rows erased"), "cascade erased 4 rows");
check(!contains(f.client->get("/audit/subject/export?subject=ada@example.com").body, "order="), "side effect: data gone");
check(contains(f.client->get("/audit/verify").body, "\"intact\":true"), "erasure audited, chain intact");
return finish("audit/subject");
}
+18
View File
@@ -0,0 +1,18 @@
// Route: GET /audit/verify + POST /audit/tamper (tamper detection)
#include "support/Assert.hpp"
using namespace molo::example::test;
using molo::example::fw::Method;
int main() {
Fixture f;
auto v = f.client->get("/audit/verify");
check(v.status == 200 && contains(v.body, "\"intact\":true") && contains(v.body, "\"first_broken\":null"), "intact");
check(f.client->post("/audit/tamper", "index=abc").status == 422, "bad index");
check(f.client->post("/audit/tamper", "index=99").status == 404, "missing record");
check(f.client->post("/audit/tamper", "index=1").status == 200, "tamper");
auto b = f.client->get("/audit/verify");
check(contains(b.body, "\"intact\":false") && contains(b.body, "\"first_broken\":1"), "first broken index reported");
check(contains(f.client->get("/audit/log").body, "Chain broken at index 1"), "side effect: page shows break");
return finish("audit/verify");
}