ep_helmet 11.0.30 → 11.0.32
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/dependabot.yml +4 -0
- package/.github/workflows/backend-tests.yml +18 -2
- package/.github/workflows/frontend-tests.yml +49 -3
- package/.github/workflows/lint.yml +2 -2
- package/.github/workflows/npmpublish.yml +6 -6
- package/README.md +19 -4
- package/ep.json +1 -0
- package/eslint.config.mjs +3 -0
- package/expressConfigure.js +11 -3
- package/package.json +3 -3
- package/.eslintrc.cjs +0 -9
package/.github/dependabot.yml
CHANGED
|
@@ -11,8 +11,23 @@ jobs:
|
|
|
11
11
|
if: |
|
|
12
12
|
(github.event_name != 'pull_request')
|
|
13
13
|
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
|
14
|
-
name: with Plugins
|
|
14
|
+
name: with Plugins (Node ${{ matrix.node }} / core ${{ matrix.core_ref || 'develop' }})
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
# Plugin floor is engines.node >=22 but current Etherpad core
|
|
19
|
+
# requires >=24 (engineStrict). Each cell pairs a Node version
|
|
20
|
+
# with a core ref that actually allows it: Node 22 against the
|
|
21
|
+
# last tag whose core floor was 22 (v2.7.3); Node 24 / 26 against
|
|
22
|
+
# current develop.
|
|
23
|
+
matrix:
|
|
24
|
+
include:
|
|
25
|
+
- node: '22'
|
|
26
|
+
core_ref: 'v2.7.3'
|
|
27
|
+
- node: '24'
|
|
28
|
+
core_ref: ''
|
|
29
|
+
- node: '26'
|
|
30
|
+
core_ref: ''
|
|
16
31
|
steps:
|
|
17
32
|
-
|
|
18
33
|
name: Install libreoffice
|
|
@@ -25,11 +40,12 @@ jobs:
|
|
|
25
40
|
uses: actions/checkout@v7
|
|
26
41
|
with:
|
|
27
42
|
repository: ether/etherpad-lite
|
|
43
|
+
ref: ${{ matrix.core_ref }}
|
|
28
44
|
path: etherpad-lite
|
|
29
45
|
- uses: actions/setup-node@v7
|
|
30
46
|
name: Install Node.js
|
|
31
47
|
with:
|
|
32
|
-
node-version:
|
|
48
|
+
node-version: ${{ matrix.node }}
|
|
33
49
|
- uses: pnpm/action-setup@v6.1.1
|
|
34
50
|
name: Install pnpm
|
|
35
51
|
with:
|
|
@@ -7,7 +7,26 @@ on:
|
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
test-frontend:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
10
|
+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
|
11
|
+
name: Playwright (Node ${{ matrix.node }} / core ${{ matrix.core_ref || 'develop' }})
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
# Plugin floor is engines.node >=22 but current Etherpad core
|
|
15
|
+
# requires >=24 (engineStrict). Each cell pairs a Node version
|
|
16
|
+
# with a core ref that actually allows it: Node 22 against the
|
|
17
|
+
# last tag whose core floor was 22 (v2.7.3); Node 24 / 26 against
|
|
18
|
+
# current develop.
|
|
19
|
+
matrix:
|
|
20
|
+
include:
|
|
21
|
+
- node: '22'
|
|
22
|
+
core_ref: 'v2.7.3'
|
|
23
|
+
# ubuntu-latest is now 26.04, and the Playwright pinned by core
|
|
24
|
+
# v2.7.3 refuses to install chromium there.
|
|
25
|
+
os: ubuntu-24.04
|
|
26
|
+
- node: '24'
|
|
27
|
+
core_ref: ''
|
|
28
|
+
- node: '26'
|
|
29
|
+
core_ref: ''
|
|
11
30
|
|
|
12
31
|
steps:
|
|
13
32
|
-
|
|
@@ -15,11 +34,12 @@ jobs:
|
|
|
15
34
|
uses: actions/checkout@v7
|
|
16
35
|
with:
|
|
17
36
|
repository: ether/etherpad-lite
|
|
37
|
+
ref: ${{ matrix.core_ref }}
|
|
18
38
|
path: etherpad-lite
|
|
19
39
|
- uses: actions/setup-node@v7
|
|
20
40
|
name: Install Node.js
|
|
21
41
|
with:
|
|
22
|
-
node-version:
|
|
42
|
+
node-version: ${{ matrix.node }}
|
|
23
43
|
- uses: pnpm/action-setup@v6.1.1
|
|
24
44
|
name: Install pnpm
|
|
25
45
|
with:
|
|
@@ -52,6 +72,17 @@ jobs:
|
|
|
52
72
|
- name: Create settings.json
|
|
53
73
|
working-directory: ./etherpad-lite
|
|
54
74
|
run: cp ./src/tests/settings.json settings.json
|
|
75
|
+
# Etherpad v2.7.x added a "severely outdated" version-badge that polls
|
|
76
|
+
# GitHub for the latest release and renders an absolutely-positioned
|
|
77
|
+
# banner at top-right when the running core is a full major behind.
|
|
78
|
+
# On the core v2.7.3 matrix cell that banner intercepts pointer
|
|
79
|
+
# events (e.g. #chaticon) and Playwright clicks time out. Set
|
|
80
|
+
# updates.tier=off so the badge stays hidden. Harmless no-op on cores
|
|
81
|
+
# without the updater or with the tier already off.
|
|
82
|
+
- name: Disable updater poll in test settings
|
|
83
|
+
working-directory: ./etherpad-lite
|
|
84
|
+
run: |
|
|
85
|
+
node -e 'const fs=require("fs");const s=JSON.parse(fs.readFileSync("settings.json","utf8"));s.updates={...(s.updates||{}),tier:"off"};fs.writeFileSync("settings.json",JSON.stringify(s,null,2));'
|
|
55
86
|
- name: Run the frontend tests
|
|
56
87
|
working-directory: ./etherpad-lite
|
|
57
88
|
shell: bash
|
|
@@ -69,4 +100,19 @@ jobs:
|
|
|
69
100
|
done
|
|
70
101
|
cd src
|
|
71
102
|
pnpm exec playwright install chromium --with-deps
|
|
72
|
-
|
|
103
|
+
# On the core v2.7.3 cell run only this plugin's own specs. Core
|
|
104
|
+
# v2.7.3's specs predate fixes that let them coexist with plugins
|
|
105
|
+
# that change the pad layout (enter.spec, a11y_dialogs.spec), and
|
|
106
|
+
# the develop cells already run the full core suite with the plugin.
|
|
107
|
+
#
|
|
108
|
+
# On develop use the declared-disables helper: ep.json declares
|
|
109
|
+
# `disables: ["@feature:cross-origin-embed"]` because helmet's
|
|
110
|
+
# X-Frame-Options: SAMEORIGIN blocks embedding from other origins.
|
|
111
|
+
# The helper runs a regression pass (everything else must pass) and
|
|
112
|
+
# an honesty pass (the tagged embed tests must fail). See
|
|
113
|
+
# doc/PLUGIN_FEATURE_DISABLES.md in core.
|
|
114
|
+
if [ -n "${{ matrix.core_ref }}" ]; then
|
|
115
|
+
pnpm run test-ui --project=chromium plugin_packages/
|
|
116
|
+
else
|
|
117
|
+
../bin/run-frontend-tests-with-disables.sh -- --project=chromium
|
|
118
|
+
fi
|
|
@@ -7,7 +7,7 @@ jobs:
|
|
|
7
7
|
lint:
|
|
8
8
|
name: ESLint
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
|
-
# `eslint .` executes .
|
|
10
|
+
# `eslint .` executes eslint.config.mjs and every installed ESLint plugin, so
|
|
11
11
|
# don't hand it the caller's contents:write / id-token:write token.
|
|
12
12
|
permissions:
|
|
13
13
|
contents: read
|
|
@@ -17,7 +17,7 @@ jobs:
|
|
|
17
17
|
- uses: actions/setup-node@v7
|
|
18
18
|
name: Install Node.js
|
|
19
19
|
with:
|
|
20
|
-
node-version:
|
|
20
|
+
node-version: 26
|
|
21
21
|
- uses: pnpm/action-setup@v6.1.1
|
|
22
22
|
name: Install pnpm
|
|
23
23
|
with:
|
|
@@ -20,12 +20,12 @@ jobs:
|
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/setup-node@v7
|
|
22
22
|
with:
|
|
23
|
-
# OIDC trusted publishing needs npm >= 11.5.1. Node
|
|
24
|
-
# line
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
node-version:
|
|
23
|
+
# OIDC trusted publishing needs npm >= 11.5.1. Node 26 is the
|
|
24
|
+
# Active LTS line and bundles npm 11.x, so the pinned upgrade below
|
|
25
|
+
# stays on the same npm major. Avoid odd non-LTS lines (Node 25):
|
|
26
|
+
# npm 12 requires ^22.22.2 || ^24.15.0 || >=26.0.0 and the upgrade
|
|
27
|
+
# step dies there with EBADENGINE.
|
|
28
|
+
node-version: 26
|
|
29
29
|
registry-url: https://registry.npmjs.org/
|
|
30
30
|
# Pinned to a range rather than @latest: the next npm major dropping
|
|
31
31
|
# this Node line would silently break publishing fleet-wide again.
|
package/README.md
CHANGED
|
@@ -23,16 +23,31 @@ Just use the same settings Helmet exposes for CSP.
|
|
|
23
23
|
The above CSP will need to be polished over time
|
|
24
24
|
https://ponyfoo.com/articles/content-security-policy-in-express-apps is a good write up that needs to be referred to and supported
|
|
25
25
|
|
|
26
|
-
## Frameguard
|
|
27
|
-
|
|
26
|
+
## Frameguard (embedding in an iframe)
|
|
27
|
+
By default helmet sends `X-Frame-Options: SAMEORIGIN`, so browsers only show a
|
|
28
|
+
pad in an iframe when the embedding page is on the pad's own origin. Embedding
|
|
29
|
+
from another origin or another site (for example a pad iframed into a wiki,
|
|
30
|
+
an LMS or Nextcloud) is blocked until you change the `frameguard` setting.
|
|
31
|
+
|
|
32
|
+
Allow embedding from any origin:
|
|
33
|
+
```
|
|
34
|
+
"ep_helmet":{
|
|
35
|
+
"frameguard": false
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To allow only some origins, turn frameguard off and restrict framing with a
|
|
40
|
+
CSP `frameAncestors` directive in the `csp` block above instead, e.g.
|
|
41
|
+
`"frameAncestors": ["'self'", "https://wiki.example.com"]`. X-Frame-Options
|
|
42
|
+
can't list allowed origins; helmet 8 only accepts these values:
|
|
28
43
|
```
|
|
29
44
|
"ep_helmet":{
|
|
30
45
|
"frameguard":{
|
|
31
|
-
"action": "
|
|
32
|
-
"domain": "https://DOMAINIFRAMEWILLBEHOSTEDIN.com"
|
|
46
|
+
"action": "deny"
|
|
33
47
|
}
|
|
34
48
|
}
|
|
35
49
|
```
|
|
50
|
+
`"action"` is `"deny"` or `"sameorigin"`.
|
|
36
51
|
|
|
37
52
|
# Todo
|
|
38
53
|
- [ ] Provide a good CSP example for Etherpad
|
package/ep.json
CHANGED
package/expressConfigure.js
CHANGED
|
@@ -11,7 +11,15 @@ exports.expressConfigure = (hookName, app, cb) => {
|
|
|
11
11
|
// for operators to opt in. With the default in place, strict
|
|
12
12
|
// 'script-src self' broke every page that relied on inline scripts
|
|
13
13
|
// or runtime eval (notably Playwright's waitForFunction in tests).
|
|
14
|
-
|
|
14
|
+
//
|
|
15
|
+
// helmet's default X-Frame-Options: SAMEORIGIN stays on, so only pages on
|
|
16
|
+
// the pad's own origin can embed it. Set settings.ep_helmet.frameguard to
|
|
17
|
+
// false to allow embedding from other origins.
|
|
18
|
+
const frameguard = settings.ep_helmet && settings.ep_helmet.frameguard;
|
|
19
|
+
app.app.use(helmet({
|
|
20
|
+
contentSecurityPolicy: false,
|
|
21
|
+
...(frameguard === false ? {xFrameOptions: false} : {}),
|
|
22
|
+
}));
|
|
15
23
|
|
|
16
24
|
if (settings.ep_helmet) {
|
|
17
25
|
console.debug('Using config from Helmet. ', settings.ep_helmet);
|
|
@@ -54,8 +62,8 @@ exports.expressConfigure = (hookName, app, cb) => {
|
|
|
54
62
|
}
|
|
55
63
|
|
|
56
64
|
// Frameguard is useful for x-frame-origin
|
|
57
|
-
if (
|
|
58
|
-
app.app.use(helmet.frameguard(
|
|
65
|
+
if (frameguard) {
|
|
66
|
+
app.app.use(helmet.frameguard(frameguard));
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
cb();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "Adds Security headers to Etherpad Express responses, including CSP(content security policy), and x-frame-origin, useful for if you embed Etherpad in an iFrame",
|
|
3
3
|
"name": "ep_helmet",
|
|
4
|
-
"version": "11.0.
|
|
4
|
+
"version": "11.0.32",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "John McLear",
|
|
7
7
|
"email": "john@mclear.co.uk"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"url": "https://etherpad.org/"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"eslint": "^
|
|
27
|
-
"eslint-config-etherpad": "^5.0.
|
|
26
|
+
"eslint": "^9.39.5",
|
|
27
|
+
"eslint-config-etherpad": "^5.0.4",
|
|
28
28
|
"typescript": "~6.0.3"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|