Skip to content

CSP Nonce - #936

Merged
Aukevanoost merged 4 commits into
angular-architects:mainfrom
IosebKoplatadze:nonce
Mar 4, 2026
Merged

CSP Nonce#936
Aukevanoost merged 4 commits into
angular-architects:mainfrom
IosebKoplatadze:nonce

Conversation

@IosebKoplatadze

Copy link
Copy Markdown
Contributor

This pull request enhances the dynamic federation loader by adding support for setting a nonce attribute on remote entry scripts. This improves security for applications using Content Security Policy (CSP) with nonces and ensures that remote scripts can be loaded in environments with stricter CSP rules. Additionally, the type definitions have been updated for better type safety and clarity.

Security and CSP improvements:

  • Added support for a nonce attribute in the options for loading remote entry scripts and modules, allowing the loader to set a nonce on dynamically injected <script> tags. (libs/mf-runtime/src/lib/loader/dynamic-federation.ts) [1] [2]
  • Updated the loadRemoteEntry and loadRemoteModule functions to accept and propagate the nonce option, ensuring it is passed through all relevant code paths. (libs/mf-runtime/src/lib/loader/dynamic-federation.ts) [1] [2]
  • Modified the loadRemoteScriptEntry function to set the nonce attribute on the created script element if provided. (libs/mf-runtime/src/lib/loader/dynamic-federation.ts) [1] [2]

Type safety and code clarity:

  • Improved type definitions for remoteMap to explicitly specify its structure, enhancing code safety and maintainability. (libs/mf-runtime/src/lib/loader/dynamic-federation.ts)

@IosebKoplatadze

Copy link
Copy Markdown
Contributor Author

@Aukevanoost can i get review here please

@Aukevanoost

Copy link
Copy Markdown
Collaborator

I'd love to, but I can't really calculate the impact since I'd never use the module federation plugin. I'm working more on the native-federation side.

@Aukevanoost
Aukevanoost merged commit 36b4088 into angular-architects:main Mar 4, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants