Repository navigation
Fix/1.8.0 check - #23
Merged
Merged
Conversation
added 30 commits
November 22, 2026 17:04
has_any_users() answered False on any database error and the dashboard cached that as 'no accounts' for the life of the worker: a dashboard that started before Postgres accepted connections served every anonymous request as root admin, also after Postgres was back. The answer is now True, False or unknown. While unknown, logins stay required and the question is repeated (at most every 5 s) until the database answers; the start-up bootstrap that was skipped (users table, admin from .env) runs first, so a first start that raced Postgres does not conclude there are no accounts.
The VM list took a VM's node (and name, tag, VLAN) from the first vm_metrics series in the range. Node is a tag, so a VM that live-migrated inside the range has a series per node, and the lowest node won for as long as the old series stayed in range: on a cluster where VMs move, 'group by node' showed the newest node empty or missing. A VM is now described as of its newest sample (vm_rows.py) and its history is one series, oldest first. The allocated-vCPU figure on the node cards had the same cause and counted a migrated VM on every node it ran on in the last hour: only a VM's newest inventory row counts, and only while the VM still reports.
A prune folds the oldest delta into the base (qemu-img commit) and rebases the next delta onto it. Both files change, but the manifests kept the checksums taken when the points were written: after the first prune every verification reported 'checksum differs' for the base and the next point, and a restore with verification (the default) refused the chain with 'chain integrity check failed, nothing restored'. The data was intact. run_prune now hashes the files it rewrote once the chain has its final shape and writes the new checksums into the two manifests. A chain pruned by an older proxy heals on its next prune, which commits into every base file again.
… (proxy 0.6.4) File-level recovery opened what a symbolic link pointed at with the kernel's resolver, and the proxy's root is the root: a link in the guest to /proc/self/environ, to the proxy's TLS key or to its mount directory (every tenant's images) was browsable and downloadable by anyone who may browse that VM's backups. Ordinary guests showed the same fault harmlessly: /var/run and /var/lock of a restore point listed the proxy's own /run. Links are now resolved inside the filesystem they are on, as the guest would: a relative target from the link's directory, an absolute target from that filesystem's root, '..' never above it. Links that stay inside the guest therefore work (they were 404 before); links are left out of zip downloads.
On an install whose database was created by initdb the dashboard's runner starts with nothing recorded and applies every file again. 021 then recreated the unique index on folder names that 044 drops, and failed on the two nodes named 'Default' that 044 seeds. The runner stops at the first failure and retries it forever: no later migration was ever applied, and every in-app update aborted at its migration step. Installs upgraded from before 1.3.0 were not affected (021 was recorded before 044 existed), which is why it went unseen. The index is gone from 021 (044 dropped it anyway). An install that is already stuck passes on the next retry once it has this file. 020 had the same pattern with the install-wide cluster-name index that 051 replaces; on a stuck install that brought install-wide cluster names back. A test refuses a migration that creates an index a later one drops.
The registry's bookkeeping functions (mark_seen, set_active_host, upsert_nodes, record_tasks, settle_stale_tasks, mark_error) promise never to break a poll loop, but opened their connection outside the try. With Postgres unreachable the collector's worker raised in its poll, then again in its own error handler (mark_error), and the thread ended. The main loop only started a worker for a cluster it had none for, so that cluster got no metrics until the container was restarted: an 80-second outage did this to both real clusters in the lab. The connection is now opened inside the try in all six, and the collector starts a worker again when it finds one that is no longer alive (as the balancer already did).
Edits staged in a settings form were only cleared after a successful Apply of their group. Flip 'Dry run' off on cluster A without applying, switch to cluster B: B's form showed its own values and no unsaved badge, but the next Apply of that group on B also sent DRY_RUN=false, so B went live with a value its form never showed. The same held between a cluster and the defaults, and for the Foresight settings. A settings form that is rendered again now drops the edits staged on the previous one.
…the selected cluster Six Foresight calls used a bare fetch without ?cluster=: the report PDF, the VM list and the simulation of What-If, saving the Foresight settings, saving the report branding and 'Run analysis now'. The server then takes the first cluster the user may see. With cluster B selected the settings form showed B's values and Apply wrote them to A; the report and the simulation were A's. They go through _withCluster() like every other data call.
The assignment, invitation and group-member routes asked for users.manage 'anywhere' and then only checked that the giver holds the role's permissions on the scope. Someone who is Admin at customer A and a Viewer at customer B holds Viewer's permissions at B, so they could assign or invite people as Viewer at B, a tenant whose people are not theirs to manage. grant_check now also requires the managing permission on the scope itself: users.manage for assignments, invitations and copied VM access, groups.manage when the access comes with a group. Invitations are re-checked with the same rule when they are accepted.
…stack test_integration_stack.py hardcoded http://localhost:5000, so it could not run from the test container next to the stack (test_integration_rbac.py already reads HCM_BASE), and two of its tests used no fixture and failed, instead of being skipped, when nothing was listening.
The stopped VMs are added to the list from the inventory, in a helper that returned early when no VM had performance samples. On a cluster with nothing running (a passive DR cluster, or a new one) the list was therefore empty and no VM could be opened or started from it.
A cluster's or tree node's colour was stored as sent and written into style attributes on every viewer's page: 'red;background:url(//x)' made each browser fetch //x, and the two places that print a cluster's colour did not escape it at all, so markup in it was script, for anyone who may edit a cluster. A colour is now '#rrggbb' or nothing, checked where it is stored (cluster create and update, folder and tree-node create and update), and the page ignores a stored value that is not one. Updating a cluster skipped what creating one checks: an empty name, a 300-character name and an empty address (https:///rest/v1) were stored. Create and update now refuse them (400).
…stgres CI installed only tests/requirements.txt, so every test that imports aiohttp, PIL or markdown skipped itself (the console tests and the manual rendering, 49 in all), and the qcow2 delta tests skipped for want of qemu-img. Both are now installed. A new job does what a fresh install does: apply postgres/init/*.sql in order (as the postgres image's initdb does), then run the dashboard's migration runner over the same files twice. On 1.8.0's files it fails on 021 exactly as fresh installs did; on these it applies 54 files and then none.
The advanced installer opened with a module screen ('sections that don't apply will be
skipped'). Unticking Backup or Foresight left their sections out of .env, tokens included, but
there are no compose profiles any more: the containers start anyway, and an empty
BACKUP_API_TOKEN, PROXY_API_TOKEN or SENTINEL_API_TOKEN means no authentication on a published
port. The screen no longer decides anything, so it is gone: advanced mode configures every
module, as easy mode already did.
InfluxDB (8086), the Foresight API (8081) and the backup API (8082) were published on every interface. The docs told admins to block them in a firewall, which ufw cannot do: Docker's published ports bypass it. With a .env still holding CHANGE_ME tokens, or a token left empty, that is an open API on the network. The dashboard reaches all three over the compose network. They are now published on HCM_INTERNAL_BIND, 127.0.0.1 by default (template, installer, README and manual explain when to change it: a Grafana on another machine). PROXY_API_URL, set in the compose file but read by nothing, is gone. SECURITY.md's link to the hardening checklist no longer 404s.
…on-cluster hosts Following the README literally left SC_REPO_PATH=/opt/hypercore-manager while the clone was elsewhere. Docker then mounted an empty directory as /repo: no version in the footer, an update check that said 'not a git repository', no migrations on later updates, and no proxy image for deployments. The README and the manual's by-hand steps now set it to the checkout's path. Also: macOS's AirPlay Receiver holds port 5000; the proxy container has nothing to do on a host that is not a VM on a cluster; docker-compose-v2 is an Ubuntu package; the manual update path in the README is the tag merge the updater uses, not git pull; the console service is in the manual's service table and restore recipe; the air-gap tarball has the product's name; the empty Related Projects table is gone.
The bug report template asked for a Compose profile (there are none); the .env template and the installer sent admins to 'Settings → Users' and 'Settings -> Clusters', both gone since 1.4.0 (it is Settings → Access, clusters under its Tenants tab); the admin guide and the backup chapter spoke of a sidebar where 1.8.0 has the cluster switcher; the InfluxDB init script credited an init sidecar that no longer exists with setting the primary retention (the collector does); and the resource list at the top of the compose file named other limits than the file sets.
… 2.0 LICENSE, NOTICE and the README named Scale Computing as the copyright holder of a project that states it is not a Scale Computing product and lives on its author's own repository. The copyright line now names William David van Collenburg; the licence stays the Apache License 2.0, its terms unchanged (checked word for word against a reference copy). The branding test checks the new line and that the old one is gone from all three files.
…d with Only top-level Python packages were pinned, and every in-app update is a rebuild: a release built later resolved new transitive versions (Werkzeug and Jinja2 under Flask, numpy and cmdstanpy under prophet, aiohttp's dependencies). The base images followed whatever Debian release python:3.x-slim pointed at, which renames apt packages between releases. Each service now installs with -c constraints.txt, a pip freeze of its working image, and the Python bases name Debian trixie (the proxy already named bookworm). The dashboard's vendor downloads (Chart.js, fonts, noVNC) use curl -f, so a CDN error page fails the build instead of shipping as chart.js, and run before the application files are copied, so the layer is reused from one release to the next instead of fetched on every update. All images were rebuilt from scratch and hold exactly the frozen versions.
…API (proxy 0.6.5) Werkzeug wraps the listening socket with the handshake on accept, so the TLS handshake ran in its single accept loop. One TCP connection that opened and stayed silent (no token needed) held that loop: /health and every other route timed out for as long as it was open. The server is now built with make_server(threaded=True) without ssl_context and the listening socket is wrapped with do_handshake_on_connect=False; the request handler does the handshake in the request's own thread, and every socket operation of a request (the handshake included) has a 300 s timeout, so a silent connection does not hold its thread forever either.
…g the base manifest
run_prune saved chain.json only at the end. A crash (restart, share dropped) after nxt's
directory was removed left chain.json naming it; the retry read its missing manifest as {}
and wrote that over the base manifest. The point then 'verified OK' with no files and could
not be staged or restored.
Each dropped point now leaves a state a retry continues from: the base manifest is replaced
first, chain.json is saved with the new shape next, nxt's directory goes last. A retry that
finds the base manifest already holding nxt's point (an attempt that stopped before
chain.json said so, also the state an older proxy's crash leaves) only finishes the
bookkeeping and re-hashes the base and the rebased point. A file that an earlier attempt
already moved into the base is not moved again, and a point without a readable manifest
stops the prune instead of being written over the base as {}.
… by the next verify Proxy 0.6.3 re-hashes the files a prune rewrites, but chains pruned before it still carry stale sha256 in two manifests: the base (its file was committed into; its manifest has the 'committed from ... on ...' note) and the point after it (rebased). They healed only on their next prune, which may never come; until then every verification reports 'checksum differs' and a verified restore refuses the chain although the data is intact. run_prune now marks the base manifest with checksums_after_commit once its checksums are taken after the commit. The verify job, meeting a base with the 'committed from' note but without that mark, re-hashes the files of the base and of the point after it, writes them with healed_at (and the mark on the base, written last) and then verifies as usual; the result lists the healed points under 'healed'. This trusts the current file contents of exactly those two points, once: the checksums an old prune left there can not tell damage from the prune's own rewrite. A base with the mark is never re-hashed again, so later damage is reported as before; points further down the chain are never touched. A prune that stopped after writing the base manifest but before its final re-hash also leaves a base without the mark, and is healed the same way.
…m it The idle sweeper unmounted a point mount 30 minutes after last_used, and last_used was only set when a download started: a zip, ISO or file download that streamed longer than that was cut off without an error (live: 1 of 6 files in a valid zip). DELETE /mounts/<id> during a download did the same. Every download (file, zip, ISO) now counts itself on the mount for as long as it streams, and touches the mount when it ends. The idle sweep skips a mount with a running download; DELETE answers 409 and the sweep unmounts that mount as soon as its last download has ended. The proxy's own shutdown still unmounts everything.
… not the whole file iter_zip added each file with zf.write(), which returns only after the whole file has been compressed into the stream buffer; the buffer was drained after that. A file's compressed form therefore sat in memory in full (measured: 96 MiB held for a 96 MiB file), and a 20 GiB file OOM-kills the proxy. Each entry is now written through zf.open(zinfo, 'w') in 1 MiB pieces and the buffer is drained after every piece. The entry keeps what zf.write() gave it (name, time, mode, deflate); its size comes from stat (the point is mounted read-only), so zipfile still picks zip64 exactly where it is needed rather than forcing it on every small entry.
The single-file and zip downloads put the raw name into Content-Disposition. An HTTP header is Latin-1, so a name such as 'Rapport – Q3.docx' or 'prijs €.txt' killed the response. The header now carries an ASCII fallback (accents folded, quotes and control characters replaced) plus filename*=UTF-8'' with the name percent-encoded (RFC 6266), which browsers use in preference. The backup service passes the header through unchanged.
… jobs are forgotten Finished jobs were never removed from Engine.jobs, and each kept its full request, the target's password included, for the life of the container. Their json files under <data_dir>/jobs grew by one per job forever. The module docstring said a restarted proxy answers for finished jobs from those files; nothing ever read them. A job now drops its request when it ends. Only the newest 300 finished jobs stay in memory and on disk; older ones are removed from both as new jobs finish, and the files earlier container lives left behind are trimmed to the same number at start. The docstring says what is true: a restarted proxy does not know earlier jobs.
…pped is reported cancelled
A cancel was not looked at before a job started, prune, flatten, delete_chain and sweep never
looked at it at all, and a job that ran to the end after a cancel was reported 'cancelled'
(live: a delete_chain cancelled while queued deleted the chain and ended 'cancelled' with
result {'removed': True}). A runner that did stop on a cancel was reported 'failed'.
A job cancelled while queued now ends 'cancelled' without running. A job that completes is
'done' whatever came in meanwhile; a job is 'cancelled' only when its runner stopped on the
cancel. Prune looks at it between dropped points (the chain is consistent there; the
checksums of what was dropped are still taken), flatten between devices, and a netcheck that
stopped waiting early without an answer counts as stopped. delete_chain and sweep are short
and are honoured before they start.
…ssing unseen
qemu-nbd writes with --cache=unsafe: it never flushes, and the `sync` after the disconnect
reports no errors. A write error at writeback (share full, connection dropped) could go
unseen, and the job would report done with a checksum read back from the page cache rather
than from what reached the share.
Once the nbd server of a writable attach is gone, the image file is opened and fsynced; an
error fails the image ('writing <file> to the target failed: ...'). The first fsync after a
writeback error returns it, whoever opened the file. Read-only attaches are not touched.
…o the pool Three paths returned a slot to the pool while its device could still be connected: `qemu-nbd -c` timing out (only the parent is killed, the server may have connected), the device not coming up after the connect, and a disconnect that raised before or at `qemu-nbd -d` (a hanging `udevadm settle` raised its timeout before -d ran). The next image then got a slot that was still attached to the previous one. A connect that fails for any reason other than the probe now runs a non-strict disconnect before the slot is released. A strict disconnect after use that fails retires the slot until the proxy restarts, like a slot that refuses I/O. The flush and udev settle before the disconnect are best effort and can no longer skip it.
…ddress again The probe address was added with `ip addr add`, which fails with "Address already assigned" when an interrupted check (container stopped mid-check) left it on the test NIC; every later network check of that proxy failed until its VM rebooted. The link-up and the address were also set before the try, so a failure there skipped the cleanup. The address is set with `ip addr replace` (same noprefixroute; checked with iproute2: twice in a row succeeds where add fails), and the link-up and address are inside the try, so the finally always removes the address and takes the NIC down again.
added 28 commits
November 22, 2026 18:37
The password step and the two-factor step took unlimited guesses: after one correct password, session['otp_pending'] accepted every code sent to it, and a code stayed valid for its whole window, also a second time. Failures are now counted in the database (migration 057, config.login_failures): the dashboard runs four workers, and the session is a cookie the client could send again to reset a counter kept in it. After 10 failures for what was typed, or 30 from one client address, in 15 minutes the login page refuses (also the right password) until the window passes; counting what was typed keeps an unknown address indistinguishable from a known one. Five wrong codes after a password step drop the pending login (password again), counted since that step's time so an older cookie brings no extra guesses; the code must follow the password within five minutes. The time step of the last accepted TOTP code is stored (config.users.otp_last_counter) and a code from the same or an older step is refused, atomically across workers. A complete sign-in clears the account's earlier typos. Two new login texts in en/nl/de/fr. The client address is the connecting peer: the leftmost X-Forwarded-For entry is whatever the client sent and let anyone pick the address the limit counts. HCM_TRUSTED_PROXIES (the number of reverse proxies in front of HCM) selects the entry a proxy of ours wrote. tests/conftest.py gains a fixture that imports app.py for route tests with Flask's test client.
…s it Setting another account's password, resetting its two-factor, changing its login address, enabling or disabling it and deleting it only asked for users.manage on the whole installation. A custom root role with users.manage but not Admin (a helpdesk role) could therefore set a root Admin's password, reset their 2FA and sign in as them. These actions now need a root Admin, or a user manager who holds every permission the target holds at every scope the target holds it (rbac.may_grant applied to each of the target's grants; a legacy role='admin' row counts as Admin). Otherwise 403. Disabling an account skipped the guard that keeps at least one enabled root Admin (deleting the account and removing its assignment had it): the last root Admin could be disabled. update_user now runs _guard_last_root_admin before it disables anyone.
There was no defence against cross-site request forgery: the session cookie had no SameSite, CORS(app) answered every origin, and get_json(force=True) parsed a text/plain form body as JSON. A page on any site could make a signed-in admin's browser (Firefox and Safari send the cookie on a cross-site POST) apply an update, run a plan, revoke a guest grant, remove a user, reset someone's 2FA, register a cluster or apply tunables to every cluster; /logout was a GET. - The session cookie is SameSite=Lax, and Secure when the request came over HTTPS (directly or with X-Forwarded-Proto from a TLS proxy; HCM_SESSION_COOKIE_SECURE=1 forces it), so plain-HTTP installs keep working. - CORS(app) is gone: every page that calls the API is served by it, the guest pages included. - A before_request check refuses POST/PUT/PATCH/DELETE whose Origin (or, without one, Referer) names another site. Allowed: the request's Host, a reverse proxy's X-Forwarded-Host (neither can be set by another origin without a preflight) and the addresses in Settings -> Mail; a request with neither header (scripts, the services) passes. /internal/ is left out. - get_json(force=True) is gone from the dashboard except in the POST /api/config handler, which another change rewrites; it is behind the origin check. - /logout takes POST as well as GET; the invitation's "switch account" form posts.
PUT /api/folders/<id> accepted any share_id from whoever held backup.targets.manage on that folder, which an Admin of the customer above it does, while the targets themselves are listed to root target managers only. A customer admin could point their folder's backups at another tenant's target by trying ids. Setting or clearing share_id now needs backup.targets.manage on the whole installation (and, as before, tree.manage on the folder); the rail's can_assign_share follows the same rule. The id must be a number (400), and one that names no target answers 404 instead of a 500 from the foreign key.
…ser's to choose The backup forward passed the body of POST/PUT plans and of adding a VM to a schedule through as sent. vm_name is the export prefix and the key a plan's pruning deletes by: a user allowed one VM could create a plan for it named after another VM, and that plan's pruning then deleted the other VM's exports. path_uri_base, smb_user, smb_password and prune_path were accepted from anyone with backup.schedule: in a folder without a target they could send a VM's export to an SMB server of their own. The forward now sets vm_name from the cluster's VM index for the vm_uuid that was checked (404 when the VM is not on the cluster; an update without a vm_uuid keeps the plan's own name), and drops the four destination keys unless the user holds backup.targets.manage on the whole installation. The same applies to adding a VM to a test plan.
…again Changing a cluster's host (or user name) kept the stored HyperCore password. Someone allowed to edit the entry (a folder admin with cluster.manage) could point it at a server of their own; POST /api/clusters/<id>/test, and every service's next login, then sent them the credential. cluster_registry.update() now refuses a host or user name that differs from the stored one unless a new password comes in the same call (ValueError, 400 from the dashboard). Saving the edit form with the address unchanged needs no password, as before. Copies synced.
_tag_guard took the tags of the last op that had a `tags` key, while the backup service clones
from ops[0] and ignores the rest. {"kind": "clone", "ops": [{"name": "c1", "tags": "<tag that
grants access>"}, {"tags": ""}]} passed the guard and created a clone carrying a tag that hands
out access, without users.manage on the cluster.
The guard now reads ops[0] for a clone, and the forward refuses a clone or snapshot change set
with more than one op (400), so what is checked is all the service acts on. ops that is not a
list is refused as well.
…eeds the password
A session is a signed cookie and _login_problem only checked that its user existed, was enabled
and kept its username: a stolen cookie kept working for 31 days through a password change, a
reset by mail, an administrator setting the password and a 2FA reset. GET
/api/users/me/otp/setup returned the stored TOTP secret, URI and QR code also with 2FA already
on, and without the password, so a stolen session could read the codes' secret or enrol its own
authenticator.
- Migration 058 adds config.users.session_gen. A session stores the generation it signed in
with (login, invitation sign-in); every request compares it with the account's (user_state
is read per request anyway). Changing one's password, a reset by mail, an administrator
setting the password, 2FA turned on, off or reset, and an address change raise it: the
account's other sessions end at their next request, the one that made the change goes on.
Cookies from before the upgrade carry no generation and match the default 0.
- OTP setup answers 409 while 2FA is on and wants the current password:
POST /api/users/me/otp/setup {"password": ...} (GET without it is refused with
password_required), response unchanged.
- An open console re-checks every two minutes that the login is still live and still holds
vm.console on its VM, and closes (4403) when not; the ticket's VM is remembered in the
session when the ticket is issued.
… one A non-GET request on a cluster-scoped route that named no ?cluster= acted on the user's first visible cluster. The backup forward (/api/backup/<sub>, declared @requires(None)) and the console forward went further: a write naming a cluster the user may not use there fell back to their first cluster instead of being refused, so a stale or wrong selection changed another cluster. _write_cluster_problem() now answers for every write: no ?cluster= is 400 'cluster is required', a cluster that is not a uuid or not one the user may use for the route's permission is 403. It runs in the route decorator for scope 'cluster', in the console forward, and in the backup forward for every target except 'root' and 'any' (targets, the proxy image), where no cluster is involved; a resource addressed by its id ('owner') is checked on its own cluster and needs no ?cluster=, but may not name a wrong one. Reads keep falling back to the first cluster, so the UI still recovers after a cluster was taken away. Every non-GET call of the frontend to these routes goes through _withCluster()/_exCall() and sends ?cluster=.
…s stay stopped - Apply wrote current_version=<new>, update_available=False right after moving the checkout. A build that failed or timed out, a failed migration or a failed restart container then left "Up to date" on show with the old containers running and the Apply button gone. The new version is now published only once the restart container is spawned; every failure after the move records apply_failed, keeps the old version and update_available, and so offers Apply again (a build timeout is reported instead of escaping as an exception). - A `git stash pop` with conflicts went on to build images with conflict markers in them. It now stops before the build and says how to resolve it (the changes stay in git stash list). - The restart step ran `up -d --no-deps` for every non-database service, starting modules the administrator had stopped (the manual says `docker compose stop balancer`; a stopped balancer with DRY_RUN false resumed migrating). It now recreates the services that are running plus those that have no container yet (new in the release). - `docker run --env-file .env` for the restart and self-heal containers parsed .env unlike Compose (quotes, $$). Dropped: Compose in the helper reads /repo/.env itself. - The state is one /tmp file shared by four workers: writes now go through a temporary file and os.replace under an flock, Apply's check-and-set is done under that lock, and an apply marked in progress by an earlier life of the container, a worker that is gone, or more than two hours ago is cleared at start and no longer answers 409 for good. /api/update/status reports apply_failed.
…t from The updater reported the checkout's VERSION at its last check as installed: a stack showed 1.7.4 on a 1.8.0 checkout for a day, and a checkout moved to a release whose build failed showed the new number while the old containers ran (and then hid Apply). The dashboard image now carries VERSION (COPY VERSION . in dashboard/Dockerfile; .dockerignore does not exclude it), and the check reports it as current_version, falling back to the checkout for an image from before. The checkout's version is reported as checkout_version; when it is ahead of the image, Apply is offered (rebuild_needed) even without a newer release tag, and applying builds and restarts what the checkout holds.
Accounts above a reader (an MSP's staff, the installation's admins) are never named to them elsewhere, but three places still did: - /api/cluster-alerts showed muted_by for every mute; - the backup forward passed created_by, requested_by, updated_by and muted_by through in the backup service's answers (VM changes, restores, file restores, test plans, notices); - /api/access/overview listed roles defined above the reader with their node_id, created_by, copied_from and in_use. These names now go through access_db.hide_names (guests stay named, as before); roles above the reader keep their name and permissions but lose where, by whom, from what and how often, and carry defined_above. `effective_base` (the target path a plan or a known import resolves to) was missing from _BACKUP_SENSITIVE_KEYS: plans and import/known showed it to users without backup.targets.manage.
…n is set /internal/proxy-image and /internal/proxy-image/version accepted every request when BACKUP_API_TOKEN was empty, on the dashboard's public port, and compared the Authorization header with ==. Without a token configured they now answer 401 to everyone (the backup service sends the same token, so an install that pushes proxy images has one), and the header is compared with hmac.compare_digest.
…atement The wrong-code counter and sessions_used of a guest grant were read, increased in Python and written back. Requests answered at the same moment by the four workers could each count from the same old value: more code guesses than MAX_FAILED before the lock, more sessions than max_sessions. Both are now one UPDATE ... SET x = x + 1 ... RETURNING: the code counter sets 'locked' in the same statement when it reaches MAX_FAILED, and a session is claimed only while sessions_used < max_sessions (a ticket issued for a request that loses that race is not handed out).
Tree node, role and group names and the guest fields go into mail subjects and texts. A line break in one made EmailMessage raise ValueError; deliver() only caught MailError, so the exception escaped although deliver() promises never to raise, and the verification mail pass aborted a batch it had already claimed (its rows were never mailed). - Node (MSP, customer, folder), role and group names, and the guest's name, company and label, refuse line breaks and other control characters where they are entered (400). - guest_company is capped at 120 characters, like the guest's name. - deliver() reports any exception while making or sending a mail as a failed delivery (audited as mail.failed), as it does for SMTP problems.
… addresses Both pages say the same words whether or not an address has an account, but not in the same time: forgot-password answered only after the SMTP conversation (seconds) for an address with an account, and the sign-in checked a password hash only for an existing account (scrypt, tens of milliseconds), so the timing told which addresses have one. The reset mail now goes out in a background thread (the token is still created before the answer, so the hourly limit counts it), and verify_password checks against a dummy hash when the account does not exist; the login route always makes that one check. The integration tests wait for the reset mail instead of expecting it before the answer.
…e audit The access audit had no row for several actions an administrator needs to trace. They now write one (best effort: a failed audit write is logged, never fails the action): - login, login.failed (what was typed, never the password), login.locked and login.otp_failed, each with the client address; - user.otp_enabled / user.otp_disabled for one's own two-factor; - cluster.register, cluster.edit (the fields changed, the old and new address; never the password), cluster.remove / cluster.purge, and cluster.move with the folders it left and entered; - folder.target when a folder's backup target is assigned or cleared; - tunables.foresight for the Foresight tunables; - install.update_apply with the versions. Rows sit at the cluster's or folder's tree node where there is one, so tenant auditors see their own. The client address is the connecting peer (see the sign-in limits change); the POST /api/config tunables are not audited here, that handler belongs to another change.
…ackup catalogue - A removed (not purged) cluster stayed in list_all(): /api/clusters and the tenant tree showed "X (removed ...)" with an Enable button. Enable set enabled=TRUE on a row with is_active=FALSE and no password, so every service tried an empty-password login on each poll, and removing it again appended a second "(removed ...)". list_all() now leaves removed clusters out (its callers are the cluster list, the tenant tree and list_enabled(); history keeps using the rows by id), and update() and the remove in delete() only touch rows with is_active = TRUE. update() returns how many rows it changed; the dashboard answers 404 for a removed cluster. - Purge deleted audit.recommendation_events before audit.action_log and audit.webhook_deliveries, which reference it: a 500 on a cluster with webhook rows. The children (also those pointing at this cluster's events) now go first. - Purge cascades to backup.chains and points: the catalogue was lost while the data stayed on the target. The dashboard refuses a purge with 409 while the cluster has backup chains, saying to delete them first or to remove without purging. Copies synced.
… every worker The dashboard started with the .env.template placeholder CHANGE_ME as HCM_SECRET_KEY (the key that encrypts the stored cluster passwords), as SC_DASHBOARD_SECRET_KEY (the key that signs every session: anyone could forge one) or as SC_DASHBOARD_PASSWORD (the first admin's password). It now refuses to start while any of them is CHANGE_ME, with one clear line on stderr and in the log saying which and how to generate a value. A blank SC_DASHBOARD_SECRET_KEY made each of the four gunicorn workers generate its own random key, so a login worked only on the worker that issued the cookie and failed now and then. The key is now derived from HCM_SECRET_KEY (HMAC, purpose 'dashboard-session'), the same in every worker and across restarts; only with neither set does it fall back to a random key, with a warning.
/api/cluster-alerts/history took 16 s on one real cluster and answered 503 after 28 s on another. It ran three sequential Flux queries whose first filter after the measurement was contains(value: r.severity, set: [...]), which InfluxDB does not push down to storage: the _field filter, unique() and last() then ran in the Flux engine over every field of every condition series, against the client's default 10 s timeout per query. The queries now filter measurement, then _field, then severity as an `or` chain of equality tests (all pushed down); the set and clear times come from one query (unique() works per series, and the field is part of the series); last() reads the last day only, which holds the latest point of every condition still reported (the Collector writes every condition on every poll); and this route's client has a 60 s timeout. The episodes are built as before.
…bers are a 400 - /api/vsds attributed a virtual disk to the node of the first series seen, the same mistake vm_rows.py fixed for VMs on this branch: a disk whose VM migrated inside the range stayed on its old node. vm_rows.fold_vsds() describes each disk as of its newest sample and merges its per-node series into one history, oldest first. - A VM's current CPU (last() over 5 minutes) came from whichever series came first; after a migration in the last 5 minutes that could be the old node's value. The newest last() now counts (vm_rows.newest_per). - A bad ?limit= or ?horizon= on /api/sentinel/forecasts, rightsizing, resize, exhaustion and cluster-health answered 500 (the int() sat inside the handler's catch-all). They are parsed first and answer 400.
… form post
The server now hands out the authenticator secret only for POST {password} (a borrowed session
could otherwise enrol its own app) and accepts sign-out as a POST (a link can be fired from
another site). The account page still fetched the secret with a GET, so 'Set up two-factor'
showed the server's refusal: it now asks for the current password first, in all four
languages. The sign-out link in the user menu and on the account card are buttons in a
form that posts to /logout, styled as the links they replace.
…kie settings The dashboard now reads HCM_TRUSTED_PROXIES (how many reverse proxies stand in front of it, so the audit log and the sign-in attempt limit see the client's address and not the proxy's) and HCM_SESSION_COOKIE_SECURE, but nothing passed them into the container. Compose, the .env template and the installer now carry both, defaulting to the direct-connection, plain HTTP behaviour. The template and installer no longer say a blank SC_DASHBOARD_SECRET_KEY gives a random key per start: it is derived from HCM_SECRET_KEY, and CHANGE_ME stops the dashboard.
The address in links is required for mailed links; purge is refused while backup chains exist and an address change asks for the cluster's password; two-factor setup asks for the current password and credential changes sign out other sessions, sign-in attempts are limited; behind a reverse proxy the Host header must stay as sent and HCM_TRUSTED_PROXIES / HCM_SESSION_COOKIE_ SECURE apply; a late guest shutdown still gets its changes and a missed scheduled change fails; export folders carry the VM's uuid and a folder's directory on its target no longer follows its name.
Proxy 0.6.5 re-takes, once, the checksums a prune by an older proxy left stale and reports those points as 'healed'. The backup service's verify view kept only ok, failed, bytes and duration, so a chain that failed yesterday and passed today gave no hint why. The view now carries 'healed' and the service logs the points.
…ing the tunables first An App Manager reaches Settings for guest console requests but may not read the tunables (cluster.view). loadSettings fetched /api/config before deciding which sub-tabs to show and gave up with 'settings failed' on its 403, so the Access tab with the guest console never appeared. The sub-tabs are now decided first and the tunables are only read for whoever gets that tab.
CI failed at collection on tests/test_sentinel_loops.py: sentinel.py's 'import log' found console/log.py (an earlier test had put console/ first on sys.path), which needs python-json-logger, and CI does not install it. The test now imports sentinel.py with sentinel/ first and the clashing name cleared. Behind that error a clean CI install also lacked the real modules that the new dashboard, collector and Foresight tests load (flask-sock, simple-websocket, influxdb-client, psycopg2-binary): conftest stubs them only when missing, and the stubs lack what those tests use. The local test image had them all, so every local run passed. They are now in tests/requirements.txt at the services' versions; a clean python:3.12 install of that file runs the suite green (1056 passed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
A maintenance release from a full review of 1.8.0: a code review of every module plus end-to-end tests on a local stack and a lab cluster. It fixes security holes, backup-safety bugs and robustness problems. There are no new features. There is one commit per fix, each with a test where one was possible.
Upgrade notes (read before applying)
HCM_SECRET_KEY,SC_DASHBOARD_SECRET_KEYorSC_DASHBOARD_PASSWORDstill readsCHANGE_ME. Check.envfirst.HCM_INTERNAL_BINDchanges that, for example for a Grafana on another machine.Hostheader as sent: changes whoseOriginis not the dashboard's own address are refused.HCM_TRUSTED_PROXIES=1.HCM_SESSION_COOKIE_SECURE=true.BACKUP_API_TOKENset. Deployed proxies update themselves to 0.6.5.Highlights
Security
Backup and restore
Clusterbalancer, collector, Foresight
Dashboard
Installation and maintenance
SC_REPO_PATHwhen installing by hand.The full list is in
docs/CHANGELOG.mdunder 1.8.1.Testing
Known limitations