Initial commit: Memind H5 portal with MindSpace, Plaza, and agent jobs.
Track application source and tests; exclude local env, user workspaces, and runtime data via .gitignore. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { runBasicFileScan } from './mindspace-scan.mjs';
|
||||
|
||||
test('runBasicFileScan passes plain text files', () => {
|
||||
const result = runBasicFileScan(Buffer.from('hello world'), {
|
||||
filename: 'note.txt',
|
||||
mimeType: 'text/plain',
|
||||
});
|
||||
assert.equal(result.scanStatus, 'passed');
|
||||
});
|
||||
|
||||
test('runBasicFileScan blocks inline script payloads', () => {
|
||||
const result = runBasicFileScan(Buffer.from('<script>alert(1)</script>'), {
|
||||
filename: 'note.md',
|
||||
mimeType: 'text/markdown',
|
||||
});
|
||||
assert.equal(result.scanStatus, 'blocked');
|
||||
assert.equal(result.riskLevel, 'high');
|
||||
});
|
||||
|
||||
test('runBasicFileScan blocks suspicious zip compression ratio', () => {
|
||||
const buffer = Buffer.alloc(64);
|
||||
buffer.write('PK', 0);
|
||||
buffer.writeUInt16LE(8, 8);
|
||||
buffer.writeUInt32LE(10, 18);
|
||||
buffer.writeUInt32LE(5000, 22);
|
||||
const result = runBasicFileScan(buffer, {
|
||||
filename: 'report.docx',
|
||||
mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
});
|
||||
assert.equal(result.scanStatus, 'blocked');
|
||||
});
|
||||
Reference in New Issue
Block a user