Keep HTTP admin and cabinet sessions by not requiring Secure cookies or Origin CSRF.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alexey Novikov
2026-09-17 01:13:19 +03:00
co-authored by Cursor
parent 4dbfe782f5
commit ab92f39915
9 changed files with 20 additions and 9 deletions
+11
View File
@@ -2,6 +2,16 @@
Формат основан на [Keep a Changelog](https://keepachangelog.com/ru/1.1.0/), версии — [SemVer](https://semver.org/lang/ru/). Формат основан на [Keep a Changelog](https://keepachangelog.com/ru/1.1.0/), версии — [SemVer](https://semver.org/lang/ru/).
## [1.0.8] — 2026-09-17
### CMS
- Исправлена сессия входа в админку по HTTP: cookie больше не отбрасывается из‑за Origin/CSRF
### Сайт
- Cookie входа в личный кабинет сохраняется на HTTP без флага Secure
## [1.0.7] — 2026-09-17 ## [1.0.7] — 2026-09-17
### CMS ### CMS
@@ -70,6 +80,7 @@
- Docker Compose для локальной БД - Docker Compose для локальной БД
- Секреты и логины в git не входят - Секреты и логины в git не входят
[1.0.8]: https://git.myunion.pro/Alex/Moniki_uslugi/src/tag/v1.0.8
[1.0.7]: https://git.myunion.pro/Alex/Moniki_uslugi/src/tag/v1.0.7 [1.0.7]: https://git.myunion.pro/Alex/Moniki_uslugi/src/tag/v1.0.7
[1.0.6]: https://git.myunion.pro/Alex/Moniki_uslugi/src/tag/v1.0.6 [1.0.6]: https://git.myunion.pro/Alex/Moniki_uslugi/src/tag/v1.0.6
[1.0.5]: https://git.myunion.pro/Alex/Moniki_uslugi/src/tag/v1.0.5 [1.0.5]: https://git.myunion.pro/Alex/Moniki_uslugi/src/tag/v1.0.5
+1 -1
View File
@@ -4,7 +4,7 @@
Репозиторий: [Moniki_uslugi](https://git.myunion.pro/Alex/Moniki_uslugi) на [git.myunion.pro](https://git.myunion.pro/). Репозиторий: [Moniki_uslugi](https://git.myunion.pro/Alex/Moniki_uslugi) на [git.myunion.pro](https://git.myunion.pro/).
Текущая версия: **v1.0.7** (см. [CHANGELOG.md](CHANGELOG.md)). Текущая версия: **v1.0.8** (см. [CHANGELOG.md](CHANGELOG.md)).
## Что внутри ## Что внутри
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@moniki/cms", "name": "@moniki/cms",
"version": "1.0.7", "version": "1.0.8",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
+1 -2
View File
@@ -8,8 +8,7 @@ export const Users: CollectionConfig = {
tokenExpiration: 60 * 60 * 24 * 7, tokenExpiration: 60 * 60 * 24 * 7,
cookies: { cookies: {
sameSite: 'Lax', sameSite: 'Lax',
// HTTP admin (IP:3001) cannot store Secure cookies; enable only on HTTPS. secure: false,
secure: (process.env.NEXT_PUBLIC_SERVER_URL || '').startsWith('https://'),
}, },
}, },
admin: { admin: {
+2 -1
View File
@@ -114,7 +114,8 @@ export default buildConfig({
}), }),
sharp, sharp,
cors: allowedOrigins, cors: allowedOrigins,
csrf: allowedOrigins, // Empty list: do not drop the session cookie when Origin is missing or atypical (HTTP IP:port admin).
csrf: [],
localization: { localization: {
locales: [ locales: [
{ code: 'ru', label: 'Русский' }, { code: 'ru', label: 'Русский' },
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@moniki/web", "name": "@moniki/web",
"version": "1.0.7", "version": "1.0.8",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 3000", "dev": "next dev -p 3000",
+1 -1
View File
@@ -19,7 +19,7 @@ export async function POST(request: Request) {
httpOnly: true, httpOnly: true,
sameSite: "lax", sameSite: "lax",
path: "/", path: "/",
secure: process.env.NODE_ENV === "production", secure: false,
maxAge: 60 * 60 * 24 * 7, maxAge: 60 * 60 * 24 * 7,
}); });
return response; return response;
+1 -1
View File
@@ -28,7 +28,7 @@ export async function POST(request: Request) {
httpOnly: true, httpOnly: true,
sameSite: "lax", sameSite: "lax",
path: "/", path: "/",
secure: process.env.NODE_ENV === "production", secure: false,
maxAge: 60 * 60 * 24 * 7, maxAge: 60 * 60 * 24 * 7,
}); });
return response; return response;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "moniki-platnye-uslugi", "name": "moniki-platnye-uslugi",
"version": "1.0.7", "version": "1.0.8",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "pnpm -r --parallel dev", "dev": "pnpm -r --parallel dev",