QA용 보안 쿠키 설정을 분리한다
CI / Frontend - type-check & test (push) Canceled after 0s

운영에서는 Secure 쿠키를 강제한다.`nHTTP로 실행하는 격리 QA에서만 환경 변수로 해제할 수 있게 했다.
This commit is contained in:
이창현
2026-10-03 10:15:17 +09:00
parent a41da4029f
commit 3541ca454f
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
import hashlib import hashlib
import hmac import hmac
import json import json
import os
import re import re
import secrets import secrets
from pathlib import Path from pathlib import Path
@@ -261,12 +262,13 @@ def login(payload: AuthPayload, response: Response):
def _set_cookie(response: Response, token: str) -> None: def _set_cookie(response: Response, token: str) -> None:
secure_cookie = os.environ.get("SESSION_COOKIE_SECURE", "1").strip().lower() not in {"0", "false", "no"}
response.set_cookie( response.set_cookie(
COOKIE_NAME, COOKIE_NAME,
token, token,
max_age=30 * 24 * 60 * 60, max_age=30 * 24 * 60 * 60,
httponly=True, httponly=True,
secure=True, secure=secure_cookie,
samesite="lax", samesite="lax",
path="/", path="/",
) )
+1
View File
@@ -31,6 +31,7 @@ services:
- BOOTSTRAP_ADMIN_USERNAME=syskiller - BOOTSTRAP_ADMIN_USERNAME=syskiller
- BOOTSTRAP_ADMIN_DISPLAY_NAME=관리자 - BOOTSTRAP_ADMIN_DISPLAY_NAME=관리자
- BOOTSTRAP_ADMIN_PASSWORD_FILE=/run/secrets/library_admin_password - BOOTSTRAP_ADMIN_PASSWORD_FILE=/run/secrets/library_admin_password
- SESSION_COOKIE_SECURE=1
volumes: volumes:
# Mount audiveris.jar from host (optional - PDF import is disabled if absent) # Mount audiveris.jar from host (optional - PDF import is disabled if absent)
- ./backend/bin:/app/bin:ro - ./backend/bin:/app/bin:ro