Skip to content

Commit b6adcf5

Browse files
authored
feat(securitytxt): add security.txt (#5827)
1 parent df49838 commit b6adcf5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/browser/security.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Contact: mailto:[email protected]
2+
Acknowledgments: https://coder.com/security/thanks
3+
Preferred-Languages: en-US
4+
Canonical: https://coder.com/.well-known/security.txt
5+
Policy: https://coder.com/security/policy
6+
Hiring: https://coder.com/careers

src/node/routes/index.ts

+7
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
8181
return res.redirect(`https://${req.headers.host}${req.originalUrl}`)
8282
}
8383

84+
// Return security.txt.
85+
if (req.originalUrl === "/security.txt" || req.originalUrl === "/.well-known/security.txt") {
86+
const resourcePath = path.resolve(rootPath, "src/browser/security.txt")
87+
res.set("Content-Type", getMediaMime(resourcePath))
88+
return res.send(await fs.readFile(resourcePath))
89+
}
90+
8491
// Return robots.txt.
8592
if (req.originalUrl === "/robots.txt") {
8693
const resourcePath = path.resolve(rootPath, "src/browser/robots.txt")

0 commit comments

Comments
 (0)