Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffd9327e3e | ||
|
|
40b81a5dc8 |
@@ -14,13 +14,19 @@ function send_security_headers(): void {
|
|||||||
|
|
||||||
// ── Origin verification ───────────────────────────────────────────────────────
|
// ── Origin verification ───────────────────────────────────────────────────────
|
||||||
function verify_origin(): void {
|
function verify_origin(): void {
|
||||||
$allowed = [
|
|
||||||
'https://xmrpay.link',
|
|
||||||
'http://mc6wfeaqc7oijgdcudrr5zsotmwok3jzk3tu2uezzyjisn7nzzjjizyd.onion',
|
|
||||||
];
|
|
||||||
$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
|
$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
|
||||||
// Allow same-origin (no Origin header from direct same-origin requests)
|
// Allow same-origin (no Origin header from direct same-origin requests)
|
||||||
if ($origin === '') return;
|
if ($origin === '') return;
|
||||||
|
|
||||||
|
// Dynamically allow the host this instance runs on
|
||||||
|
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||||
|
$self_origin = $scheme . '://' . ($_SERVER['HTTP_HOST'] ?? '');
|
||||||
|
|
||||||
|
$allowed = [
|
||||||
|
$self_origin,
|
||||||
|
'https://xmrpay.link',
|
||||||
|
'http://mc6wfeaqc7oijgdcudrr5zsotmwok3jzk3tu2uezzyjisn7nzzjjizyd.onion',
|
||||||
|
];
|
||||||
if (!in_array($origin, $allowed, true)) {
|
if (!in_array($origin, $allowed, true)) {
|
||||||
http_response_code(403);
|
http_response_code(403);
|
||||||
echo json_encode(['error' => 'Origin not allowed']);
|
echo json_encode(['error' => 'Origin not allowed']);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ set -e
|
|||||||
DOMAIN="${1:-}"
|
DOMAIN="${1:-}"
|
||||||
INSTALL_DIR="/opt/xmrpay"
|
INSTALL_DIR="/opt/xmrpay"
|
||||||
IMAGE="schmidt1024/xmrpay:latest"
|
IMAGE="schmidt1024/xmrpay:latest"
|
||||||
COMPOSE_URL="https://raw.githubusercontent.com/schmidt1024/xmrpay.link/master/docker-compose.yml"
|
COMPOSE_URL="https://raw.githubusercontent.com/schmidt1024/xmrpay/master/docker-compose.yml"
|
||||||
|
|
||||||
# ── Helpers ───────────────────────────────────────────────────────────────────
|
# ── Helpers ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user