Isolating trust between independently deployed frontend modules
Isolating trust between independently deployed frontend modules connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding trust between independently deployed frontend modules helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Browser security is influenced by origins, embedded content, messaging and the way returned data is interpreted. A server can make a correct decision while client-side code later exposes the result to an unintended page or execution context.
Micro-frontends combine independently deployed features in a host application, also called a shell. Separate repositories and deployment teams do not create browser security boundaries: the same-origin policy separates origins, not individual features within a page.
Serve a less-trusted feature from a dedicated origin in an iframe. Apply an iframe sandbox, granting only capabilities the feature requires. Leave top-level navigation and popup permissions disabled unless necessary.
Why it matters
Consider a realistic failure: one frontend module introduces a script or messaging relationship that affects the trust of the whole application.
A browser trust failure can affect signed-in users, private responses or actions taken with a user's session. The assessment should identify the relevant browser behaviour and the server-side permissions that remain in force.
Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.
How penetration testers check for it
Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.
- Map trusted origins, embedded resources and messaging relationships.
- Review response policies and actual browser behaviour.
- Trace untrusted data into rendering and navigation.
- Check credentialed requests and sensitive state changes.
How to fix it
Use the appropriate maintained mechanisms and verify the result in the actual production configuration.
- Enforce authorisation on the server for every request.
- Do not combine allow-scripts and allow-same-origin for content on the host's own origin; that combination can let the embedded application remove its sandbox. allow-same-origin preserves the frame's original origin; it does not make a cross-origin frame same-origin with the host.
- Select immutable, reviewed releases, including entry scripts and their dependent chunks. Keep a known-good release available for rollback.
- Use Subresource Integrity where the loader supports it. Verify coverage of dynamically loaded chunks; checking an entry script alone does not verify everything it later loads. Integrity checks detect changed bytes, not malicious behaviour in an approved release.
- Validate messaging origins and intended recipients.
- Retain independent server-side identity and permission checks.
A policy finding needs application context. The absence of a particular header or browser feature is not, by itself, proof that protected data can be accessed.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Building frontend trust boundaries around untrusted content
- Implementing security boundaries between microservices
- Managing npm dependency trust and installation risks
Read about our methodology or contact pentested.com to discuss secure development and code review.