mirror of
https://github.com/Such-Software/xmrcheckout.git
synced 2026-12-01 12:14:11 +01:00
fix(nginx): refuse the admin API at the public edge
nginx proxied all of /api/ to the internet, including /api/admin, which returns every merchant's API key and webhook secret behind a single shared key. The only caller is the admin panel's server actions, so nginx now answers /api/admin with a 404 and those actions reach the API directly over the compose network through ADMIN_API_BASE_URL (default http://api:8000), falling back to API_BASE_URL for non-Docker installs.
This commit is contained in:
@@ -26,6 +26,15 @@ server {
|
||||
return 308 $scheme://$host$uri$is_args$args;
|
||||
}
|
||||
|
||||
# The admin API returns every merchant's API key and webhook secret. Only the
|
||||
# UI's server actions call it, over the compose network (ADMIN_API_BASE_URL),
|
||||
# so the public edge refuses it. ^~ keeps any later regex location from
|
||||
# claiming these paths, and nginx matches the normalized URI, so encoded or
|
||||
# dot-segment spellings land here too.
|
||||
location ^~ /api/admin {
|
||||
return 404;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
set $api_upstream "api";
|
||||
# No URI suffix: nginx preserves the complete /api/v1/... request path.
|
||||
|
||||
Reference in New Issue
Block a user