nothumanallowed 13.5.68 → 13.5.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/ui.mjs +41 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "13.5.
|
|
3
|
+
"version": "13.5.70",
|
|
4
4
|
"description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/commands/ui.mjs
CHANGED
|
@@ -4274,6 +4274,21 @@ module.exports = { get, set, del, exists };
|
|
|
4274
4274
|
fs.mkdirSync(path.join(sandboxDir, 'server', 'services'), { recursive: true });
|
|
4275
4275
|
fs.writeFileSync(path.join(sandboxDir, 'server', 'services', 'cache.js'), cacheShim, 'utf8');
|
|
4276
4276
|
|
|
4277
|
+
// Validators shim — LLM often generates require('../utils/validators') with helpers that don't exist
|
|
4278
|
+
const validatorsShim = `
|
|
4279
|
+
// NHA WebCraft Sandbox — utils/validators shim
|
|
4280
|
+
function validateEmail(email) { return typeof email === 'string' && /^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(email.trim()); }
|
|
4281
|
+
function sanitizeText(str) { return typeof str === 'string' ? str.replace(/<[^>]*>/g, '').trim() : ''; }
|
|
4282
|
+
function validatePassword(pwd) { return typeof pwd === 'string' && pwd.length >= 8; }
|
|
4283
|
+
function validateUsername(u) { return typeof u === 'string' && u.length >= 2 && u.length <= 50; }
|
|
4284
|
+
function validatePhone(p) { return typeof p === 'string' && /^[+]?[\\d\\s\\-().]{7,20}$/.test(p.trim()); }
|
|
4285
|
+
module.exports = { validateEmail, sanitizeText, validatePassword, validateUsername, validatePhone };
|
|
4286
|
+
`;
|
|
4287
|
+
fs.mkdirSync(path.join(sandboxDir, 'server', 'utils'), { recursive: true });
|
|
4288
|
+
if (!fs.existsSync(path.join(sandboxDir, 'server', 'utils', 'validators.js'))) {
|
|
4289
|
+
fs.writeFileSync(path.join(sandboxDir, 'server', 'utils', 'validators.js'), validatorsShim, 'utf8');
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4277
4292
|
// Patch all generated JS files: fix known wrong require() names
|
|
4278
4293
|
// The LLM often uses 'bcrypt' instead of 'bcryptjs', 'pg' instead of nothing, etc.
|
|
4279
4294
|
const requireFixes = [
|
|
@@ -4293,6 +4308,8 @@ module.exports = { get, set, del, exists };
|
|
|
4293
4308
|
[/require\(['"]winston['"]\)/g, "{createLogger:()=>({info:()=>{},error:()=>{},warn:()=>{}}),transports:{Console:function(){}},format:{combine:()=>{},timestamp:()=>{},json:()=>{}}}"],
|
|
4294
4309
|
[/require\(['"]morgan['"]\)/g, "(()=>(r,s,n)=>n())"],
|
|
4295
4310
|
[/require\(['"]compression['"]\)/g, "(()=>(r,s,n)=>n())"],
|
|
4311
|
+
[/require\(['"]express-validator['"]\)/g, "{body:()=>({isEmail:()=>({normalizeEmail:()=>({run:async()=>{}})}),isLength:()=>({run:async()=>{}}),trim:()=>({escape:()=>({run:async()=>{}})}),notEmpty:()=>({run:async()=>{}})}),validationResult:()=>({isEmpty:()=>true,array:()=>[]})}"],
|
|
4312
|
+
[/require\(['"]validator['"]\)/g, "{isEmail:(s)=>/^[^@\\s]+@[^@\\s]+[.][^@\\s]+$/.test(s),escape:(s)=>String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'),trim:(s)=>String(s).trim(),isEmpty:(s)=>!s||!String(s).trim(),isLength:(s,o)=>{ var l=String(s).length; return (!o.min||l>=o.min)&&(!o.max||l<=o.max); }}"],
|
|
4296
4313
|
[/require\(['"]cookie-parser['"]\)/g, "(()=>(r,s,n)=>{r.cookies=r.cookies||{};n()})"],
|
|
4297
4314
|
[/require\(['"]passport['"]\)/g, "{initialize:()=>(r,s,n)=>n(),session:()=>(r,s,n)=>n(),authenticate:()=>(r,s,n)=>n&&n()}"],
|
|
4298
4315
|
[/require\(['"]express-session['"]\)/g, "(()=>(r,s,n)=>{r.session=r.session||{};n()})"],
|
|
@@ -4313,6 +4330,14 @@ module.exports = { get, set, del, exists };
|
|
|
4313
4330
|
[/require\(['"]\.\.\/\.\.\/config['"]\)/g, "{env:process.env}"],
|
|
4314
4331
|
[/require\(['"]\.\.\/config['"]\)/g, "{env:process.env}"],
|
|
4315
4332
|
[/require\(['"]\.\/config['"]\)/g, "{env:process.env}"],
|
|
4333
|
+
// utils/* — LLM generates helpers that don't exist; redirect to shim
|
|
4334
|
+
[/require\(['"]\.\.\/utils\/validators['"]\)/g, "require('../utils/validators')"],
|
|
4335
|
+
[/require\(['"]\.\/utils\/validators['"]\)/g, "require('./utils/validators')"],
|
|
4336
|
+
[/require\(['"]\.\.\/utils\/validation['"]\)/g, "require('../utils/validators')"],
|
|
4337
|
+
[/require\(['"]\.\.\/helpers\/validators['"]\)/g, "require('../utils/validators')"],
|
|
4338
|
+
[/require\(['"]\.\.\/utils\/helpers['"]\)/g, "{sanitize:(s)=>String(s).trim(),escape:(s)=>String(s).replace(/</g,'<')}"],
|
|
4339
|
+
[/require\(['"]\.\.\/utils\/logger['"]\)/g, "{info:()=>{},error:()=>{},warn:()=>{},debug:()=>{}}"],
|
|
4340
|
+
[/require\(['"]\.\.\/utils\/errors['"]\)/g, "{AppError:class AppError extends Error{constructor(m,s){super(m);this.statusCode=s||500;}}}"],
|
|
4316
4341
|
// rateLimiter: LLM sometimes creates a separate file instead of importing from security.js
|
|
4317
4342
|
[/require\(['"]\.\.\/middleware\/rateLimiter['"]\)/g, "require('../middleware/security')"],
|
|
4318
4343
|
[/require\(['"]\.\/middleware\/rateLimiter['"]\)/g, "require('./middleware/security')"],
|
|
@@ -4321,11 +4346,12 @@ module.exports = { get, set, del, exists };
|
|
|
4321
4346
|
[/require\(['"]\.\.\/middleware\/limiter['"]\)/g, "require('../middleware/security')"],
|
|
4322
4347
|
[/require\(['"]\.\/middleware\/limiter['"]\)/g, "require('./middleware/security')"],
|
|
4323
4348
|
];
|
|
4324
|
-
function patchJsFiles(dir) {
|
|
4349
|
+
function patchJsFiles(dir, rootDir) {
|
|
4325
4350
|
if (!fs.existsSync(dir)) return;
|
|
4351
|
+
const _rootDir = rootDir || dir;
|
|
4326
4352
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
4327
4353
|
const full = path.join(dir, entry.name);
|
|
4328
|
-
if (entry.isDirectory()) { patchJsFiles(full); continue; }
|
|
4354
|
+
if (entry.isDirectory()) { patchJsFiles(full, _rootDir); continue; }
|
|
4329
4355
|
if (!entry.name.endsWith('.js')) continue;
|
|
4330
4356
|
let src = fs.readFileSync(full, 'utf8');
|
|
4331
4357
|
let changed = false;
|
|
@@ -4333,10 +4359,22 @@ module.exports = { get, set, del, exists };
|
|
|
4333
4359
|
const next = src.replace(pat, rep);
|
|
4334
4360
|
if (next !== src) { src = next; changed = true; }
|
|
4335
4361
|
}
|
|
4362
|
+
// Context-aware db path fix: if file is in a subdirectory of server/
|
|
4363
|
+
// (e.g. routes/, middleware/, services/) and does require('./db'),
|
|
4364
|
+
// correct to require('../db') since db.js lives in server/
|
|
4365
|
+
const depth = path.relative(_rootDir, dir).split(path.sep).filter(Boolean).length;
|
|
4366
|
+
if (depth > 0) {
|
|
4367
|
+
const prefix = '../'.repeat(depth);
|
|
4368
|
+
const next2 = src.replace(/require\(['"]\.\/db['"]\)/g, "require('" + prefix + "db')");
|
|
4369
|
+
if (next2 !== src) { src = next2; changed = true; }
|
|
4370
|
+
// Also fix ./models/* → ../models/*
|
|
4371
|
+
const next3 = src.replace(/require\(['"]\.\/(models\/[^'"]+)['"]\)/g, "require('../$1')");
|
|
4372
|
+
if (next3 !== src) { src = next3; changed = true; }
|
|
4373
|
+
}
|
|
4336
4374
|
if (changed) fs.writeFileSync(full, src, 'utf8');
|
|
4337
4375
|
}
|
|
4338
4376
|
}
|
|
4339
|
-
patchJsFiles(path.join(sandboxDir, 'server'));
|
|
4377
|
+
patchJsFiles(path.join(sandboxDir, 'server'), path.join(sandboxDir, 'server'));
|
|
4340
4378
|
sendLog('🔧 Shim iniettati: DB (in-memory), Sentinel WAF, Cache — require() patchati');
|
|
4341
4379
|
|
|
4342
4380
|
// Patch package.json to remove pg, add only what's needed
|