Use worker in Cloudflare to remove a cookie

Stängt Publicerat 3 år sedan Betalades vid leverans
Stängt Betalades vid leverans

We have an internal scan tool that checks for our approved headers and cookies. In the scan we are seeing an unapproved cookie. The cookie is below the vendor is not able to remove the below cookie or the app would stop working. I have added the worker we adjusted and added to the route, which is presenting the proper headers. We need to adjust the worker to block, bypass or conceal the below cookie on the edge. Is that possible?

Vendor cookie

Headers for URL [login to view URL] (ignored because domain different to parent)

Current header used in route we'd like to add this to the below worker

let securityHeaders = {

"Content-Security-Policy" : "upgrade-insecure-requests",

"Strict-Transport-Security" : "max-age=1000",

"X-Xss-Protection" : "1; mode=block",

"X-Frame-Options" : "DENY",

"X-Content-Type-Options" : "nosniff",

"Referrer-Policy" : "strict-origin-when-cross-origin",

}

let sanitiseHeaders = {

"Server" : "My New Server Header!!!",

}

let removeHeaders = [

"Public-Key-Pins",

"X-Powered-By",

"X-AspNet-Version",

]

addEventListener('fetch', event => {

[login to view URL](addHeaders([login to view URL]))

})

async function addHeaders(req) {

let response = await fetch(req)

let newHdrs = new Headers([login to view URL])

if ([login to view URL]("Content-Type") && ![login to view URL]("Content-Type").includes("text/html")) {

return new Response([login to view URL] , {

status: [login to view URL],

statusText: [login to view URL],

headers: newHdrs

})

}

[login to view URL](securityHeaders).map(function(name, index) {

[login to view URL](name, securityHeaders[name]);

})

[login to view URL](sanitiseHeaders).map(function(name, index) {

[login to view URL](name, sanitiseHeaders[name]);

})

[login to view URL](function(name){

[login to view URL](name)

})

return new Response([login to view URL] , {

status: [login to view URL],

statusText: [login to view URL],

headers: newHdrs

})

}

Webbsäkerhet Datorsäkerhet Internetsäkerhet Linux PHP

Projekt-id: #29215185

About the project

Distansprojekt Aktivt 3 år sedan