Skip to content

fix: DO installer puts no admin password in user-data (#3799) - #3808

Merged
vybe merged 7 commits into
devfrom
feature/3799-do-userdata-shred
Oct 31, 2026
Merged

vybe merged 7 commits into
devfrom
feature/3799-do-userdata-shred

Conversation

@obasilakis

@obasilakis obasilakis commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • cloud-init keeps user-data for the droplet's life. It rewrites user-data.txt and user-data.txt.i on every boot (init.update()), pickles the datasource, including userdata_raw, into obj.pkl, and the DigitalOcean metadata service serves it. A shred on the droplet cannot remove a password from user-data.
  • trinity-do-create.sh no longer prompts for an admin password. Its user-data exports ADMIN_PASSWORD_SOURCE=browser, the path the DO 1-Click and Vultr already run. When the site answers, the installer prints the address with a prompt to open it now and create the admin at /setup.
  • The EXIT trap from the first version of this PR is removed.

Trade-off

A droplet from this installer is unclaimed until someone completes /setup, and the first visitor becomes admin. This is the same accepted window as the 1-Click and Vultr (docs/DEPLOYMENT.md → Security Recommendations). The installer is watching when the site comes up, so the operator is told to claim it at that moment.

Changes

  • scripts/deploy/trinity-do-create.sh: password prompt, umask 077 and the trap removed; ADMIN_PASSWORD_SOURCE=browser exported; final message tells the operator to create the admin.
  • tests/unit/test_2380_installer_portability.py: new test_no_admin_password_reaches_the_droplets_user_data (fails on the previous head); quoting tests now cover the image tag only; stdin fixtures drop the password answers.
  • Docs: digitalocean.md (password step removed, Step 4 is creating the admin, claim-window note, troubleshooting rows for the password prompts removed, "What the installer does" updated), single-server.md, deploying-trinity.md, FAQ (deployment, security, troubleshooting), setup.md, DEPLOYMENT.md, PROV-014, hosted-install.md.

Not in this PR

The 1-Click's optional #cloud-config write_files path (single-server.md → Claim the admin account) still puts an operator-chosen password in user-data, with the same obj.pkl and per-boot copies. That needs a separate decision (drop the option, or document it as persisting) and is tracked in #3942.

Test Plan

  • pytest unit/test_2380_installer_portability.py unit/test_2380_installer_release_pin.py -p no:randomly: 20 passed
  • New test red against b973c589b's installer, green on this head
  • Related unit subset (-k "2380 or docs or provision or firstboot or ent580 or 2281 or hosted"): 420 passed; one local-only failure (mkdocs-material version pin vs local install)
  • Manual: DO install, the printed address opens the Create your admin account form, grep -r ADMIN_PASSWORD= /var/lib/cloud finds nothing

Fixes #3799

🤖 Generated with Claude Code

)

The droplet's user-data carries ADMIN_PASSWORD, and cloud-init keeps
user-data.txt and the rendered script under /var/lib/cloud for the life
of the machine. The first-boot script now shreds and removes those
copies in an EXIT trap, on a successful or a failed install. start.sh
has already written the password to .env, and a reboot does not re-run
per-instance user-data.

Fixes #3799

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vybe

vybe commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

merge-train (2026-10-19): ejected after validation, rides the next train once fixed.

Two findings against cloud-init 24.4 (the Ubuntu 24.04 line), both verified from its source, not from the PR comment:

  1. /var/lib/cloud/instances/<id>/obj.pkl is a third on-disk copy and is not removed (scripts/deploy/trinity-do-create.sh:163). It is pickle.dumps(self.datasource); DataSourceDigitalOcean._get_data stores userdata_raw and the whole metadata_full (which carries user_data), and pickle stores str as raw UTF-8. The issue's own criterion, grep -r ADMIN_PASSWORD /var/lib/cloud finding nothing, fails on this head (Binary file obj.pkl matches). The test fixture (tests/unit/test_2380_installer_portability.py:255-258) seeds only user-data.txt, user-data.txt.i and scripts/part-001, which is why it stays green; adding an obj.pkl with the password bytes makes it red.

  2. The shred lasts until the first reboot. The comment at :159-162 ("a reboot does not re-run per-instance user-data") is true of execution, not storage. Every boot cloud-init init runs init.update() (cmd/main.py:589, unconditional) → _store_rawdata(self.datasource.get_userdata_raw(), "userdata") (stages.py:568-570), which rewrites user-data.txt and user-data.txt.i from the cached datasource. If obj.pkl is deleted too, DO's check_instance_id fails the cache check, cloud-init re-crawls 169.254.169.254/metadata/v1.json (which serves user_data for the droplet's life) and writes all three back. Only scripts/part-001 stays gone (PER_INSTANCE semaphore).

