Pilot customers had no way to reset a forgotten password, and the 7 October meeting asked for two things that only needed the client's inputs to go live. Password recovery: "Esqueci minha senha" in Minha conta sends a link that works once, for an hour (/conta/redefinir#token, in the fragment so it never reaches a server or a Referer). Only the token's hash is stored, the e-mail's text is erased once sent, the answer never says whether an account exists, and a reset signs out every other session. Limited per address and source. Team alerts: Kanban users who tick "Receber alertas por e-mail" in Usuários get one when an order is paid, a cart waits for review, or a payment needs attention. Messages are queued in the transaction that caused them and sent by the worker with retries (app/mail.py). Integrações shows an E-mail row with "Enviar teste". E-mail is off in production (MAIL_ADAPTER=off; recovery keeps offering WhatsApp) until the client's SMTP account exists; then it is only settings (docs/PORTAINER.md). The local stack keeps messages in the database and log. Files opened by hand: a finished sheet in CDR, AI, PSD or TIFF (or with a length the customer typed) pays the full price plus MANUAL_FILE_EXTRA_CENTS per metre, to steer customers to PNG as the meeting asked. It is 0 until Marcus gives the amount. The Site shows it before checkout, the server charges it, Tiny gets it in the unit price, and the Kanban says it. Tested: new tests/mail_test (reset flow, SMTP delivery against a local SMTP server, retry, who gets alerts), pricing unit tests, and the browser test now checks the Site total equals the server's, run with the charge at 0 and at R$ 5,00. The full CI suite passes in a CI-style stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
3.5 KiB
Plaintext
66 lines
3.5 KiB
Plaintext
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=20r/s;
|
|
server {
|
|
listen 8080;
|
|
server_name ${PUBLIC_HOST};
|
|
if ($host != ${PUBLIC_HOST}) { return 400; }
|
|
# Resolve through Docker's embedded DNS at request time. This prevents
|
|
# Nginx from exiting during a Swarm rollout when the API task is briefly
|
|
# unavailable or still creating its database schema.
|
|
resolver 127.0.0.11 ipv6=off valid=10s;
|
|
set $api_upstream api:8000;
|
|
|
|
# This gateway sits behind the host's reverse proxy, so $remote_addr is that
|
|
# proxy, not the customer. Recover the real address from the header it sets,
|
|
# and only when the connection comes from a private network: a request that
|
|
# reaches the published port directly from the internet is not trusted, so
|
|
# its X-Forwarded-For is ignored and $remote_addr stays the actual peer.
|
|
set_real_ip_from 10.0.0.0/8;
|
|
set_real_ip_from 172.16.0.0/12;
|
|
set_real_ip_from 192.168.0.0/16;
|
|
real_ip_header X-Forwarded-For;
|
|
real_ip_recursive on;
|
|
root /usr/share/nginx/html;
|
|
index ${WEB_INDEX};
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
add_header X-Content-Type-Options nosniff always;
|
|
add_header Referrer-Policy no-referrer always;
|
|
add_header X-Frame-Options DENY always;
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' @SCRIPT_HASHES@ ${PAYMENT_CSP_SOURCES}; script-src-attr 'none'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: blob: https://cdn.vnda.com.br ${PAYMENT_CSP_SOURCES}; connect-src 'self' ${S3_PUBLIC_ENDPOINT} https://cdn.vnda.com.br ${PAYMENT_CSP_SOURCES}; frame-src 'self' ${PAYMENT_CSP_SOURCES} ${PAYMENT_CHALLENGE_SOURCES}; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'; form-action 'self' ${PAYMENT_CHALLENGE_SOURCES}" always;
|
|
|
|
location = /health { access_log off; return 200 'ok'; }
|
|
location /api/ {
|
|
limit_req zone=api_limit burst=100 nodelay;
|
|
limit_req_status 429;
|
|
proxy_pass http://$api_upstream;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
# Overwrite, never append: $proxy_add_x_forwarded_for keeps any header the
|
|
# client sent, and the leftmost value would then be attacker-controlled.
|
|
# After real_ip above, $remote_addr is the customer even behind the proxy.
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_connect_timeout 5s;
|
|
proxy_read_timeout 30s;
|
|
client_max_body_size 2m;
|
|
}
|
|
# Always revalidate HTML/JS/CSS after a deployment. Without this, a browser
|
|
# can pair a new Kanban page with a cached older script after a rollout.
|
|
# The Site's product pages and cart are addresses of the same page (web/site-pages.js).
|
|
location ~ ^/(arquivo-por-metro|artes-avulsas|uv-arquivo-por-metro|uv-artes-avulsas|carrinho|pagamento|pagamento/pix)/?$ {
|
|
expires -1;
|
|
try_files /index.html =404;
|
|
}
|
|
# The customer's area: one page, which shows the right part for each address.
|
|
location ~ ^/conta(/(entrar|pedidos|dados|redefinir))?/?$ {
|
|
expires -1;
|
|
try_files /portal.html =404;
|
|
}
|
|
location / {
|
|
expires -1;
|
|
try_files $uri $uri/ =404;
|
|
}
|
|
}
|