Skip to content

Commit

Permalink
add appropriate x-frame options
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Dec 7, 2023
1 parent e755a2f commit aac498a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

/tweety.json
/dist/
/tweety
23 changes: 23 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@
"command": "npm run build",
"options": {
"cwd": "${workspaceFolder}/frontend"
},
"group": {
"kind": "build"
}
},
{
"label": "build tweety",
"type": "shell",
"command": "go build -o tweety",
"group": {
"kind": "build"
}
},
{
"label": "build",
"dependsOn": [
"build frontend",
"build tweety"
],
"dependsOrder": "sequence",
"group": {
"kind": "build",
"isDefault": true
}
}
]
Expand Down
1 change: 0 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
content="default-src 'self'; script-src 'self'; style-src 'self'; connect-src 'self' ws://localhost:* http://localhost:*">
<meta http-equiv="X-XSS-Protection" content="1; mode=block">
<meta http-equiv="X-Content-Type-Options" content="nosniff">
<meta http-equiv="X-Frame-Options" content="DENY">
<title>Terminal</title>
</head>

Expand Down
5 changes: 5 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ func NewHandler() (http.Handler, error) {
r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Private-Network", "true")
w.Header().Set("X-Frame-Options", "SAMEORIGIN")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.Header().Set("X-XSS-Protection", "1; mode=block")
w.Header().Set("Referrer-Policy", "same-origin")
w.Header().Set("Content-Security-Policy", "default-src 'self'; script-src 'self'; style-src 'self';")
next.ServeHTTP(w, r)
})
})
Expand Down

0 comments on commit aac498a

Please sign in to comment.