feat(securitytxt): add security.txt (#5827)

This commit is contained in:
Geoffrey Huntley 2022-12-06 08:43:00 +10:00 committed by GitHub
parent df49838739
commit b6adcf50c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

6
src/browser/security.txt Normal file
View File

@ -0,0 +1,6 @@
Contact: mailto:security@coder.com
Acknowledgments: https://coder.com/security/thanks
Preferred-Languages: en-US
Canonical: https://coder.com/.well-known/security.txt
Policy: https://coder.com/security/policy
Hiring: https://coder.com/careers

View File

@ -81,6 +81,13 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
return res.redirect(`https://${req.headers.host}${req.originalUrl}`) return res.redirect(`https://${req.headers.host}${req.originalUrl}`)
} }
// Return security.txt.
if (req.originalUrl === "/security.txt" || req.originalUrl === "/.well-known/security.txt") {
const resourcePath = path.resolve(rootPath, "src/browser/security.txt")
res.set("Content-Type", getMediaMime(resourcePath))
return res.send(await fs.readFile(resourcePath))
}
// Return robots.txt. // Return robots.txt.
if (req.originalUrl === "/robots.txt") { if (req.originalUrl === "/robots.txt") {
const resourcePath = path.resolve(rootPath, "src/browser/robots.txt") const resourcePath = path.resolve(rootPath, "src/browser/robots.txt")