feat: add runtime policy and observability
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
237899745
2026-07-25 20:00:11 +08:00
parent f3c7a77a37
commit 64b1169e8c
32 changed files with 1236 additions and 120 deletions

View File

@@ -7,7 +7,7 @@ DEBIAN_MIRROR=http://deb.debian.org/debian
CARGO_REGISTRY_MIRROR=
# Public listener and URL
IMAGEFORGE_BIND_ADDRESS=0.0.0.0
IMAGEFORGE_BIND_ADDRESS=127.0.0.1
IMAGEFORGE_PORT=8080
PUBLIC_BASE_URL=http://192.0.2.10:8080

View File

@@ -1,5 +1,3 @@
version: '3.8'
services:
postgres:
image: postgres:16-alpine
@@ -8,14 +6,14 @@ services:
POSTGRES_PASSWORD: devpassword
POSTGRES_DB: imageforge
ports:
- "5432:5432"
- "127.0.0.1:5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
ports:
- "6379:6379"
- "127.0.0.1:6379:6379"
volumes:
- redis_data:/data

View File

@@ -83,7 +83,7 @@ services:
MAIL_SMTP_PORT: "${MAIL_SMTP_PORT:-}"
MAIL_SMTP_ENCRYPTION: "${MAIL_SMTP_ENCRYPTION:-}"
ports:
- "${IMAGEFORGE_BIND_ADDRESS:-0.0.0.0}:${IMAGEFORGE_PORT:-8080}:8080"
- "${IMAGEFORGE_BIND_ADDRESS:-127.0.0.1}:${IMAGEFORGE_PORT:-8080}:8080"
volumes:
- uploads:/app/uploads
tmpfs:

View File

@@ -22,6 +22,12 @@ http {
listen 80;
server_name _;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'self'; form-action 'self'; img-src 'self' data: blob: https:; font-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self'; connect-src 'self' https:" always;
root /usr/share/nginx/html;
location /api/ {
@@ -44,6 +50,11 @@ http {
proxy_pass http://imageforge_api;
}
# Prometheus should scrape the API container directly on the private network.
location = /metrics {
return 404;
}
# SPA fallback
location / {
try_files $uri $uri/ /index.html;