1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 11:16:47 +00:00
webvirtcloud/computes
catborise 17016e90cd fix(computes): a compute's hostname and login cannot inject a connection URI or ssh option
A compute's hostname and login go unquoted into the libvirt connection URI
(qemu+ssh://login@host/system, qemu+tcp://host/system, qemu+tls://...) and,
for an SSH compute, into the ssh command line of the DRBD status view. They
were barely validated: validate_hostname used re.match with a negated class,
so it caught only a leading special character, and login was never checked.
A hostname like "192.0.2.1/system?command=/path" injected a libvirt URI
parameter (verified: connecting ran the named command through the ssh
wrapper), and TLS/SSH parameters such as no_verify, pkipath, socket or
netcat could be added the same way; a login like "-oProxyCommand=..." became
an ssh option. The DRF ComputeSerializer applied neither check, and
validate_name tested a string literal instead of its argument, so it never
raised.

validate_hostname now accepts only an IPv4 address or a host name with
fullmatch (no scheme, port, path, query, whitespace or IPv6 literal; IPv6 is
left out until the URI building brackets it). validate_login accepts an empty
value (TCP falls back to the server's authentication, the socket transport
ignores the login) or a plain name with no leading "-". Both sit on the
Compute model fields, so the forms and the DRF serializer (which copies model
validators onto its fields) reject the values; a migration records the
metadata. validate_name checks its argument. drbd_status validates the login
and hostname before building login@host and ends ssh option parsing with
"--"; an existing or bypassed bad row is skipped rather than run.

Tests: hostname/login validators accept real values and reject URI and
option injection; the SSH form and the serializer (create, and an empty TCP
login) enforce them; drbd_status skips an injecting target. Checked the real
test computes still validate. The new tests fail on the previous code.
2026-10-06 22:10:19 +03:00
..
api feat(computes): a compute names the address migrations reach it on 2026-10-06 15:05:40 +03:00
migrations fix(computes): a compute's hostname and login cannot inject a connection URI or ssh option 2026-10-06 22:10:19 +03:00
templates fix(instances): every VM state has a label and the actions it allows 2026-10-05 19:34:30 +03:00
__init__.py Initial commit 2015-02-27 10:53:51 +02:00
apps.py fix: track migrations; installs apply them instead of generating them 2026-10-04 01:08:11 +03:00
forms.py feat(computes): a compute names the address migrations reach it on 2026-10-06 15:05:40 +03:00
models.py fix(computes): a compute's hostname and login cannot inject a connection URI or ssh option 2026-10-06 22:10:19 +03:00
test_api_security.py fix(instances): disk edits keep their XML; changes lock per VM 2026-10-04 01:08:11 +03:00
test_compute_password.py fix(computes): editing a compute keeps its password unless a new one is given 2026-10-06 13:58:55 +03:00
test_migration_address.py fix(instances): a finished migration is recorded, and a stale request does not migrate 2026-10-06 15:52:32 +03:00
test_operation_locks.py fix(instances): disk edits keep their XML; changes lock per VM 2026-10-04 01:08:11 +03:00
test_overview_status.py fix(computes): overview state comes from the connection 2026-10-05 11:10:01 +03:00
test_ownership.py fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
test_quota_down_host.py fix(instances): the quota counts every VM and refuses what it cannot verify 2026-10-05 12:26:57 +03:00
test_reconciliation.py fix(computes): instance sync asks libvirt outside the DB transaction 2026-10-05 10:47:35 +03:00
test_validators.py fix(computes): a compute's hostname and login cannot inject a connection URI or ssh option 2026-10-06 22:10:19 +03:00
tests.py fix(computes): a compute's hostname and login cannot inject a connection URI or ssh option 2026-10-06 22:10:19 +03:00
urls.py chore: drop references to the local roadmap from code and tests 2026-10-04 11:09:25 +03:00
utils.py fix(computes): instance sync asks libvirt outside the DB transaction 2026-10-05 10:47:35 +03:00
validators.py fix(computes): a compute's hostname and login cannot inject a connection URI or ssh option 2026-10-06 22:10:19 +03:00
views.py fix(computes): overview state comes from the connection 2026-10-05 11:10:01 +03:00