Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd613ba9

Browse files
authored
security: addX-Content-Type-Options: nosniff to block MIME-sniffing (#6344)
coder/security#12
1 parentcae8b88 commitd613ba9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎coderd/coderd.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,16 @@ func New(options *Options) *API {
319319
next.ServeHTTP(w,r)
320320
})
321321
},
322+
// This header stops a browser from trying to MIME-sniff the content type and
323+
// forces it to stick with the declared content-type. This is the only valid
324+
// value for this header.
325+
// See: https://github.com/coder/security/issues/12
326+
func(next http.Handler) http.Handler {
327+
returnhttp.HandlerFunc(func(w http.ResponseWriter,r*http.Request) {
328+
w.Header().Add("X-Content-Type-Options","nosniff")
329+
next.ServeHTTP(w,r)
330+
})
331+
},
322332
httpmw.CSRF(options.SecureAuthCookie),
323333
)
324334

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp