Repository navigation
Owner-only forced domains, a domain limit, masked dump errors, per-client OAuth limit - #140
Merged
Merged
Conversation
A custom domain becomes active once its hostname resolves to this host.
force_active skips that check, and any member with the manage role could
set it: the hostname is then routed and has a certificate ordered with no
proof that it points here, it occupies a name that is unique across all
apps, and for a protected app the console's /auth/gate redirects a
logged-in user to it with a one-time code, which makes the console
redirect to a host of the member's choosing.
Changing force_active in PATCH /api/apps/{slug}/domains/{id} is now an
owner-only field, refused for members with 403 forbidden_role and
details.fields like the owner-only settings of an app. Sending the present
value is not a change, and the rest of the route (the primary flag) stays
at manage, as do adding, verifying and deleting. Ending the force is the
owner's too: a member who wants the hostname gone deletes the domain.
The domain list shows members who manage the app who has the switch
instead of the button.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
POST /api/apps/{slug}/domains had no limit. A member with the manage role
and a wildcard DNS record of their own could add verified hostnames
without end: Caddy orders a certificate for each from the ACME account
all apps share, whose new-order limits are per account, and every add or
removal reloads the whole Caddy configuration.
An app now holds at most 20 custom domains, pending ones included, which
is plenty for a personal host with a handful of apps. The number is the
constant store.MaxDomainsPerApp, checked in the same statement that
inserts the row so that concurrent requests cannot pass it. One more is
refused with 422 too_many_domains and details.limit, and the console says
how many an app can have and to delete one first.
Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
When a backup's dump hook fails, the tail of its standard error is kept in backup_run_targets and shown on the app's backups and overview tabs to everyone with the view role. The masker of the backup manager only knew the storage keys, and tools such as pg_dump print the connection string they failed with, so a database password in the app's variables could reach members who may not read the variables. The output of the dump command now passes through a masker that also knows the values of the app's variables: the saved ones and the ones in the live env file, exactly what the task logs hide. The backup package still knows nothing of the database or the master key: backup.App gains OutputMasker, a function the caller sets next to WithDumpService, and cmd/koroku fills it from the engine's task masker. It is asked for once per dump, so the values are those at the time the command runs. The dump taken before a database copy goes the same way. When the values cannot be loaded the dump still runs, since a backup is worth more than its error message, but nothing the command printed is kept: the message says so and carries the exit status only. Messages recorded by earlier runs are not rewritten; the tabs show the newest run of an app only. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
GET /auth/github/callback had one limit for everyone: ten code exchanges a minute, counted only for requests whose state cookie matches the state parameter. A client that sends a cookie and a matching parameter of its own (nothing checks that koroku issued the state) could still use up all ten every minute from one address and keep every real login failing. Exchanges are now counted per client address first, with the same ten a minute for each, and a request from an address over its own limit no longer counts against the total. The address is clientIP, which Caddy sets and a client cannot forge; an IPv6 /64 counts as one client, because one host can pick any address in it. The total stays as the bound on requests that carry the client secret to GitHub, raised to 60 a minute: one a second is still a small, fixed number, real use is a few logins a week, and it takes six addresses at their full allowance to use it up instead of one. A client with many addresses can still do that; this is not prevented. The per-address counters live in memory for one window and at most 1024 addresses are remembered. Past that a new address is refused, by which time the total is used up anyway. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Two properties of the design were not written down where an operator or a member's owner would look for them. Archived logs are not encrypted. The bucket holds restic/, which restic encrypts (the database, /etc/koroku with the keys, volumes, dumps), and logs/<slug>/..., which is gzip only: runtime logs, access logs and deployment logs of every app, handed to the browser as they are through presigned URLs. Whoever can read the bucket reads all of them. The architecture (10.1, 10.2), the storage step of SETUP and the secrets table of OPERATIONS now say so, and that runtime logs are archived as the app printed them. Deleting an app removes apps/<slug> only. Its local logs (14 days), its archived logs (until the lifecycle rule) and its restic snapshots (tagged app:<slug>, kept by the retention policy for months) stay, and since all of them are looked up by slug, an app created later under the same slug shows them to its own members: view reads the old logs, manage downloads the old dumps and restores the old volumes. The architecture described this for kept volumes only; it now covers logs and snapshots, USAGE has a section on deleting an app, and OPERATIONS lists what stays, where, and how to remove it by hand before reusing a name. The restic commands there were checked against a throwaway local repository: --tag app:<slug> selects the exact tag only. The deletion dialog gains one sentence saying that logs and backups stay under the name and will belong to an app created with it. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
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.
Summary
The remaining low-severity findings, one commit each.
force_activeanswers403 forbidden_role.422 too_many_domains). Each domain orders a certificate from the shared ACME account and each change reloads the whole Caddy configuration.pg_dumpprint connection strings when they fail.Screenshots
Test plan
go vet ./...,go vet -tags integration ./...,go test ./...pnpm lint,pnpm testTestForcingADomainActiveIsOwnerOnly, the domain limit in the store, the API and the SPA, masking with a fake runner whose stderr holds a variable's value, the callback limiter (per address, /64, total, memory bound)🤖 Generated with Claude Code