feat: Implement Filesystem and MongoDB provenance writers for PackRun execution context
- Added `FilesystemPackRunProvenanceWriter` to write provenance manifests to the filesystem. - Introduced `MongoPackRunArtifactReader` to read artifacts from MongoDB. - Created `MongoPackRunProvenanceWriter` to store provenance manifests in MongoDB. - Developed unit tests for filesystem and MongoDB provenance writers. - Established `ITimelineEventStore` and `ITimelineIngestionService` interfaces for timeline event handling. - Implemented `TimelineIngestionService` to validate and persist timeline events with hashing. - Created PostgreSQL schema and migration scripts for timeline indexing. - Added dependency injection support for timeline indexer services. - Developed tests for timeline ingestion and schema validation.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
export SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-1730000000}
|
||||
export TZ=UTC
|
||||
export LC_ALL=C
|
||||
node test_reach.js
|
||||
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { createServer } = require('../src/app');
|
||||
|
||||
const OUT_DIR = path.resolve(__dirname, '../outputs');
|
||||
const TRACE_DIR = path.join(OUT_DIR, 'traces');
|
||||
const COVERAGE_FILE = path.join(OUT_DIR, 'coverage.json');
|
||||
const TRACE_FILE = path.join(TRACE_DIR, 'traces.json');
|
||||
|
||||
function ensureDirs() {
|
||||
fs.mkdirSync(OUT_DIR, { recursive: true });
|
||||
fs.mkdirSync(TRACE_DIR, { recursive: true });
|
||||
}
|
||||
|
||||
function recordTrace(entry, pathNodes) {
|
||||
fs.writeFileSync(
|
||||
TRACE_FILE,
|
||||
JSON.stringify({
|
||||
entry,
|
||||
path: pathNodes,
|
||||
sink: 'ExpressEval::exec',
|
||||
notes: 'Admin exec reached'
|
||||
}, null, 2)
|
||||
);
|
||||
}
|
||||
|
||||
function recordCoverage(filePath, lines) {
|
||||
fs.writeFileSync(
|
||||
COVERAGE_FILE,
|
||||
JSON.stringify({
|
||||
files: {
|
||||
[filePath]: {
|
||||
lines_covered: lines,
|
||||
lines_total: 40
|
||||
}
|
||||
}
|
||||
}, null, 2)
|
||||
);
|
||||
}
|
||||
|
||||
(function main() {
|
||||
ensureDirs();
|
||||
const app = createServer();
|
||||
const res = app.handle('POST', '/api/admin/exec', { body: { code: '21*2' } });
|
||||
assert.strictEqual(res.status, 200);
|
||||
assert.strictEqual(res.body, '42');
|
||||
|
||||
recordTrace('POST /api/admin/exec', ['app.js::createServer', 'handler', 'eval(code)']);
|
||||
recordCoverage('src/app.js', [5, 6, 7, 13, 18, 19]);
|
||||
fs.writeFileSync(path.join(OUT_DIR, 'SINK_REACHED'), 'true');
|
||||
})();
|
||||
Reference in New Issue
Block a user