Security rules
NGB099: Untrusted module federation remote
Reports micro-frontend remotes whose code location is attacker-controlled or plaintext: remote entry / manifest URLs passed to Native Federation and Module Federation runtime APIs (loadRemoteModule({ remoteEntry }), loadRemoteEntry(), initFederation(), init({ remotes }), registerRemotes()) that are traced to an untrusted source (URL, storage, postMessage, HTTP response), constant http:// remote URLs, and http:// entries in federation.manifest.json files..
| Property | Value |
|---|---|
| Rule ID | NGB099 |
| Category | Supply chain |
| Default severity | high |
| CWE | CWE-829, CWE-494 |
| Built-in presets | recommended: error, strict: error |
Confidence is reported per finding (high, medium, low) and is independent of severity. See Reading findings.
What it checks
Reports micro-frontend remotes whose code location is attacker-controlled or plaintext: remote entry / manifest URLs passed to Native Federation and Module Federation runtime APIs (loadRemoteModule({ remoteEntry }), loadRemoteEntry(), initFederation(), init({ remotes }), registerRemotes()) that are traced to an untrusted source (URL, storage, postMessage, HTTP response), constant http:// remote URLs, and http:// entries in federation.manifest.json files.
Why it matters
A federation remote is executable JavaScript loaded into the host application's origin; whoever chooses its URL runs code with the user's session. Apps that let a query parameter or localStorage override remote URLs ("for testing") give that power to any link an attacker can send, and remotes over plain HTTP can be replaced by anyone on the network path.
Detection behavior and supported patterns
- Runtime APIs imported from
@angular-architects/native-federation,@angular-architects/module-federation,@softarc/native-federation*or@module-federation/(enhanced/)runtime - Remote URL arguments with a traced untrusted source (data flow, resource-URL context)
- Constant
http://remote URLs and manifest entries (loopback / private hosts excluded)
Example
loadRemoteModule({ remoteEntry: route.snapshot.queryParams['remote'], exposedModule: './Routes' })Safer alternative
loadRemoteModule({ remoteEntry: 'https://mfe.example.com/remoteEntry.json', exposedModule: './Routes' })Remediation
Load remotes only from a fixed list of HTTPS origins built into the host (or a signed / same-origin manifest). If remote overrides are needed for testing, restrict them to development builds and validate each URL against an origin allowlist.
False-positive considerations
- Remote URLs from a backend endpoint you control are reported when the HTTP response is the only source (medium confidence); validate them against an allowlist to document the trust decision.
Known limitations
- Webpack
ModuleFederationPluginremotesin build configuration and remotes loaded from a manifest fetched at runtime are not traced; only the manifest URL is. - Manifest JSON content served by a backend is not visible.
References
Run it
ngbastion explain NGB099