Skip to content

feat(securitytxt): add security.txt #5827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/browser/security.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Contact: mailto:[email protected]
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
7 changes: 7 additions & 0 deletions src/node/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ export const register = async (app: App, args: DefaultedArgs): Promise<Disposabl
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.
if (req.originalUrl === "/robots.txt") {
const resourcePath = path.resolve(rootPath, "src/browser/robots.txt")
Expand Down