-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Add security.txt file #1589
Add security.txt file #1589
Conversation
security.txt (https://securitytxt.org/) files are getting an accepted industry standard and it would be beneficial to adopt this standard for Node.js Web site as well. This addition to the Web site has already been endorsed by the Security WG: nodejs/security-wg#143
server.js
Outdated
@@ -89,6 +96,7 @@ statics.on('add', (filePath) => { | |||
|
|||
// Initializes the server and mounts it in the generated build directory. | |||
http.createServer((req, res) => { | |||
if (wellknown(req, res)) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This server is only used for development so I'm not sure if it's worth adding. In production the site is served by NGINX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then in production it would be good to add /security.txt
-> /.well-known/security.txt
redirect as recommended by the spec and employed by a couple of bigger sites on the Web.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should be added here: https://github.com/nodejs/build/blob/master/setup/www/resources/config/nodejs.org
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lpinca security.txt
should be in the repo, file would be served in production like our static files.
We just need to add
location /security.txt {
alias /home/www/nodejs/.well-known/security.txt;
default_type text/plain;
}
in the nginx config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly that's what I was suggesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't mind it at all. Keeps things simple. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so the bottom line is to put security.txt
into the static
folder and handle /security.txt
and /.well-known/security.txt
in NGINX config and get rid of everything else in server.js
and build.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the feedback, I will make a change and submit a second PR against nodejs/build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the feedback, I will make a change and submit a second PR against nodejs/build.
NGINX configuration in the nodejs/build repo will be updated to serve this file on URLs recommended in the specification.
I left the bare All feedback appreciated! |
Thank you! |
My pleasure! |
security.txt (https://securitytxt.org/) files are getting an accepted industry standard and it would be beneficial to adopt this standard for Node.js Web site as well.
This addition to the Web site has already been endorsed by the Security WG.
This PR resolves nodejs/security-wg#143.