Skip to content

Commit c928bf2

Browse files
authored
Merge pull request #22 from ZeroHost-Code/beta
v1.0.5
2 parents 254931f + 4cf0342 commit c928bf2

16 files changed

Lines changed: 1962 additions & 246 deletions

File tree

.github/workflows/deploy-beta.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
with:
1414
host: ${{ secrets.SSH_HOST }}
1515
username: ${{ secrets.SSH_USER }}
16-
password: ${{ secrets.SSH_PASSWORD }}
16+
key: ${{ secrets.SSH_PRIVATE_KEY }}
1717
port: ${{ secrets.SSH_PORT || 22 }}
18+
host_key_checking: false
1819
script: |
1920
cd ${{ secrets.BETA_PATH }}
2021
cp .env /tmp/beta.env 2>/dev/null; cp port.txt /tmp/beta.port.txt 2>/dev/null

.github/workflows/deploy-main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ jobs:
1313
with:
1414
host: ${{ secrets.SSH_HOST }}
1515
username: ${{ secrets.SSH_USER }}
16-
password: ${{ secrets.SSH_PASSWORD }}
16+
key: ${{ secrets.SSH_PRIVATE_KEY }}
1717
port: ${{ secrets.SSH_PORT || 22 }}
18+
host_key_checking: false
1819
script: |
1920
cd ${{ secrets.MAIN_PATH }}
2021
cp .env /tmp/main.env 2>/dev/null; cp port.txt /tmp/main.port.txt 2>/dev/null

config/pyrodactyl.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const PTERO_URL = process.env.PTERO_URL || 'https://panel.zero-host.org';
22
export const PTERO_API_KEY = process.env.PTERO_API_KEY || '';
3-
export const PANEL_DB_NAME = (process.env.PANEL_DB_NAME || 'panel').replace(/[^a-zA-Z0-9_]/g, '');
3+
const _rawPanelDb = (process.env.PANEL_DB_NAME || 'panel').replace(/[^a-zA-Z0-9_]/g, '');
4+
export const PANEL_DB_NAME = '`' + _rawPanelDb + '`';
45

56
export const SERVER_LIMITS = {
67
memory: 512,

middleware/auth.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,17 @@ export function requireNotRestricted(req, res, next) {
7575
next();
7676
}
7777

78+
const ALLOWED_TABLES = new Set(['server_meta']);
79+
const ALLOWED_COLUMNS = new Set(['ptero_server_id', 'user_id', 'id']);
80+
7881
export function requireOwnership(table, column, paramName, idSource = 'params') {
7982
return async (req, res, next) => {
8083
try {
84+
if (!ALLOWED_TABLES.has(table) || !ALLOWED_COLUMNS.has(column)) {
85+
console.error(`Blocked ownership check on unauthorized table/column: ${table}.${column}`);
86+
return res.status(500).json({ error: 'Ownership verification failed' });
87+
}
88+
8189
const id = parseInt(idSource === 'params' ? req.params[paramName] : req.body[paramName], 10);
8290
if (isNaN(id)) {
8391
return res.status(400).json({ error: 'Invalid ID' });

0 commit comments

Comments
 (0)