Ruling at Gate 1: add obj.pkl to the trap and the fixture, add a /var/lib/cloud/scripts/per-boot/ re-shred so the window is only during boot, and reword the comment (plus docs/user-docs/guides/deploying/digitalocean.md:160) to say the metadata service still serves the user-data to root on the host. Moving the DO installer off password-in-user-data the way Vultr (PROV-017) and AWS (PROV-018) already are is the 1.0.1 follow-up.

Everything else validated clean: Tier 1 green, the EXIT-trap test executes the real trap in bash and goes red on dev (2 failed), .env is 0600 before the write, shred -u with rm -rf fallback cannot change the exit status.

@vybe vybe added the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Oct 19, 2026
@obasilakis

Copy link
Copy Markdown
Contributor Author

@vybe both findings come from the password being in user-data at all, so I'd like to do the 1.0.1 follow-up here and drop the trap.

Plan for this PR:

  • trinity-do-create.sh no longer prompts for a password or exports ADMIN_PASSWORD; it exports ADMIN_PASSWORD_SOURCE=browser, the same path the DO 1-Click (no user-supplied password) and Vultr already run.
  • The EXIT trap and its test go. A new test asserts the generated user-data never contains ADMIN_PASSWORD.
  • docs/user-docs/guides/deploying/digitalocean.md: the password step becomes "open the URL and create the admin at /setup".
  • DigitalOcean installer puts the admin password in droplet user-data #3799 retitled and its expected outcome updated to match.

With nothing secret in user-data, obj.pkl, the per-boot rewrite and the metadata service all have nothing to leak, so no per-boot re-shred is needed.

Trade-off: a doc-script droplet is unclaimed until someone completes /setup, and the first visitor becomes admin. The 1-Click and Vultr installs carry the same window today.

If you'd rather keep an operator-chosen password on the doc installer, say so and I'll do the Gate 1 fixes (obj.pkl, per-boot re-shred, comment and doc wording) instead.

@AndriiPasternak31 AndriiPasternak31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with vybe's two findings and checked both against the cloud-init 24.4 source. obj.pkl still holds the full user-data. init.update() (stages.py:568) rewrites user-data.txt and user-data.txt.i on every boot, so the trap at trinity-do-create.sh:163 only holds until the first reboot. Adding an obj.pkl to the test fixture makes the test fail on this head. The leftover scan also needs read_bytes(), because a real pickle crashes read_text().

The 1-Click path in single-server.md:363 puts the password in cloud-config user-data too, and nothing scrubs it there.

Small correction to the PR description: a failing rm in the trap does change the exit status under set -e (0 becomes 1). That's fine, but it should say so.

I'm fine with your plan of ADMIN_PASSWORD_SOURCE=browser with no secret in user-data. It fixes all of the above at the source. Please cover the 1-Click write_files path as well, or open a follow-up issue for it, and update digitalocean.md:160. I'll re-review once it's pushed.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

✅ Nightly unit-suite clean when this PR is merged into dev, all 3 seeds (head_sha: 1bf8bdc9e0fe379d61dcaa8ae7a62195ee0bc2e8).

obasilakis and others added 2 commits October 23, 2026 22:15
cloud-init keeps user-data for the droplet's life: it rewrites
user-data.txt on every boot, pickles the datasource into obj.pkl, and the
metadata service serves it. No shred on the droplet can remove it.

