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,18 @@
|
||||
// Route: /crypto/password (salted PBKDF2, demo rounds)
|
||||
#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("/crypto/password").body, "DEMO"), "labelled demo");
|
||||
auto a = f.client->post("/crypto/password", "password=correct-horse", kForm);
|
||||
auto b = f.client->post("/crypto/password", "password=correct-horse", kForm);
|
||||
check(a.status == 200 && contains(a.body, "pbkdf2-demo$2000$"), "hash format");
|
||||
check(contains(a.body, "verify ok: yes") && contains(a.body, "wrong password: rejected"), "verify works");
|
||||
auto salt = [](const std::string& s) { std::size_t p = s.find("pbkdf2-demo$2000$"); return s.substr(p + 17, 32); };
|
||||
check(salt(a.body) != salt(b.body), "salt differs per hash");
|
||||
auto bad = f.client->post("/crypto/password", "password=short", kForm);
|
||||
check(bad.status == 422 && contains(bad.body, "must be 8 to 128"), "short password inline 422");
|
||||
check(f.client->post("/crypto/password", "password=" + std::string(129, 'a'), kForm).status == 422, "over cap 422");
|
||||
return finish("crypto/password");
|
||||
}
|
||||
Reference in New Issue
Block a user