add JSON and crypto APIs with sandbox protection (milestone 6 complete)

This commit is contained in:
2026-01-18 14:44:51 +01:00
parent a4ecb0f132
commit be663282d7
8 changed files with 1469 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
#pragma once
#include <string>
#include <cstddef>
struct lua_State;
namespace mosis {
// Configuration limits for JSON operations
struct JsonLimits {
int max_depth = 32; // Maximum nesting depth
size_t max_string_length = 1 * 1024 * 1024; // 1 MB per string
size_t max_output_size = 10 * 1024 * 1024; // 10 MB total output
size_t max_array_size = 100000; // Max elements in array
size_t max_object_size = 10000; // Max keys in object
};
// Register json.encode() and json.decode() as globals
void RegisterJsonAPI(lua_State* L, const JsonLimits& limits = JsonLimits{});
} // namespace mosis