trinity-do-create.sh no longer prompts for a password. Its user-data
exports ADMIN_PASSWORD_SOURCE=browser, the path the DO 1-Click and Vultr
already run, and the installer tells the operator to open the address and
create the admin at /setup. The EXIT trap and its test are removed; a new
test asserts the user-data carries no ADMIN_PASSWORD.

Docs: the DO guide, single-server, deploying-trinity, FAQ, setup,
DEPLOYMENT.md, PROV-014 and the hosted-install flow describe the
browser claim and its window.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot removed the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Oct 23, 2026
@obasilakis obasilakis changed the title fix: DO install removes cloud-init's copies of the admin password (#3799) fix: DO installer puts no admin password in user-data (#3799) Oct 23, 2026

@AndriiPasternak31 AndriiPasternak31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at c08f46a16.

The installer change is right. The generated user-data now carries only ADMIN_PASSWORD_SOURCE=browser and the tag (trinity-do-create.sh:121-141), and an ADMIN_PASSWORD in the operator's environment doesn't reach it. That path is the same one the 1-Click and Vultr run: start.sh:899-912 writes the blank password and the marker to .env, and /setup accepts browser (setup.py:248). So for this installer, obj.pkl, the per-boot rewrite and the metadata service have nothing to leak. The new test goes red when I put export ADMIN_PASSWORD='…' back into the heredoc. digitalocean.md:160 is fixed, and the trap exit-status point is moot now that the trap is gone.

Still open:

  1. 1-Click write_files. The description says it's tracked as a follow-up, but I can't find an issue. Please open it. single-server.md:369 still says "The file is shredded once the password has been read", which is the claim #3799 disproved: the password stays in user-data.txt, obj.pkl and the metadata service. The same option is still recommended at DEPLOYMENT.md:517, faq/security.md:101 and setup.md:63. One line at each saying it persists, plus a link to the issue, is enough here.
  2. #3799 itself. It still has the shred title and expected outcome, and its validation says GET /api/setup/status still reports admin set, which is false after this PR. Please retitle and update it, as in your 10-20 plan, before Fixes #3799 closes it.
  3. Two docs still say the installer puts a password in user-data: faq/deployment-and-upgrades.md:19 ("with the admin password chosen up front") and PROV-013 in requirements/infrastructure.md:177 ("a script install's user-data holds the admin password").
  4. The accepted-risk text is still marketplace-only. setup.py:39 says "That acceptance covers the marketplace only, so nothing else may become claimable by it", and DEPLOYMENT.md:502 names only 1-Click droplets. do-script is claimable now, so both should say so.
  5. The claim warning only prints on the happy path. If the IP cert isn't issued, Caddy falls back to its internal CA and Trinity still starts, so /setup is open. But the 15-minute timeout message (trinity-do-create.sh:195-207) and the "no public IP yet" exit (:164) say nothing about claiming. The same two lines there would close that.

Optional: asserting set(interpolated) == {"TRINITY_IMAGE_TAG_Q"} in test_every_single_quoted_interpolation_in_the_user_data_is_quoted would catch a password written under any other name. The new test stays green if it's written to /etc/trinity/admin-password. Also FYI, #3824 still specs TRINITY_ADMIN_PASSWORD into user-data for unattended runs, which would undo this.

I need 1–4 before I approve. 5 is small and I'd like it in the same push.

@obasilakis

Copy link
Copy Markdown
Contributor Author

@AndriiPasternak31 pushed (c08f46a16), ready for re-review.

@AndriiPasternak31

Copy link
Copy Markdown
Contributor

@obasilakis thanks. #3942 and the #3799 update cover the issue side of points 1 and 2. The head is still c08f46a16, the commit my 10-24 review was on, so these aren't in the branch yet:

  1. single-server.md:369 still says the file is shredded. DEPLOYMENT.md:517, faq/security.md:101 and setup.md:63 each need one line saying the password persists in user-data, with a link to DO 1-Click: an operator password supplied through cloud-config write_files stays in droplet user-data #3942.
  2. faq/deployment-and-upgrades.md:19 and PROV-013 (requirements/infrastructure.md:177).
  3. The marketplace-only accepted-risk text at setup.py:39 and DEPLOYMENT.md:502.
  4. The claim warning on the timeout and no-public-IP exits of trinity-do-create.sh.

