Issue Bug Closed

#102248CSP issues in BE for custom eval rules on input fields

Claus Harup 10/25/23, 06:19 updated 11/06/23, 18:00

Description

https://docs.typo3.org/m/typo3/reference-tca/main/en-us/ColumnsConfig/Type/Input/Properties/Eval.html#custom-eval-rules

When “backend enforce content security policy” is enabled the final script tag contains no nonce and we get CSP issues :-(

Content-Security-Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

<script >
/*<![CDATA[*/
var TBE_EDITOR = TBE_EDITOR || { customEvalFunctions: {} }; TBE_EDITOR.customEvalFunctions['TYPOCONSULT\u005CTcSys\u005CEvaluator\u005CUrlEvaluator'] = function(value) { 
            var returnValue = value;

            if(value.length){
                if(value.substring(0, 7) != 'http://' && value.substring(0, 8) != 'https://'){
                    if(value.indexOf('.') > 0){
                        returnValue = 'https://' + value;
                    } else{
                        returnValue = '';
                    }
                }
            }

            return returnValue;
         };
/*]]>*/
</script>

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.