Skip to content

Magento secureRenderer not producing nonce

With this test code

 <?= /* noEscape */  $secureRenderer->renderTag('script', ['id' => 'testjs'], 'var thisisatest=0;', false ); ?>

I’d expect Magento to output a script tag similar to

<script id="textjs" nonce="random-nonce-characters">var thisisatest=0;</script>

But it’s not, instead outputting

<script id="testjs">var thisisatest=0;</script>

I’m aware that Dev tools tend to hide the nonce but you usually see the nonce attribute without it’s value. In addition I have curl’d the html and it’s not present.

Any suggestions before I pull all of my hair out (not that I’ve got much!)