Did a push not go through?

@dolho dolho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/validate-pr — Lane B (installer script + docs)

The installer change itself is right, and I agree with Andrii's 10-24 assessment: the user-data now carries only ADMIN_PASSWORD_SOURCE=browser and the tag, so obj.pkl, the per-boot rewrite and the metadata service have nothing to leak. #3942 and the #3799 rewrite cover the issue side.

But the head is still c08f46a16, the commit Andrii re-reviewed, so the doc and script follow-ups he asked for are not on the branch. I checked each at that head:

This PR requires the following changes before merge:

  • docs/user-docs/guides/deploying/single-server.md:369 still says "The file is shredded once the password has been read" — the claim #3799 disproved. Same option, no persistence warning, at DEPLOYMENT.md:517, faq/security.md:101, getting-started/setup.md:63: one line each saying the password persists in user-data, linking #3942.
  • faq/deployment-and-upgrades.md:19 still says the script installs "with the admin password chosen up front".
  • PROV-013 in requirements/infrastructure.md:177 still says "a script install's user-data holds the admin password".
  • src/backend/routers/setup.py:39 (and DEPLOYMENT.md:502) still say the claim-window acceptance "covers the marketplace only, so nothing else may become claimable by it". After this PR the DO script install is claimable too, so that text now contradicts the code path it documents.
  • scripts/deploy/trinity-do-create.sh:164: the no-public-IP exit (and the timeout exit) leave a created, unclaimed droplet without telling the operator to claim it at /setup.
Other checks
Commits / issue conventional; Fixes #3799 ✅
Secrets / host paths none ✅
Test test_no_admin_password_reaches_the_droplets_user_data goes red with the password back in the heredoc (Andrii verified; I did not re-run) ✅

It looks like a push may not have gone through. Once these land I'm happy to re-review.

REQUEST CHANGES.

🤖 Reviewed with Claude Code

