sympa-community / sympa

Sympa, Mailing List Management Software
https://www.sympa.community/sympa
GNU General Public License v2.0
245 stars 97 forks source link

Content Security Policy (CSP) #1122

Open likehopper opened 3 years ago

likehopper commented 3 years ago

The security requirements of web servers are increasing. From now it's recommended to have a "Content-Security-Policy" rule. And generally, it prohibits the execution of inline scripts (unsafe-inline).

However, in Sympa's pages, we have an innline script generated dynamically. And that prevents the menu from working.

For example these include:

        <!-- head_javascript.tt2 -->

    <script>
    <!--
    var sympa = {
        backText:           'Retour',
        calendarButtonText: 'Calendrier',
        calendarFirstDay:   0,
        closeText:          'Fermer',
        dayNames:           'Lundi:Mardi:Mercredi:Jeudi:Vendredi:Samedi:Dimanche'.split(":"),
        dayNamesMin:        'D:L:M:M:J:V:S'.split(":"),
        home_url:           '/sympa/',
        icon    s_url:          '/static-sympa/icons',
        lang:               'fr',
        loadingText:        'Veuillez patienter...',
        monthNamesShort:    'Jan:Fév:Mar:Avr:Mai:Jui:Juil:Aoû:Sep:Oct:Nov:Déc'.split(":"),
        openInNewWinText:   'Ouvrir dans une nouvelle fenêtre',
        resetText:          'Effacer'
    };
    var lang = 'fr';
    //-->
    </script>

Could you change it to call it from an external file?

Thanks, Vincent

ikedas commented 3 years ago

There seem some more things to be prohibited by CSP:

likehopper commented 1 year ago

Has the code been updated ?

ikedas commented 1 year ago

How can we resolve the points I mentioned?

ikedas commented 1 year ago

Hi @likehopper , Could you please apply the changes in PR above and check if the problem will be fixed?