Some checks failed
Backend Tests / pytest (Python 3.12) (push) Has been cancelled
Deploy to Production / backend-tests (push) Has been cancelled
Deploy to Production / frontend-build (push) Has been cancelled
Frontend Checks / Build & typecheck (push) Has been cancelled
SonarCloud / SonarCloud Analysis (push) Has been cancelled
Deploy to Production / Trigger production update (push) Has been cancelled
Security - Enforce guest ownership and server assignment across Proxmox endpoints (VM/LXC actions, firewall, backups, tasks, bulk operations, deploy, LXC/ISO creation, golden template) and WebSocket channels - Keep the panel's PVE root ticket server-side for consoles; single-use WebSocket tickets instead of the JWT in URLs; re-check access on open WebSocket bridges - Validate identifiers that reach Proxmox API paths and node shell commands; reject backup archives / foreign volumes in create requests - Close privilege escalation in user management, TOTP replay, reset-link poisoning, X-Forwarded-For spoofing, stored XSS (group icons, SVG logos) - SSH host key pinning (TOFU), encrypted 2FA seeds and notification secrets, password changes end other sessions, redact secrets in logs - Quotas count in-flight creations; 2FA failures count toward lockout Fixes - Consoles on non-default API ports, large App Store/script files, interrupted tasks after restart, impersonation lost on token refresh, HTTPExceptions swallowed into 500s, WebSocket client reconnects Performance and process - Fewer DB writes and queries on hot paths, lazy-loaded locales and heavy pages, off-loop blocking work, indexes (migrations 44-46) - Deploy waits for backend tests and frontend build; frontend checks workflow; API bound to loopback without the SSL profile
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
"""write_file_commands: payloads must fit one shell argument (MAX_ARG_STRLEN)."""
|
|
import base64
|
|
import re
|
|
|
|
from app.ssh_client import write_file_commands
|
|
|
|
_MAX_ARG_STRLEN = 128 * 1024
|
|
_CHUNK_RE = re.compile(r"printf '%s' '([A-Za-z0-9+/=]*)' \| base64 -d (>>?) /tmp/x$")
|
|
|
|
|
|
def _replay(cmds):
|
|
out = b""
|
|
for cmd in cmds:
|
|
m = _CHUNK_RE.search(cmd)
|
|
assert m, cmd
|
|
chunk = base64.b64decode(m.group(1))
|
|
out = chunk if m.group(2) == ">" else out + chunk
|
|
return out
|
|
|
|
|
|
def test_large_payload_is_split_below_argument_limit():
|
|
data = bytes(range(256)) * 2048 # 512 KiB, the App Store per-file limit
|
|
cmds = write_file_commands("/tmp/x", data)
|
|
|
|
assert len(cmds) > 1
|
|
assert all(len(c.encode()) < _MAX_ARG_STRLEN for c in cmds)
|
|
assert _replay(cmds) == data
|
|
|
|
|
|
def test_small_and_empty_payloads():
|
|
assert _replay(write_file_commands("/tmp/x", b"hello")) == b"hello"
|
|
assert len(write_file_commands("/tmp/x", b"hello")) == 1
|
|
assert write_file_commands("/tmp/x", b"") == ["umask 077 && : > /tmp/x"]
|