@dolho dolho added the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Oct 27, 2026
obasilakis and others added 2 commits October 29, 2026 08:40
… on every exit (#3799)

- single-server.md: drop the shred claim; a cloud-config write_files password
  stays in the droplet's user-data (#3942). Same line in DEPLOYMENT.md,
  faq/security.md and getting-started/setup.md.
- faq/deployment-and-upgrades.md, PROV-013: the script install sets the admin
  password in the browser at /setup.
- setup.py docstring, DEPLOYMENT.md: the browser-claim acceptance covers every
  ADMIN_PASSWORD_SOURCE=browser install, including do-script.
- trinity-do-create.sh: claim_warning() prints on the no-public-IP and
  15-minute-timeout exits as well as the ready path.
- test_2380: user-data interpolates only TRINITY_IMAGE_TAG_Q; the no-IP exit
  prints the claim warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot removed the status-needs-fix PR has an unaddressed review/validation finding; cleared by the author's next push (#2815) label Oct 29, 2026
@obasilakis

Copy link
Copy Markdown
Contributor Author

Pushed a62211589 (on top of a merge of current dev). Per item from the 10-24 and 10-27 reviews:

  1. 1-Click write_files: follow-up is DO 1-Click: an operator password supplied through cloud-config write_files stays in droplet user-data #3942. single-server.md:369 no longer says the file is shredded. It now says the password stays in the droplet's user-data for the droplet's life and links DO 1-Click: an operator password supplied through cloud-config write_files stays in droplet user-data #3942. The same one-line note with the DO 1-Click: an operator password supplied through cloud-config write_files stays in droplet user-data #3942 link is at DEPLOYMENT.md:523-525, faq/security.md:101 and getting-started/setup.md:63.
  2. DigitalOcean installer puts the admin password in droplet user-data #3799: the issue title and body already describe the browser-claim fix. There is no shred wording left, and the validation step is the /setup form.
  3. faq/deployment-and-upgrades.md:19: the script install sets the admin password in the browser at /setup when the script prints the address. PROV-013 (requirements/infrastructure.md:177): the link-local DROP rationale now cites the 1-Click write_files password (DO 1-Click: an operator password supplied through cloud-config write_files stays in droplet user-data #3942) and no longer says a script install puts a password in user-data.
  4. setup.py:39-46 docstring: the acceptance covers every install whose provisioning exports ADMIN_PASSWORD_SOURCE=browser. That is the DO 1-Click, the Vultr Marketplace server and the DO script install (do-script). This matches the check at setup.py:248, which refuses only unset. DEPLOYMENT.md:502-508 names the same three paths.
  5. trinity-do-create.sh:166: the claim lines moved into claim_warning(). The ready path (:198), the no-public-IP exit (:177) and the 15-minute timeout exit (:223) all print them.

Optional: test_every_single_quoted_interpolation_in_the_user_data_is_quoted now asserts set(interpolated) == {"TRINITY_IMAGE_TAG_Q"} (test_2380_installer_portability.py:88). test_no_admin_password_reaches_the_droplets_user_data asserted that the word "password" never appears in the output. The claim warning says "email and password", so that check now looks for the old prompt ("choose a password"), and the test also asserts the no-IP exit prints the claim warning (:237). I checked that it fails with the warning removed from that exit.

Results:

  • pytest tests/unit/test_2380_installer_portability.py tests/unit/test_ent580_marketplace_admin_claim.py tests/unit/test_3237_system_agent_after_setup.py -p no:randomly: 69 passed.
  • bash -n and shellcheck on trinity-do-create.sh: clean.

🤖 Generated with Claude Code

@obasilakis
obasilakis requested a review from dolho October 29, 2026 07:43

@dolho dolho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at a62211589.

Every item from my 10-27 review and Andrii's 10-24 review is fixed on this head, and the optional exact-set assertion is in. The installer change is still right: the generated user-data carries only ADMIN_PASSWORD_SOURCE=browser and the quoted tag (scripts/deploy/trinity-do-create.sh:121-140), and the droplet clones v1.0.0, whose start.sh already honours browser (ensure_admin_password, v1.0.0:scripts/deploy/start.sh:879). The tests that matter go red under mutation. I found three small things below. None blocks the merge.

Status of my last review (10-27)

  • single-server.md:369 shred claim, plus the persistence note at DEPLOYMENT.md:517, faq/security.md:101, setup.md:63: fixed. single-server.md:369 now reads "The password stays in the droplet's user-data for the droplet's life: cloud-init keeps it on disk and the metadata service serves it ([#3942]…)". The same line with the #3942 link is at docs/DEPLOYMENT.md:524-525, docs/user-docs/faq/security.md:101 and docs/user-docs/getting-started/setup.md:63. #3942 exists and is open. No "shred" wording is left in those five files.
  • faq/deployment-and-upgrades.md:19 "admin password chosen up front": fixed. It now says "you set the admin password in the browser at /setup when it prints the address".
  • PROV-013 requirements/infrastructure.md:177: fixed. The link-local rationale now cites "a 1-Click droplet given a password at create time holds it in user-data (#3942)". The script-install claim is gone.
  • setup.py:39 / DEPLOYMENT.md:502 marketplace-only acceptance: fixed. src/backend/routers/setup.py:39-42 now says the acceptance "covers every install whose provisioning exports ADMIN_PASSWORD_SOURCE=browser" and names the 1-Click, the Vultr Marketplace server and do-script. docs/DEPLOYMENT.md:502-506 names the same three. That matches the gate at setup.py:251, which refuses only unset.
  • Claim warning on the no-public-IP and timeout exits: fixed. claim_warning() (trinity-do-create.sh:166-173) is called on the no-IP exit (:177), the ready path (:198) and the 15-minute timeout (:223). The no-IP call is pinned by a test; the other two are not (see L2).

Status of Andrii's items (10-24)

  1. 1-Click write_files follow-up, plus the docs: fixed. #3942 is filed, and the docs are covered by the first bullet above.
  2. #3799 retitled and updated: fixed. Its title is "DigitalOcean installer puts the admin password in droplet user-data", its Expected section describes the ADMIN_PASSWORD_SOURCE=browser claim, and its Validation step is the Create your admin account form. Nothing in it still claims the admin is set.
  3. faq/deployment-and-upgrades.md:19 and PROV-013: fixed (see above).
  4. Marketplace-only accepted-risk text: fixed (see above).
  5. Claim warning only on the happy path: fixed for the two exits named. A residual is in L1.
  • Optional, exact interpolation set: done. tests/unit/test_2380_installer_portability.py:88 asserts set(interpolated) == {"TRINITY_IMAGE_TAG_Q"}, and mutation M2 below shows it catches a password under another name.

What I ran

  • pytest -q -p no:randomly unit/test_2380_installer_portability.py unit/test_2380_installer_release_pin.py unit/test_ent580_marketplace_admin_claim.py unit/test_3237_system_agent_after_setup.py: 71 passed.
  • bash -n scripts/deploy/trinity-do-create.sh: clean. shellcheck is not installed here, so I did not run it.
  • git merge-tree --write-tree origin/dev HEAD: clean. The branch is 12 commits behind dev.
  • Enterprise-docs guard pattern over the added docs/ lines: 0 hits.
  • CI on the head: 14 checks pass, 5 skipped, none failing.
  • Mutations of trinity-do-create.sh, each run against test_2380_installer_portability.py (18 tests):
Mutation Result
M1: add export ADMIN_PASSWORD='${ADMIN_PASSWORD_Q}' back to the heredoc 2 red (…interpolation…is_quoted, test_no_admin_password_reaches_the_droplets_user_data)
M2: the password under another name, export TRINITY_ADMIN_PW='${ADMIN_PASSWORD_Q}' 1 red (…interpolation…is_quoted)
M3: drop claim_warning from the no-IP exit 1 red (test_no_admin_password…)
M4: drop claim_warning from the timeout exit all green
M5: drop claim_warning from the ready path all green
M6: ADMIN_PASSWORD_SOURCE=unset 7 red
M8: export TRINITY_ADMIN_SECRET="${ADMIN_PASSWORD:-}" (double-quoted, taken from the operator's env) all green

I also ran the installer against two failing doctl stubs to check L1.

New findings

No Blocking or Medium findings.

Low

L1. Two exits after the droplet exists still skip the claim warning. (trinity-do-create.sh:155-162, confidence 7/10)

doctl compute droplet create "$DROPLET_NAME" \
    ... --wait --format ID,Name,PublicIPv4 --no-header >&2

IP="$(doctl compute droplet list "$DROPLET_NAME" \
      --format PublicIPv4 --no-header | tail -1 | tr -d '[:space:]')"

The script runs under set -euo pipefail (:28). If droplet create --wait returns non-zero after DigitalOcean has accepted the create (for example, a network error while it polls the create action), or if droplet list fails, the script exits 1 with only doctl's own error. The droplet exists and boots admin-less, and nothing tells the operator to claim it. I reproduced both with stub doctls: the output ends at "Creating the droplet..." followed by the doctl error, with rc=1 and no claim text. The comment at :164 ("every exit after this point tells the operator to claim it") is accurate for the code after it, but these two exits come just before it. Fix: set a flag right before droplet create, and use an EXIT trap that prints claim_warning "https://<the droplet's IP>" on any non-zero exit once the flag is set. Alternatively, put || true on the list substitution so a failure falls through to the existing no-IP branch.

L2. The ready-path and timeout claim warnings are not pinned. (tests/unit/test_2380_installer_portability.py:228-240, confidence 8/10)
M4 and M5 stay green. The ready path at :198 is the one most operators see. The stub's droplet list returns no IP, so the tests never reach the poll loop. Fix: add a stub droplet list that prints an IP and a stub curl that exits 0 (the stub dir is already first on PATH), then assert "create your admin account" is in stderr and the exit code is 0. A stub curl that exits 1, with DEADLINE reached quickly (or sleep stubbed), covers the timeout exit the same way.

L3. The env-leak property and some stale comments. (confidence 6/10)

  • M8 shows nothing asserts that an ADMIN_PASSWORD in the operator's environment stays out of user-data. Andrii checked that by reading the code. One more line would pin it: in test_no_admin_password_reaches_the_droplets_user_data, run with ADMIN_PASSWORD=<sentinel> in env and assert the sentinel is not in the user-data file.
  • Comments and docs that still describe browser as marketplace-only or the installer as password-passing:
    • src/backend/routers/setup.py:30: "(ADMIN_PASSWORD_SOURCE=browser, set only by the image's first boot)". Lines 39-42 of the same docstring now say otherwise.
    • scripts/deploy/start.sh:1004-1005: "ADMIN_PASSWORD_SOURCE=browser, which only a marketplace first boot sets". This file is not in the diff.
    • docs/memory/feature-flows/hosted-install.md:135: "start.sh also writes an ADMIN_PASSWORD from the environment into .env when .env has none — the installer's user-data relies on this". The installer's user-data no longer relies on it.
    • docs/user-docs/guides/deploying/upgrading.md:118: "On a Marketplace Droplet whose admin was created in the browser…". This now applies to do-script droplets too.

Execution coverage: every changed shell path except the ready and timeout warnings runs in a test that executes the real script against a stub doctl. The setup.py change is docstring-only. The interpolation regex is a source-text check, but it works as a guard over the heredoc this PR changes, and M1 and M2 show it biting.

…by tests (#3799)

An EXIT trap now prints the claim warning when `droplet create --wait` or
`droplet list` fails after DigitalOcean accepted the create; it keeps the
user-data cleanup. Tests run the ready, timeout and both failure exits
against stub doctl/curl/date/sleep, and assert an ADMIN_PASSWORD in the
operator's environment stays out of the user-data.

Comments and docs that called ADMIN_PASSWORD_SOURCE=browser marketplace-only,
or said the installer's user-data carries a password, now name the script
install too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@obasilakis

Copy link
Copy Markdown
Contributor Author

Lows from the 10-30 review addressed at aa4210f0f:

  • L1: an EXIT trap prints the claim warning when droplet create --wait or droplet list fails after the create is accepted. It also does the user-data rm the old trap did.
  • L2: test_every_exit_after_create_says_to_claim_the_droplet runs the ready, timeout, create-wait-fails and list-fails exits against stub doctl/curl/date/sleep, and asserts exactly one warning on each. M4, M5 and dropping the trap each turn it red.
  • L3: the user-data test runs with ADMIN_PASSWORD=<sentinel> and asserts the sentinel stays out. The stale lines in setup.py:30, start.sh:1004, hosted-install.md:135 and upgrading.md:118 now name the script install.

@AndriiPasternak31, your 10-24 changes-requested review is still blocking the merge. dolho checked each of your items as fixed in the 10-30 review. Could you re-review?

@obasilakis
obasilakis requested a review from dolho October 30, 2026 13:31

@dolho dolho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core change looks good. User-data now carries only ADMIN_PASSWORD_SOURCE=browser and the image tag (trinity-do-create.sh:121-141). The Redis passwords, CREDENTIAL_ENCRYPTION_KEY and the JWT secret are all generated on the droplet by start.sh. The test asserts that no ADMIN_PASSWORD= reaches user-data.

Please fix before merge: two docs still claim the installer removes the claim window. After this PR that is false, because the script droplet now has the same first-visitor-becomes-admin window as the 1-Click. An operator who reads either page may not rush to /setup or restrict port 443:

  • docs/user-docs/faq/troubleshooting.md:153: "...or the trinity-do-create.sh installer, which removes the window entirely"
  • docs/user-docs/guides/deploying/hardening.md:20: "The install script, or a password supplied at create time, provisions it at first boot instead". This PR does not touch this file.

Suggested fix: drop the installer from both sentences and list it alongside the 1-Click as a browser-claim install.

Lower priority:

  • trinity-do-create.sh:34,163-166: with TRINITY_IMAGE_TAG set to a tag older than the browser-claim support (which includes the test default v0.9.5-rc2), start.sh ignores the browser marker and generates a password into the install log. The script's advice "someone got there first: destroy the droplet" then makes the operator destroy a healthy droplet. Either refuse old tags or soften the message.
  • :170-177: the EXIT trap prints <the droplet's IP> even when $IP is already known. Use ${IP:-<the droplet's IP>}.

I'm happy to approve once the two docs are corrected.

@AndriiPasternak31 AndriiPasternak31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at aa4210f0f.

All five items from my 10-24 review are fixed. I checked each one on this head:

  1. 1-Click write_files. #3942 is open. single-server.md:369 now says the password stays in user-data for the droplet's life and links it, and the same line is at DEPLOYMENT.md:524-525, faq/security.md:101 and setup.md:63. No "shred" wording is left.
  2. #3799. It is retitled, its Expected section describes the browser claim, and its Validation is the grep over /var/lib/cloud plus the Create your admin account form.
  3. The two docs I named. faq/deployment-and-upgrades.md:19 now has the admin created at /setup, and PROV-013 (infrastructure.md:177) cites the 1-Click password instead of the script install.
  4. Accepted-risk text. setup.py:39-42 and DEPLOYMENT.md:502-507 name do-script alongside the 1-Click and Vultr, which matches the gate at setup.py:251. The :30 docstring and the start.sh:1004 comment now agree with them.
  5. Claim warning. It prints on the no-IP exit (trinity-do-create.sh:192), the ready path (:213) and the timeout (:238), and the EXIT trap (:170-179) covers a failing droplet create --wait or droplet list. Each is pinned by test_every_exit_after_create_says_to_claim_the_droplet. Dropping any one of them turns its case red.

The exact-set assertion is in (test_2380_installer_portability.py:88), and the operator-env sentinel (:255, :262) now catches "${ADMIN_PASSWORD:-}" going into user-data under another name. test_2380_installer_portability.py, test_2380_installer_release_pin.py and test_ent580_marketplace_admin_claim.py pass locally (70). shellcheck is clean.

Before merge, the two docs raised in the latest review are still open: faq/troubleshooting.md:153 and deploying/hardening.md:20 both say the script install has no claim window. Two more lines say the same thing, in files this PR already edits:

  • faq/deployment-and-upgrades.md:39: "To skip the window entirely, … or use the installer script."
  • guides/deploying-trinity.md:112: "(or use the installer script below)". :15 and :118 of that file are fixed, :112 isn't.

I'd fix all four in the same push.

Small, non-blocking:

  • Ctrl-C during the readiness poll runs the EXIT trap with IP already set, so it prints "may have been created" and https://<the droplet's IP> right under "Server is up at ". ${IP:-<the droplet's IP>} at :175 fixes the address.
  • start.sh at v0.9.5-rc2 and earlier has no browser handling, so TRINITY_IMAGE_TAG set to one of those generates a password, and the "destroy the droplet" advice is then wrong. The default v1.0.0 is fine. A follow-up is enough.

FYI, #3824 still specs TRINITY_ADMIN_PASSWORD into user-data, which is worth fixing there.

Approving. My items are done, and the docs above are for the latest review to gate.

…indow (#3799) — per the merge-train note on the PR

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vybe

vybe commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

merge-train pushed to this branch (1bf8bdc9e): the four doc lines both reviews asked for, which said the installer has no claim window (faq/troubleshooting.md, deploying/hardening.md, faq/deployment-and-upgrades.md, deploying-trinity.md).

The operator ruled at Gate 1 to extend the claim-window acceptance to this installer; it is recorded on #3799.

Riding with notes, for a follow-up:

  • --hosted in the user-data (trinity-do-create.sh:138) is unpinned and now load-bearing: removing it leaves 232 tests green, and from the code the prod compose then refuses a blank password.
  • A TRINITY_IMAGE_TAG at v0.9.5-rc2 or earlier has no browser handling, so the sign-in-page advice would tell an operator to destroy a healthy droplet.
  • Some docs still describe browser as marketplace-only: public-access.md:446, architecture/security.md:28, agent-lifecycle.md:128, single-server.md:466, .env.example:49.
  • The manual test plan box is unticked: nothing has run on a real droplet.

@vybe
vybe merged commit 7a76479 into dev Oct 31, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants