electrode-io / electrode

Web applications with node.js and React
Other
2.1k stars 300 forks source link

Csp directive #2005

Closed RahulTinku closed 8 months ago

RahulTinku commented 8 months ago

Add ablity for applications to set their CSP headers which may include style-src & script-src. Applications can set their nonce value or use default nonce value provided by electrode as usual.

getCSPHeader is added in route options, which accepts a function. In this function application can generate the CSP and return it as string.

arunvishnun commented 8 months ago

LGTM in general, seems there is lint issues (spacings)

jchip commented 8 months ago

Screenshot 2024-02-28 at 2 13 45 PM

from ChatGPT.

RahulTinku commented 8 months ago

Thank you @jchip, I shall update the code accordingly.

arunvishnun commented 8 months ago

@RahulTinku Could you create change files.

RahulTinku commented 8 months ago

Hi @arunvishnun , I have added changelog. Thanks