mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-12 19:55:14 +02:00
[pitboss] phase 13: Track B — JavaScript + TypeScript harness emitter shapes
This commit is contained in:
parent
96eb37500c
commit
34a5879459
51 changed files with 2556 additions and 440 deletions
18
tests/dynamic_fixtures/javascript/esm_default/benign.js
Normal file
18
tests/dynamic_fixtures/javascript/esm_default/benign.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Phase 13 — ES module default export, benign control.
|
||||
//
|
||||
// nyx-shape: esm-default
|
||||
import { execFileSync } from 'child_process';
|
||||
|
||||
export default function runPing(host) {
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
execFileSync('true', [host], {
|
||||
encoding: 'utf8',
|
||||
timeout: 5000,
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
});
|
||||
return 'ok';
|
||||
} catch (_e) {
|
||||
return 'err';
|
||||
}
|
||||
}
|
||||
22
tests/dynamic_fixtures/javascript/esm_default/vuln.js
Normal file
22
tests/dynamic_fixtures/javascript/esm_default/vuln.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Phase 13 — ES module default export, vulnerable.
|
||||
//
|
||||
// `export default` body is the entry the harness imports dynamically. The
|
||||
// harness builder stages this file at `workdir/entry.mjs` (per
|
||||
// js_shared::entry_subpath_for_shape) so Node parses it under ESM semantics
|
||||
// regardless of the on-disk `.js` extension under the fixture tree.
|
||||
|
||||
// nyx-shape: esm-default
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
export default function runPing(host) {
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
const out = execSync('echo hello ' + host, { encoding: 'utf8', timeout: 5000 });
|
||||
process.stdout.write(out);
|
||||
return out;
|
||||
} catch (e) {
|
||||
const out = (e.stdout || '') + (e.stderr || '');
|
||||
process.stdout.write(out);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue