chore(backend): save remaining API and deployment changes
Expose frozen factual review policy, update API descriptions and Swagger settings, and adjust local deployment and embedding connectivity. Include the requested extraction candidates and review-policy regression coverage. Validation: 31 OCR policy tests passed; staged diff whitespace checks passed.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Deployment configuration, independent of runtime limits and embedding profiles."""
|
||||
import ipaddress
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
from urllib.parse import urlsplit
|
||||
@@ -63,8 +64,18 @@ class VoiceSettings(BaseSettings):
|
||||
|
||||
@model_validator(mode='after')
|
||||
def cookie_policy(self):
|
||||
if not self.cookie_secure and any(urlsplit(o).hostname not in ('localhost', '127.0.0.1', '::1') for o in self.trusted_origins):
|
||||
raise ValueError('Insecure cookies require loopback-only development origins')
|
||||
for o in self.trusted_origins:
|
||||
h = urlsplit(o).hostname
|
||||
if not self.cookie_secure:
|
||||
is_local = h in ('localhost', '127.0.0.1', '::1')
|
||||
if not is_local and h:
|
||||
try:
|
||||
ip = ipaddress.ip_address(h)
|
||||
is_local = ip.is_loopback or ip.is_private
|
||||
except (ValueError, TypeError):
|
||||
is_local = False
|
||||
if not is_local:
|
||||
raise ValueError('Insecure cookies require loopback-only development origins')
|
||||
return self
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user