From 3e2fd5d620097233ac74f03b8e57993768365c6e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 22 Nov 2025 22:43:08 +0000 Subject: [PATCH] Add XSS protection by escaping all HTML output Escape all parameter keys, captions, descriptions, option values, and defaults before inserting into HTML to prevent XSS vulnerabilities from XML configuration data. Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com> --- modules/billing/docs/rust/index.php | 49 +++++++++++++++++++++++++++++ tools/generate_game_docs.py | 20 ++++++++---- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/modules/billing/docs/rust/index.php b/modules/billing/docs/rust/index.php index 26816d53..bbd2d4e2 100644 --- a/modules/billing/docs/rust/index.php +++ b/modules/billing/docs/rust/index.php @@ -279,6 +279,55 @@ setadminpassword [password] +
Linux (start.sh):
+#!/bin/bash
+cd /path/to/server
+./server_executable [parameters] 2>&1 | tee server.log
+
+chmod +x start.sh
+./start.sh
+
+
+Windows (start.bat):
+@echo off
+cd /d "%~dp0"
+server_executable.exe [parameters]
+pause
+
+
+Linux (systemd):
+# Create service file: /etc/systemd/system/gameserver.service
+[Unit]
+Description=Rust Server
+After=network.target
+
+[Service]
+Type=simple
+User=gameserver
+WorkingDirectory=/home/gameserver/server
+ExecStart=/home/gameserver/server/start.sh
+Restart=on-failure
+RestartSec=10
+
+[Install]
+WantedBy=multi-user.target
+
+
+# Enable and start service
+sudo systemctl daemon-reload
+sudo systemctl enable gameserver
+sudo systemctl start gameserver
+sudo systemctl status gameserver
+
+
+# View recent log entries
tail -f server.log
diff --git a/tools/generate_game_docs.py b/tools/generate_game_docs.py
index 31d423d9..4427ac64 100755
--- a/tools/generate_game_docs.py
+++ b/tools/generate_game_docs.py
@@ -623,7 +623,7 @@ setadminpassword [password]
default = param.get('default')
options = param.get('options', [])
- # Clean HTML from description - unescape HTML entities and remove tags
+ # Clean HTML from description - unescape HTML entities, remove tags, then re-escape for output
if description:
description_clean = html.unescape(description)
# Remove HTML tags (simple but effective for our use case)
@@ -631,13 +631,18 @@ setadminpassword [password]
else:
description_clean = "No description available"
+ # Escape all values for HTML output to prevent XSS
+ param_key_escaped = html.escape(param_key, quote=True)
+ caption_escaped = html.escape(caption, quote=True)
+ description_escaped = html.escape(description_clean, quote=True)
+
php_doc += f'''
- {param_key}
- - {caption}
+ {param_key_escaped}
+ - {caption_escaped}
- {description_clean}
+ {description_escaped}
'''
if param_type == 'select' and options:
@@ -645,12 +650,15 @@ setadminpassword [password]
'''
for opt in options:
- php_doc += f''' {opt['value']} - {opt['text']} \n'''
+ opt_value_escaped = html.escape(opt['value'], quote=True)
+ opt_text_escaped = html.escape(opt['text'], quote=True)
+ php_doc += f''' {opt_value_escaped} - {opt_text_escaped} \n'''
php_doc += '''
'''
if default:
- php_doc += f''' Default: {default}
+ default_escaped = html.escape(str(default), quote=True)
+ php_doc += f''' Default: {default_escaped}
'''
php_doc += '''