connect-link ("Połącz z IWSN") is a panel action: only from the site's own origin (adminSameOrigin), like connect and disconnect

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 23:00:52 +01:00
co-authored by Claude Opus 5.5
parent 9ca563e2af
commit be30812423
4 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -422,7 +422,7 @@ Routes (all four need the `admin` role: not logged in → 401, other role → 40
| `GET /api/iapl/mail-relay/status` | the transport and the stored state; `?refresh=1` asks the service |
| `POST /api/iapl/mail-relay/connect` | enrol now; with `{ token }` store a token issued by hand — only with `accessKeyField: true`, otherwise `403` |
| `POST /api/iapl/mail-relay/disconnect` | give the token up |
| `POST /api/iapl/mail-relay/connect-link` | "Połącz z IWSN": asks the service for the confirmation link (`POST /v1/connect`, enrolling first when there is no token) and answers it as `connectUrl` + `expiresAt`, `Cache-Control: no-store`; nothing is stored. Absent with `connectButton: false` (`RELAY_CONNECT_LINK_PATH`) |
| `POST /api/iapl/mail-relay/connect-link` | "Połącz z IWSN": asks the service for the confirmation link (`POST /v1/connect`, enrolling first when there is no token) and answers it as `connectUrl` + `expiresAt`, `Cache-Control: no-store`; nothing is stored. Admin only, from the site's own origin (`adminSameOrigin`). Absent with `connectButton: false` (`RELAY_CONNECT_LINK_PATH`) |
| `POST /api/iapl/mail-relay/confirm` | **public** — the service's call-back. `404` and no change unless the site itself started an enrolment in the last 5 minutes; **refused** calls are rate-limited (10 a minute per address, `mail.relay.confirmRateLimit`) — a call that carries the nonce is never turned away by the limit, so junk from the same address cannot keep the site from enrolling |
These are the first routes under `/api/iapl/`; the others stay under `/api/ipal/` until 2.0. The confirm path is
+2 -1
View File
@@ -435,7 +435,8 @@ addition to real safeguards, not a replacement for them.
## Panel actions only from the site's own origin (`adminSameOrigin`, 1.17.2)
The plugin's panel actions act with the panel's login cookie and read their body whatever its `Content-Type`
says: `POST /api/iapl/mail-relay/connect` and `/disconnect` (the mail service), `/api/ipal/test-email`,
says: `POST /api/iapl/mail-relay/connect`, `/connect-link` ("Połącz z IWSN", 1.18.0) and `/disconnect` (the mail
service), `/api/ipal/test-email`,
`/api/ipal/cookie-scan`, `/api/ipal/cookie-approval`, `/api/ipal/cookie-crawl`. A `text/plain` POST needs no CORS
preflight, a page on a sibling subdomain is "same site" (the browser sends the `SameSite=Lax` cookie), and
Payload's own CSRF list is empty unless `serverURL` or `csrf` is set. So before 1.17.2 such a page could make a