remove Stripe CSP from server (#29306)
* remove Stripe CSP from server * Update tests * Fix more tests --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -98,13 +98,13 @@ func UpdateAssetsSubpathInDir(subpath, directory string) error {
|
||||
func updateRootFile(oldRootHTML string, rootHTMLPath string, alreadyRewritten bool, pathToReplace, newPath, subpath string) error {
|
||||
newRootHTML := oldRootHTML
|
||||
|
||||
reCSP := regexp.MustCompile(`<meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3([^"]*)">`)
|
||||
reCSP := regexp.MustCompile(`<meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/([^"]*)">`)
|
||||
if results := reCSP.FindAllString(newRootHTML, -1); len(results) == 0 {
|
||||
return fmt.Errorf("failed to find 'Content-Security-Policy' meta tag to rewrite")
|
||||
}
|
||||
|
||||
newRootHTML = reCSP.ReplaceAllLiteralString(newRootHTML, fmt.Sprintf(
|
||||
`<meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3%s">`,
|
||||
`<meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/%s">`,
|
||||
GetSubpathScriptHash(subpath),
|
||||
))
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user