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:
@@ -0,0 +1,20 @@
|
||||
// Route: /security/guard (SqlSafety and PathGuard rejection)
|
||||
#include "support/Assert.hpp"
|
||||
using namespace molo::example::test;
|
||||
static const char* kForm = "application/x-www-form-urlencoded";
|
||||
int main() {
|
||||
Fixture f;
|
||||
check(contains(f.client->get("/security/guard").body, "<form"), "form renders");
|
||||
auto ok = f.client->post("/security/guard", "kind=sql&value=ada", kForm);
|
||||
check(ok.status == 200 && contains(ok.body, "safe for sql"), "safe sql value");
|
||||
auto sql = f.client->post("/security/guard", "kind=sql&value=x%27+OR+1%3D1+--", kForm);
|
||||
check(sql.status == 422 && contains(sql.body, "form-errors"), "sql injection inline 422");
|
||||
auto path = f.client->post("/security/guard", "kind=path&value=..%2F..%2Fetc%2Fpasswd", kForm);
|
||||
check(path.status == 422 && contains(path.body, "traversal"), "traversal rejected");
|
||||
auto abs = f.client->post("/security/guard", "kind=path&value=%2Fetc%2Fpasswd", kForm);
|
||||
check(abs.status == 422 && contains(abs.body, "absolute"), "absolute rejected");
|
||||
check(f.client->post("/security/guard", "kind=x&value=a", kForm).status == 422, "bad kind 422");
|
||||
check(f.client->post("/security/guard", "kind=sql&value=" + std::string(513, 'a'), kForm).status == 422, "over cap 422");
|
||||
check(contains(f.client->get("/security/denials").body, "PathGuard"), "side effect: denial recorded");
|
||||
return finish("security/guard");
|
||||
}
|
||||
Reference in New Issue
Block a user