code wiki / (root) / nx_media_jsexec.nx

nx_media_jsexec.nx

buildroot/runtime/nx_media_jsexec.nx

6879 B136 linesdepth 7pulls 22 transitivereach 28 importersview sourcekind librarytopic media
docsdependenciesstructsconstsfunctions

about

nx_media_jsexec.nx -- JS-EXECUTION media harvester. Runs a page's JavaScript on the sovereign engine and collects the media URLs its code CONSTRUCTS AT RUNTIME (via functions, template literals, string concatenation, class methods) and hands to fetch()/XHR. These are exactly the URLs a STATIC byte/urlfold scan MISSES -- e.g. `fetch(cdn(id)+'/master.m3u8')` where the path is computed, not a literal. SAFE BY CONSTRUCTION for "don't get blacklisted / don't hang on a hostile page": * Fetches PEND -- the engine records the URL and returns a pending promise; it makes NO network call. So running the page cannot hit a rate limit, cannot be fingerprinted by request pattern, cannot leak. * We read the pending URLs and STOP -- we do NOT service them (no fetch storm, no recursive crawl here). * ⚠ REMAINING SAFETY (documented, not yet wired): the interpreter has NO instruction/loop budget, so a hostile `while(true){}` in page JS would hang. LIVE-CRAWLER wiring is BLOCKED on a fuel budget in the eval loop (a coordinated shared-core change -- see coordination.tsv; do NOT wire live until it lands). This module + its gate run only WELL-BEHAVED input, so they are safe today.

dependencies 2 imports · 8 importers

nx_syscalls.nx nx_js_eval.nx nx_media_jsexec.nx nx_media_jsexec_gate.nx nx_media_multiround_gate.nx nx_video_sniff.nx nx_video_sniff_api_gate.nx nx_video_sniff_gate.nx nx_video_sniff_guard_gate.nx nx_video_sniff_page_gate.nx nx_video_sniff_wire_gate.nx

imports: nx_syscalls.nxnx_js_eval.nx

imported by: nx_media_jsexec_gate.nxnx_media_multiround_gate.nxnx_video_sniff.nxnx_video_sniff_api_gate.nxnx_video_sniff_gate.nxnx_video_sniff_guard_gate.nxnx_video_sniff_page_gate.nxnx_video_sniff_wire_gate.nx

structs

none

consts

16const K_MAGIC_2048: i64 = 2048
17const K_MAGIC_4096: i64 = 4096

functions

20func mjx_contains(hay: *u8, hl: i64, needle: *u8, nl: i64) -> i64
37func mjx_is_media_url(url: *u8, ul: i64) -> i64
61func mjx_harvest_js(src: *u8, srclen: i64, outbuf: *u8, cap: i64, outbox: *i64) -> i64
103func mjx_harvest_js_dom(src: *u8, srclen: i64, dochtml: *u8, doclen: i64, outbuf: *u8, cap: i64, outbox: *i64) -> i64