Skip to content

Commit db3f18d

Browse files
committed
Merge branch 'willyguggenheim-fix-security-vulnerabilities'
2 parents 56c2e0f + 15a58eb commit db3f18d

File tree

6 files changed

+138
-148
lines changed

6 files changed

+138
-148
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN set -ex \
88
&& npm install --production \
99
# Generate SSL-certificate (for HTTPS)
1010
&& apk --no-cache add openssl \
11-
&& openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout privkey.pem -out fullchain.pem \
11+
&& openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout testpk.pem -out fullchain.pem \
1212
-subj "/C=GB/ST=London/L=London/O=Mendhak/CN=my.example.com" \
1313
-addext "subjectAltName=DNS:my.example.com,DNS:my.example.net,IP:192.168.50.108,IP:127.0.0.1" \
1414
&& apk del openssl \
@@ -17,7 +17,7 @@ RUN set -ex \
1717
&& rm package* \
1818
# Correct User's file access
1919
&& chown -R node:node /app \
20-
&& chmod +r /app/privkey.pem
20+
&& chmod +r /app/testpk.pem
2121

2222
FROM node:22-alpine AS final
2323
LABEL \

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ With docker compose, this would be:
7878

7979
## Use your own certificates
8080

81-
The certificates are at `/app/fullchain.pem` and `/app/privkey.pem`.
81+
The certificates are at `/app/fullchain.pem` and `/app/testpk.pem`.
8282

8383
You can use volume mounting to substitute the certificate and private key with your own.
8484

@@ -89,7 +89,7 @@ You can use volume mounting to substitute the certificate and private key with y
8989
- "8443:8443"
9090
volumes:
9191
- /etc/ssl/certs/ssl-cert-snakeoil.pem:/app/fullchain.pem
92-
- /etc/ssl/private/ssl-cert-snakeoil.key:/app/privkey.pem
92+
- /etc/ssl/private/ssl-cert-snakeoil.key:/app/testpk.pem
9393

9494
You can use the environment variables `HTTPS_CERT_FILE` and `HTTPS_KEY_FILE` to define the location of existing certificate and private key inside container.
9595

@@ -265,15 +265,15 @@ To get client certificate details in the response body, start the container with
265265
For example, invoke using curl, passing a certificate and key.
266266

267267
```bash
268-
curl -k --cert cert.pem --key privkey.pem https://localhost:8443/
268+
curl -k --cert cert.pem --key testpk.pem https://localhost:8443/
269269
```
270270

271271
The response body will contain details about the client certificate passed in.
272272

273273
If you browse to https://localhost:8443/ in Firefox, you won't get prompted to supply a client certificate unless you have [an imported certificate by the same issuer as the server](https://superuser.com/questions/1043415/firefox-doesnt-ask-me-for-a-certificate-when-visiting-a-site-that-needs-one). If you need browser prompting to work, you'll need to follow the 'use your own certificates' section. Firefox needs the imported certificate to be in a PKCS12 format, so if you have a certificate and key already, you can combine them using
274274

275275
```bash
276-
openssl pkcs12 -export -in cert.pem -inkey privkey.pem -out certpkcs12.pfx
276+
openssl pkcs12 -export -in cert.pem -inkey testpk.pem -out certpkcs12.pfx
277277
```
278278

279279
## Preserve the case of headers in response body

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ let httpOpts = {
198198
}
199199

200200
let httpsOpts = {
201-
key: require('fs').readFileSync(process.env.HTTPS_KEY_FILE || 'privkey.pem'),
201+
key: require('fs').readFileSync(process.env.HTTPS_KEY_FILE || 'testpk.pem'),
202202
cert: require('fs').readFileSync(process.env.HTTPS_CERT_FILE || 'fullchain.pem'),
203203
maxHeaderSize: maxHeaderSize
204204
};

0 commit comments

Comments
 (0)