yes-https 3.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yaml +56 -22
- package/.github/workflows/codeql.yml +41 -0
- package/.github/workflows/release.yaml +51 -0
- package/.release-please-manifest.json +3 -0
- package/AGENTS.md +36 -0
- package/CHANGELOG.md +49 -0
- package/README.md +11 -4
- package/SECURITY.md +39 -0
- package/biome.json +30 -0
- package/docs/assets/yes-https.png +0 -0
- package/example/app.js +4 -4
- package/example/package-lock.json +283 -267
- package/example/package.json +1 -1
- package/lib/index.js +33 -30
- package/package.json +11 -14
- package/release-please-config.json +10 -0
- package/renovate.json +12 -4
- package/test/certs/ca.crt +19 -12
- package/test/certs/ca.key +28 -18
- package/test/certs/server.crt +17 -12
- package/test/certs/server.csr +14 -9
- package/test/certs/server.key +28 -15
- package/test/test.js +233 -80
- package/.releaserc.json +0 -3
|
@@ -4,43 +4,77 @@ on:
|
|
|
4
4
|
- main
|
|
5
5
|
pull_request:
|
|
6
6
|
name: ci
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ci-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
7
12
|
jobs:
|
|
8
13
|
test:
|
|
9
14
|
runs-on: ubuntu-latest
|
|
15
|
+
timeout-minutes: 15
|
|
10
16
|
strategy:
|
|
11
17
|
matrix:
|
|
12
|
-
node: [18, 20]
|
|
18
|
+
node: [18, 20, 22]
|
|
13
19
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
15
|
-
|
|
20
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
21
|
+
with:
|
|
22
|
+
persist-credentials: false
|
|
23
|
+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
16
24
|
with:
|
|
17
25
|
node-version: ${{ matrix.node }}
|
|
26
|
+
cache: npm
|
|
18
27
|
- run: node --version
|
|
19
|
-
- run: npm
|
|
28
|
+
- run: npm ci
|
|
20
29
|
- run: npm test
|
|
21
|
-
|
|
30
|
+
coverage:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
timeout-minutes: 15
|
|
33
|
+
permissions:
|
|
34
|
+
contents: read
|
|
35
|
+
id-token: write
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
22
38
|
with:
|
|
23
|
-
|
|
39
|
+
persist-credentials: false
|
|
40
|
+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
41
|
+
with:
|
|
42
|
+
node-version: 24
|
|
43
|
+
cache: npm
|
|
44
|
+
- run: node --version
|
|
45
|
+
- run: npm ci
|
|
46
|
+
- run: npm run coverage
|
|
47
|
+
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
|
|
48
|
+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
|
49
|
+
with:
|
|
50
|
+
use_oidc: true
|
|
51
|
+
files: ./lcov.info
|
|
52
|
+
disable_search: true
|
|
53
|
+
fail_ci_if_error: true
|
|
54
|
+
name: actions node 20
|
|
24
55
|
lint:
|
|
25
56
|
runs-on: ubuntu-latest
|
|
57
|
+
timeout-minutes: 15
|
|
26
58
|
steps:
|
|
27
|
-
- uses: actions/checkout@
|
|
28
|
-
|
|
59
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
60
|
+
with:
|
|
61
|
+
persist-credentials: false
|
|
62
|
+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
29
63
|
with:
|
|
30
|
-
node-version:
|
|
31
|
-
|
|
64
|
+
node-version: 24
|
|
65
|
+
cache: npm
|
|
66
|
+
- run: npm ci
|
|
32
67
|
- run: npm run lint
|
|
33
|
-
|
|
34
|
-
if: github.ref == 'refs/heads/main'
|
|
68
|
+
renovate-config:
|
|
35
69
|
runs-on: ubuntu-latest
|
|
36
|
-
|
|
70
|
+
timeout-minutes: 10
|
|
37
71
|
steps:
|
|
38
|
-
- uses: actions/checkout@
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
72
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
73
|
+
with:
|
|
74
|
+
persist-credentials: false
|
|
75
|
+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
76
|
+
with:
|
|
77
|
+
node-version: 24
|
|
78
|
+
cache: npm
|
|
79
|
+
- run: npm ci
|
|
80
|
+
- run: npm run renovate-config
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: CodeQL
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
schedule:
|
|
11
|
+
- cron: '20 6 * * 1'
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
actions: read
|
|
15
|
+
contents: read
|
|
16
|
+
security-events: write
|
|
17
|
+
|
|
18
|
+
concurrency:
|
|
19
|
+
group: codeql-${{ github.ref }}
|
|
20
|
+
cancel-in-progress: true
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
analyze:
|
|
24
|
+
name: Analyze
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
timeout-minutes: 30
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout repository
|
|
30
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
31
|
+
with:
|
|
32
|
+
persist-credentials: false
|
|
33
|
+
|
|
34
|
+
- name: Initialize CodeQL
|
|
35
|
+
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
|
|
36
|
+
with:
|
|
37
|
+
languages: javascript-typescript
|
|
38
|
+
build-mode: none
|
|
39
|
+
|
|
40
|
+
- name: Perform CodeQL analysis
|
|
41
|
+
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
on:
|
|
2
|
+
push:
|
|
3
|
+
branches:
|
|
4
|
+
- main
|
|
5
|
+
name: release
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
concurrency:
|
|
9
|
+
group: release-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: false
|
|
11
|
+
env:
|
|
12
|
+
FORCE_COLOR: 2
|
|
13
|
+
NODE: 24
|
|
14
|
+
jobs:
|
|
15
|
+
release-please:
|
|
16
|
+
if: github.repository == 'JustinBeckwith/yes-https'
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
permissions:
|
|
19
|
+
contents: write
|
|
20
|
+
pull-requests: write
|
|
21
|
+
timeout-minutes: 15
|
|
22
|
+
outputs:
|
|
23
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
24
|
+
tag_name: ${{ steps.release.outputs.tag_name }}
|
|
25
|
+
steps:
|
|
26
|
+
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4.4.0
|
|
27
|
+
id: release
|
|
28
|
+
with:
|
|
29
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
30
|
+
publish:
|
|
31
|
+
if: needs.release-please.outputs.release_created
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
needs: release-please
|
|
34
|
+
permissions:
|
|
35
|
+
contents: read
|
|
36
|
+
id-token: write
|
|
37
|
+
timeout-minutes: 15
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
40
|
+
with:
|
|
41
|
+
persist-credentials: false
|
|
42
|
+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
|
|
43
|
+
with:
|
|
44
|
+
node-version: ${{ env.NODE }}
|
|
45
|
+
cache: npm
|
|
46
|
+
registry-url: 'https://registry.npmjs.org'
|
|
47
|
+
- run: npm ci
|
|
48
|
+
- run: npm test
|
|
49
|
+
- run: npm publish --provenance --access public
|
|
50
|
+
env:
|
|
51
|
+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Project overview
|
|
4
|
+
|
|
5
|
+
- This repository is a small ESM Node.js package that exports a single middleware from `lib/index.js`.
|
|
6
|
+
- Runtime support starts at Node.js 18 (`package.json`), and CI tests the package on Node.js 18, 20, and 22.
|
|
7
|
+
- Linting runs with Biome, and releases are managed through `release-please`.
|
|
8
|
+
|
|
9
|
+
## Working agreements
|
|
10
|
+
|
|
11
|
+
- Use `npm` for dependency and script commands.
|
|
12
|
+
- Prefer small, focused changes. Avoid unrelated cleanup in the same PR.
|
|
13
|
+
- Use Conventional Commits for commit messages and PR titles (for example: `fix: ...`, `feat: ...`, `docs: ...`). This repository uses `release-please`, so incorrect commit or PR prefixes can break release automation.
|
|
14
|
+
- Keep the public middleware API and the README example aligned when behavior or options change.
|
|
15
|
+
- Do not edit `CHANGELOG.md` or `.release-please-manifest.json` manually unless the task is explicitly about the release process.
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
- Install dependencies: `npm install`
|
|
20
|
+
- Run tests: `npm test`
|
|
21
|
+
- Run lint: `npm run lint`
|
|
22
|
+
- Auto-fix formatting and lint issues: `npm run fix`
|
|
23
|
+
- Generate coverage report: `npm run coverage`
|
|
24
|
+
|
|
25
|
+
## Testing notes
|
|
26
|
+
|
|
27
|
+
- `npm test` runs with `NODE_ENV=production`, which is important because the middleware bypasses redirects outside production mode.
|
|
28
|
+
- HTTPS behavior is covered in `test/test.js` using the certificates under `test/certs/`.
|
|
29
|
+
- If you change request handling or HSTS behavior, update or extend tests in `test/test.js`.
|
|
30
|
+
|
|
31
|
+
## Files to check during changes
|
|
32
|
+
|
|
33
|
+
- `lib/index.js`: package implementation and exported middleware.
|
|
34
|
+
- `test/test.js`: behavioral coverage for redirects, HSTS headers, and ignored routes.
|
|
35
|
+
- `README.md`: user-facing API and usage examples.
|
|
36
|
+
- `example/app.js`: example app for manual testing and docs alignment.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [4.0.3](https://github.com/JustinBeckwith/yes-https/compare/yes-https-v4.0.2...yes-https-v4.0.3) (2026-04-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* normalize repository metadata for npm publishing ([#154](https://github.com/JustinBeckwith/yes-https/issues/154)) ([0382f21](https://github.com/JustinBeckwith/yes-https/commit/0382f21792bc2cf5b96de5e7ef3c369e57ca1c75))
|
|
9
|
+
* use node 24 for release publishing ([#156](https://github.com/JustinBeckwith/yes-https/issues/156)) ([3c0c7a1](https://github.com/JustinBeckwith/yes-https/commit/3c0c7a15acc65d709b0b48f3f131bc5f6fc61214))
|
|
10
|
+
|
|
11
|
+
## [4.0.2](https://github.com/JustinBeckwith/yes-https/compare/yes-https-v4.0.1...yes-https-v4.0.2) (2026-04-12)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* pass GitHub token to npm publish ([#152](https://github.com/JustinBeckwith/yes-https/issues/152)) ([cefe9a5](https://github.com/JustinBeckwith/yes-https/commit/cefe9a50109ea2602cf39fa255432593e62febe8))
|
|
17
|
+
|
|
18
|
+
## [4.0.1](https://github.com/JustinBeckwith/yes-https/compare/yes-https-v4.0.0...yes-https-v4.0.1) (2026-04-12)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* normalize includeSubDomains option handling ([#134](https://github.com/JustinBeckwith/yes-https/issues/134)) ([61f7c77](https://github.com/JustinBeckwith/yes-https/commit/61f7c77af5520475b6f29371c7fcb60a852f4b31))
|
|
24
|
+
|
|
25
|
+
## [4.0.0](https://github.com/JustinBeckwith/yes-https/compare/yes-https-v3.0.1...yes-https-v4.0.0) (2025-10-14)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### ⚠ BREAKING CHANGES
|
|
29
|
+
|
|
30
|
+
* support node.js 18 and up ([#107](https://github.com/JustinBeckwith/yes-https/issues/107))
|
|
31
|
+
* This drops support for node.js 10.x, and converts the module to es modules. Upgrade with care.
|
|
32
|
+
* Drops support for node.js 6 and node.js 8.
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* convert to es modules ([#56](https://github.com/JustinBeckwith/yes-https/issues/56)) ([0381d86](https://github.com/JustinBeckwith/yes-https/commit/0381d86984e552a58655a4f03862b7ff7791ee5d))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **deps:** update dependency express to v4.19.2 [security] ([#111](https://github.com/JustinBeckwith/yes-https/issues/111)) ([09cf4c4](https://github.com/JustinBeckwith/yes-https/commit/09cf4c437ee5ab4301b2a0b770f6f118efb0ef8b))
|
|
42
|
+
* **deps:** update dependency express to v5 ([#119](https://github.com/JustinBeckwith/yes-https/issues/119)) ([cbac5ef](https://github.com/JustinBeckwith/yes-https/commit/cbac5efe5e1d900093c2b5dc16fdd553957f9d89))
|
|
43
|
+
* fix the release pipeline ([#30](https://github.com/JustinBeckwith/yes-https/issues/30)) ([9e6d1df](https://github.com/JustinBeckwith/yes-https/commit/9e6d1dffbe5e9561ba6e288f156a508e6fc39fe1))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Build System
|
|
47
|
+
|
|
48
|
+
* require node.js 10x and up ([#37](https://github.com/JustinBeckwith/yes-https/issues/37)) ([5ccbe34](https://github.com/JustinBeckwith/yes-https/commit/5ccbe34347dfc9b296eef2723b63f13c98aa3f80))
|
|
49
|
+
* support node.js 18 and up ([#107](https://github.com/JustinBeckwith/yes-https/issues/107)) ([e9cb7f8](https://github.com/JustinBeckwith/yes-https/commit/e9cb7f840cdb7011f29bb12500ac69fd94eddebe))
|
package/README.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# YES HTTPS!
|
|
2
2
|
|
|
3
|
-
[](https://github.com/JustinBeckwith/yes-https/actions/)
|
|
3
|
+
[](https://github.com/JustinBeckwith/yes-https/actions/workflows/ci.yaml?query=branch%3Amain)
|
|
4
|
+
[](https://codecov.io/gh/JustinBeckwith/yes-https)
|
|
4
5
|
[](https://badge.fury.io/js/yes-https)
|
|
5
|
-
[](https://biomejs.dev)
|
|
7
|
+
[](https://github.com/googleapis/release-please)
|
|
8
|
+
|
|
9
|
+

|
|
7
10
|
|
|
8
11
|
`yes-https` is a happy little npm module that makes it easy to require `https` for your connect based application.
|
|
9
12
|
|
|
@@ -41,11 +44,15 @@ You can also set a few settings with the middleware to control the header:
|
|
|
41
44
|
```js
|
|
42
45
|
app.use(yes({
|
|
43
46
|
maxAge: 86400, // defaults `86400`
|
|
44
|
-
|
|
47
|
+
includeSubDomains: true, // defaults `true`
|
|
45
48
|
preload: true // defaults `true`
|
|
46
49
|
}));
|
|
47
50
|
```
|
|
48
51
|
|
|
52
|
+
`includeSubDomains` is the canonical option name. For backwards
|
|
53
|
+
compatibility, `includeSubdomains` is also accepted, and both spellings
|
|
54
|
+
default to `true`.
|
|
55
|
+
|
|
49
56
|
### Ignoring specific requests
|
|
50
57
|
|
|
51
58
|
In some cases, you may want to ignore a request and not force the redirect. You can use the `ignoreFilter` option to opt out of redirects on a case by case basis. This is useful if you want to ignore a specific route:
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Security fixes are generally limited to the latest published release in the
|
|
6
|
+
current major version line.
|
|
7
|
+
|
|
8
|
+
| Version | Supported |
|
|
9
|
+
| ------- | --------- |
|
|
10
|
+
| 4.x | Yes |
|
|
11
|
+
| < 4.0 | No |
|
|
12
|
+
|
|
13
|
+
This package supports Node.js 18 and later.
|
|
14
|
+
|
|
15
|
+
## Reporting a Vulnerability
|
|
16
|
+
|
|
17
|
+
Please do not report security vulnerabilities through public GitHub issues,
|
|
18
|
+
pull requests, or discussions.
|
|
19
|
+
|
|
20
|
+
Instead, report them privately by email to
|
|
21
|
+
`justin.beckwith@gmail.com` with:
|
|
22
|
+
|
|
23
|
+
- A clear description of the issue and its security impact
|
|
24
|
+
- Steps to reproduce, proof of concept, or example requests
|
|
25
|
+
- Affected package version, Node.js version, and deployment details
|
|
26
|
+
- Any suggested mitigations or fixes, if you have them
|
|
27
|
+
|
|
28
|
+
You can expect an initial response within 5 business days. After the report is
|
|
29
|
+
reviewed, the maintainer will work with you on validation, remediation, and a
|
|
30
|
+
coordinated disclosure timeline.
|
|
31
|
+
|
|
32
|
+
Please keep vulnerability details private until a fix is available and users
|
|
33
|
+
have had a reasonable opportunity to update.
|
|
34
|
+
|
|
35
|
+
## Scope
|
|
36
|
+
|
|
37
|
+
This policy applies to the `yes-https` package in this repository, including
|
|
38
|
+
the published npm package and the source under active maintenance on the default
|
|
39
|
+
branch.
|
package/biome.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
|
|
3
|
+
"files": {
|
|
4
|
+
"includes": [
|
|
5
|
+
"**/lib/**/*.js",
|
|
6
|
+
"**/test/**/*.js",
|
|
7
|
+
"**/example/**/*.js",
|
|
8
|
+
"!**/node_modules/**/*",
|
|
9
|
+
"!**/coverage/**/*"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
|
13
|
+
"linter": {
|
|
14
|
+
"enabled": true,
|
|
15
|
+
"rules": {
|
|
16
|
+
"recommended": true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"formatter": {
|
|
20
|
+
"enabled": true,
|
|
21
|
+
"indentStyle": "space",
|
|
22
|
+
"indentWidth": 2,
|
|
23
|
+
"lineWidth": 80
|
|
24
|
+
},
|
|
25
|
+
"javascript": {
|
|
26
|
+
"formatter": {
|
|
27
|
+
"quoteStyle": "single"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
Binary file
|
package/example/app.js
CHANGED
|
@@ -7,11 +7,11 @@ const app = express();
|
|
|
7
7
|
// Use the yes-https connect middleware. Note - this will only work if NODE_ENV is set to production.
|
|
8
8
|
app.use(yes());
|
|
9
9
|
|
|
10
|
-
app.get('/', (
|
|
11
|
-
|
|
10
|
+
app.get('/', (_request, response) => {
|
|
11
|
+
response.end('Thanks for checking it out!');
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
const server = app.listen(process.env.PORT || 3000, () => {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
console.log('App listening on port %s', server.address().port);
|
|
16
|
+
console.log('Press Ctrl+C to quit.');
|
|
17
17
|
});
|