Skip to content

Commit cea3482

Browse files
authored
Add security.txt. (#961)
* Add security.txt. * Fix make task name.
1 parent cf93449 commit cea3482

File tree

4 files changed

+81
-4
lines changed

4 files changed

+81
-4
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.PHONY: bash npm-build npm-install build clean db-migrate db-upgrade redis-cli run shell start stop update test pytest image envvar ci cert trust pull
2-
31
bash:
42
docker-compose run --rm web bash
53

@@ -62,3 +60,12 @@ trust:
6260

6361
cert: trust
6462
cd certs && mkcert jazzband.local "*.jazzband.local" jazzband.local localhost 127.0.0.1 ::1 && cd ..
63+
64+
generate-securitytxt:
65+
rm jazzband/static/security.txt
66+
gpg --clearsign -u 02DE8F842900411ADD70B1374D87558AF652A00F -o jazzband/static/security.txt jazzband/static/security.txt.tpl
67+
68+
verify-securitytxt:
69+
gpg --verify jazzband/static/security.txt
70+
71+
.PHONY: $(MAKECMDGOALS)

jazzband/content.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@ def security():
5757
return redirect("/about/security")
5858

5959

60+
@content.route("/security.txt")
61+
def securitytxt_redirect():
62+
return redirect(url_for("content.securitytxt_file"))
63+
64+
65+
@content.route("/.well-known/security.txt")
66+
def securitytxt_file():
67+
filename = "security.txt"
68+
return send_from_directory(
69+
current_app.static_folder,
70+
filename,
71+
as_attachment=False,
72+
mimetype="text/plain",
73+
max_age=current_app.get_send_file_max_age(filename),
74+
)
75+
76+
6077
@content.route("/donate")
6178
def donate():
6279
return redirect("https://psfmember.org/civicrm/contribute/transact?reset=1&id=34")
@@ -73,7 +90,8 @@ def docs(path):
7390
@content.route("/about/<path:path>")
7491
def about(path):
7592
page = about_pages.get_or_404(path)
76-
template = "layouts/%s.html" % page.meta.get("layout", "about")
93+
layout = page.meta.get("layout", "about")
94+
template = f"layouts/{layout}.html"
7795
return render_template(template, page=page)
7896

7997

@@ -134,7 +152,8 @@ def news_feed():
134152
@content.route("/news/<path:path>")
135153
def news(path):
136154
page = news_pages.get_or_404(path)
137-
template = "layouts/%s.html" % page.meta.get("layout", "news_detail")
155+
layout = page.meta.get("layout", "news_detail")
156+
template = f"layouts/{layout}.html"
138157
return render_template(template, page=page)
139158

140159

jazzband/static/security.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-----BEGIN PGP SIGNED MESSAGE-----
2+
Hash: SHA512
3+
4+
# This is the Jazzband security.txt file.
5+
# More infos about the standard: https://securitytxt.org
6+
7+
# Our security address
8+
Contact: mailto:security@jazzband.co
9+
# Our OpenPGP key
10+
Encryption: openpgp4fpr:02DE8F842900411ADD70B1374D87558AF652A00F
11+
# Our security policy
12+
Policy: https://jazzband.co/security
13+
# Canonical URIs
14+
Canonical: https://jazzband.co/.well-known/security.txt
15+
# Our preferred languages
16+
Preferred-Languages: en
17+
18+
Expires: 2022-09-30T10:00:00.000Z
19+
# This file was clear-signed with: make generate-securitytxt
20+
-----BEGIN PGP SIGNATURE-----
21+
22+
iQIzBAEBCgAdFiEEAt6PhCkAQRrdcLE3TYdVivZSoA8FAmFx2CMACgkQTYdVivZS
23+
oA+afQ/8C22qJeEOUY8eaNMJwo5SvoLw2sFPmhOjmTjtuULYHbZ/UWWUJhejdvVY
24+
TACzcUS+J6YM7yFjlwAFOPMTyuWqk5QimRWvXQhwRAMGwLGdFeza6wHcHH6TsOpd
25+
oiRvhYCFp/jwBzQAruG6z37LuNxP241rQvx/HJrKqHfN9UBPu3jkLB9WZVvoARGM
26+
bpFOshdn7BH3f19xC6Nd2+xQrenEJIRV5fJurB7UY2X3auTMA7GZZjVsaApJSzrv
27+
6QURag6E5KTW7kx+SNAh4xUINFI1YNHB8DGVKzab/se3qPMorLoNMFNzG0m+Ekfq
28+
8q9E8WGRBhXOXDjIeXP3gSLq5XYcMKHXsdYFFF+KQe8UmAizKjWs0z4IgBBbAZv5
29+
0iaZHa6htT+wF4WxbV/pgx5ECgkhy+CtUuxvXbdWsODZ7U7+qtY83cHGD6tlEGCS
30+
aV0GNIBvVM05fyaQLqUoeSwXvIrS7vU9P8YZ+KaubTmptsJIrShumLxE9fErU5uq
31+
ziMFAo0fAC0Xb8xGIfx/BN3GbzXIyQYbYEHZbGqug0mwhwqINdsVpfCleOCsZNxc
32+
mAhf9NZ19qH2L9l4P8N71w39bfH4BluGCWB3iPiRGqsidDag1205a9JeIKrqaM32
33+
FF7FSwNwnjmdrVYXuFsGYBiD5SnO1A+emPZ+PxjuFHSRvm37fpI=
34+
=U4DN
35+
-----END PGP SIGNATURE-----

jazzband/static/security.txt.tpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is the Jazzband security.txt file.
2+
# More infos about the standard: https://securitytxt.org
3+
4+
# Our security address
5+
Contact: mailto:security@jazzband.co
6+
# Our OpenPGP key
7+
Encryption: openpgp4fpr:02DE8F842900411ADD70B1374D87558AF652A00F
8+
# Our security policy
9+
Policy: https://jazzband.co/security
10+
# Canonical URIs
11+
Canonical: https://jazzband.co/.well-known/security.txt
12+
# Our preferred languages
13+
Preferred-Languages: en
14+
15+
Expires: 2022-09-30T10:00:00.000Z
16+
# This file was clear-signed with: make generate-securitytxt

0 commit comments

Comments
 (0)