You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CommonJS model: Rule 1 misses nested writes to exported values, eval payloads, arguments and require.cache #33
Found in the PR #29 round-14 review. Rule 1 (the allowlist over uses of module/exports) misses some ways of reaching the exports object. Each repro keeps the file modelled and loses a pre-PR edge:
Nested writes to an exported value (module.exports = o) by any form other than o.x =: Object.assign(o, {b}) or Object.defineProperty(o, 'b', …) inside a called function; a local alias (const p = o; function init(){ p.b = b }); destructuring ([o.b] = [b]).
Literal eval payloads are visited but never scanned: eval('(function(){ exports.b=b })()'), eval('Object.assign(exports,{b})'), eval('this.b=b').
Other paths to the object: arguments[0].b = b / arguments[2].exports = … at top level; require.cache[module.id].exports.b = b; require('module')._cache[__filename].exports.run = run; a computed method key class K { [(this.b=b,'q')](){} }. The key evaluates with the module's this, but the scan treats it as bound.
Fix direction: run the Rule 1 scan on expanded eval payloads; give exported values the same write rules as aliases (builtin writers, aliases, patterns); bail on arguments, require.cache/Module._cache and this in computed keys.
Activity