Skip to content

refactor(publication): harden credentials and finish the Artifact Site rename - #134

Merged
lanyue-llk merged 13 commits into
mainfrom
refactor/publication-credentials
Nov 3, 2026
Merged

lanyue-llk merged 13 commits into
mainfrom
refactor/publication-credentials

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What, why and how of this PR

Issues

Closes #95. Remaining after this PR:

  • The stored artifact_hub_* profile keys (base_url, site, expected_version, share_url) keep their names. Frozen instance profiles use them, and certificates and receipts bind those profile hashes. The WCXB profile_digest also excludes artifact_hub_expected_version by name. Renaming them would invalidate that evidence, so it needs an owner decision and a coordinated profile revision.
  • The explicit --env-file and --credential-env-file options, and the public replay's credentials_env site passwords read through the process environment, still allow a non-repository source. Tightening them changes how runs are launched, so that needs an owner decision. Replay LLM diagnostics and the Rainbond API token of a slice run already ignore --env-file and read only the repository .env, so with a repository .env an operator-named file does not supply that token; the public replay and qualification CLIs' --env-file help says so.
  • HF_TOKEN is still read only from the process environment and is not in .env.example. It is optional authentication for dataset downloads and dataset publication, not a provider or evaluated-service credential, so this PR treats it as a dataset transport token outside the evaluation-credential rule. No code changes for it here; the owner can reclassify it.

Part of #87.

Summary

Publishing:

  • load_token now reads only, in this order, ARTIFACT_SITE_TOKEN, ~/.config/artifact-site/tokens/<host>, ~/.config/artifact-hub/tokens/<host> and ARTIFACT_HUB_TOKEN. The legacy variable is host-agnostic, so it comes last and a stale value cannot replace a host-scoped token. The host-agnostic token files are ignored, so they can never be sent to whichever host a caller names.
  • The hardcoded artifact-hub.app.lexmount.com default is gone. authorize_artifact_site.py requires --base-url or ARTIFACT_SITE_BASE_URL. require_publication_site no longer substitutes a default for a missing profile host.
  • verify_artifact_site.py used to send the token to any --base-url. It now rejects a host that differs from the bound profile, and it accepts both flat and nested profiles.
  • Public WebArena release fix: its verification command omitted the required --profile and --export, so verify_artifact_site.py would have rejected it. Both are now passed.
  • Dead code removed: current_publication_target, public_report_url and WEBFETCH_REPORT_PUBLIC_URL had no production caller. ARTIFACT_SITE_TOKEN also leaves .env.example, because publishers never read .env.

Evaluation credentials:

  • A new repository_env() reads the repository .env without changing the process environment. It disables dotenv interpolation, so a ${NAME} reference cannot pull a value from the shell. The Browser Use runner's dotenv reads share one helper that disables it too, and a blank value in an --env-file now counts as unset, as it already did in the repository .env, and the search judge's SEARCH_JUDGE_BASE_URL host allowlist now comes from repository_env().
  • Both replay diagnostics now take OPENAI_* only from it. The earlier draft used load_runtime_env(), but that strips unrelated credentials from a live process and lets a shell OPENAI_BASE_URL receive the .env key, so I did not keep it.
  • The Rainbond slice manager reads its API token only from repository_env(), so an exported value is ignored. The public WebArena README now tells operators to put it in .env, matching .env.example.
  • The Browser Use runner no longer lets shell OPENAI_* override .env. COWAGENT_REPO, which is not a secret, can still come from the process.

Redaction: #130 already derives the sanitize_text tables from harness.environments.webarena.topology, but the Browser Use release privacy check still hardcoded a plaintext copy of the site passwords. report_check.py now builds one pattern from known_site_secrets() and uses it in both _check_execution_artifacts and _check_public_privacy, so a password added or rotated in the registry is detected as well as redacted.

Rename:

  • Seven scripts/*_artifact_hub.py entry points become *_artifact_site.py, with every caller, doc and configs/report-templates.json entry updated and no aliases.
  • ARTIFACT_HUB_BASE_URL is removed.
  • Default receipt paths become publish/artifact-site-receipt.json and publish/browser-use-artifact-site-receipt.json. A local receipt at an old default path must be moved or passed with --receipt.
  • Old names kept as historical facts: published URLs, research/report-changes.json, evaluation/browser-use-public/report-changes.json with its matching translation key, and research/browser-use-bridge-inputs/trajectory-run-profile.json.

Reports built before this change embed the old script names in their manifest's template block, so they need a rebuild before a new release check. The golden changes below come from the same rename.

Golden changes

  • browser-use-pass and browser-use-fail, routes accounts/index.html and en/accounts/index.html: the service row now reads "Artifact Site".
  • web-fetch, route report-manifest.json: the embedded report template now has the renamed package and publish commands.

Test plan

  • Lint gate: both ruff check commands pass.
  • tests/test_golden_reports.py: 10 passed after UPDATE_GOLDEN=1; only the routes above changed.
  • New behavior tests:
    • host-agnostic and other-host tokens are refused
    • authorization needs an explicit host
    • verification refuses a host outside the bound profile before loading a token
    • no default host is used
    • diagnostics and the Browser Use runner ignore shell credentials, including through ${NAME} references; diagnostics also leave the process environment unchanged
  • Full local run excluding tests/test_ci_gate.py: 18795 passed, 60 skipped, 62 failed. I did not triage all 62 or run them on the base commit. The ones I inspected fail with Historical benchmark source is not recorded in the dataset lock or Dataset revision is not recorded in data-lock.json from the shared local environment, and the tests/test_optional_reports.py traceback imports the other checkout's source. CI on Linux is the gate for these; see the checks on this PR.
  • After the interpolation fix: lint passes, and 157 tests passed across the golden, Browser Use runner, diagnostics and replay runner files.
  • After review round 1: lint passes; tests/test_golden_reports.py, tests/test_artifact_auth.py, tests/web_search and tests/trajectory_replay/test_diagnostics.py gave 528 passed. The new tests cover the token order and the judge allowlist; the judge test failed before its fix.
  • After review round 2: lint passes; tests/browser_use/test_runner.py, tests/test_golden_reports.py and tests/test_config.py gave 92 passed, with no golden changes. The new test drives the --env-file branch of run() and fails if either read re-enables interpolation.
  • After review round 3: lint passes; tests/trajectory_replay, tests/test_manage_webarena_rainbond_pool.py, tests/test_golden_reports.py and tests/test_config.py pass with no golden changes. The new test failed before the fix. I did not call a live Rainbond API.
  • After review round 4: lint passes; tests/trajectory_replay/public_webarena/test_rainbond_slices.py, tests/test_manage_webarena_rainbond_pool.py and tests/trajectory_replay/public_webarena/test_config.py gave 46 passed; tests/test_golden_reports.py, tests/trajectory_replay/test_diagnostics.py and tests/test_config.py gave 31 passed, with no golden changes. The new test shows a token only in an operator-named --env-file is refused. It pins behavior that already existed since the previous round, so it did not fail before this round.
  • After the final review finding: lint passes; tests/test_golden_reports.py, tests/browser_use and tests/environments/test_webarena_topology.py gave 305 passed, with no golden changes. The new tests load the checker against a registry with an extra password and reject it in both checks; the two that use that password failed before the fix. The four existing passwords are still rejected.
  • After review round 6: lint passes; the same targets gave 310 passed, with no golden changes. topology._load now rejects a blank or missing site password, and an empty registry no longer makes the privacy check match every file. The new tests failed before the fix.
  • I did not run a real publish or device authorization, because this change must not touch a live site.

…e rename

Stop sending host-agnostic tokens to a target, remove the hardcoded default
host, compare verification hosts with the bound profile, and read LLM provider
credentials only from the repository .env. Rename the Artifact Hub entry points
and every caller to Artifact Site without aliases. Stored artifact_hub_* profile
keys stay because certificates bind those profile hashes.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Review complete · 9edc78d

This review found 2 issue(s), including 2 blocking issue(s).

base = api_base or os.environ.get("OPENAI_BASE_URL") or os.environ.get("OPENAI_API_BASE")
try:
# Evaluation credentials come only from the repository .env, never the shell.
env = repository_env()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security · medium
P2: The new credential source still allows shell values through dotenv interpolation. repository_env() calls dotenv_values(selected) with interpolation enabled, which resolves missing ${...} references against os.environ. For example, a repository .env containing a literal OPENAI_API_KEY and OPENAI_BASE_URL=${OPENAI_BASE_URL} sends that key to the shell-selected endpoint. The same issue affects the public WebArena diagnostics call. To enforce the stated repository-only boundary, disable interpolation in the shared reader (or resolve references exclusively against file values), and add a regression case with a shell-provided interpolation variable.

Comment thread src/harness/web_fetch/config.py Outdated
selected = ROOT / ".env"
if not selected.exists():
return {}
return {key: value for key, value in dotenv_values(selected).items() if value}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security · high
P1: dotenv_values() enables interpolation by default and resolves ${NAME} using the process environment when the name has not already been defined in the file. Consequently, a repository .env containing OPENAI_API_KEY=repository-key and OPENAI_BASE_URL=${OPENAI_BASE_URL} still lets a shell-provided URL receive the repository key through both replay diagnostics. Likewise, an interpolated key can come from the shell. This defeats the isolation this helper is intended to provide. Disable interpolation (interpolate=False), or implement expansion restricted to file-local values, and add a regression case with shell-backed substitutions.

Suggestion:

Suggested change
return {key: value for key, value in dotenv_values(selected).items() if value}
return {key: value for key, value in dotenv_values(selected, interpolate=False).items() if value}

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Re-review complete · 5f81312

No findings in this incremental review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review, round 1

Reviewed head 5f813124 against base 27401304. CI on this head passes: Tests and static checks, Installation and packaging, and Rendered reference and report checks. No failure is attributable to the PR.

Three findings: one P2 and two P3.

Findings

P2: a legacy host-agnostic environment token outranks the current host-scoped token

src/harness/web_fetch/artifact_auth.py:39-41, with the behavior pinned by tests/test_artifact_auth.py:39-40.

Problem: ARTIFACT_HUB_TOKEN is read before ~/.config/artifact-site/tokens/<host>. A stale ARTIFACT_HUB_TOKEN left in a shell therefore replaces a correct per-host token and is sent to whichever host is selected. I reproduced this with ARTIFACT_HUB_TOKEN=ahp_stale_other_host and a saved ahp_scoped for https://a.example: load_token returned ahp_stale_other_host.

This is the wrong-host failure #95 is meant to close. It also disagrees with three descriptions of the order:

  • AGENTS.md calls the old locations migration fallbacks.
  • The issue proposal lists ARTIFACT_SITE_TOKEN, then the current per-host file, then the legacy per-host path.
  • This PR's own docs/report-hosting.md:68 gives the same order.

The ordering predates this PR, but the PR rewrites this function to harden it and documents a different order.

Suggested fix: read ARTIFACT_SITE_TOKEN, then artifact-site/tokens/<host>, then the legacy fallbacks, with ARTIFACT_HUB_TOKEN after the current host file. Decide its position relative to artifact-hub/tokens/<host> and state that in the doc. Change the test so the saved per-host token wins over ARTIFACT_HUB_TOKEN, and keep a case where ARTIFACT_HUB_TOKEN is used when no current token exists.

P3: --env-file no longer reaches LLM diagnostics, and the remaining-work note does not say so

src/harness/trajectory_replay/public_webarena/diagnostics.py:274-277, src/harness/trajectory_replay/public_webarena/cli.py:82-83,124.

Problem: public_webarena/cli.py still loads --env-file into the process, but diagnose_summary now reads only the repository .env. --env-file other.env --llm-diagnostics therefore silently uses the repository key and endpoint, or records a missing-credentials diagnostic error if the repository has none. Taking credentials only from the repository .env matches AGENTS.md. The issue is that the flag's help text and the PR's "Remaining" note both imply that --env-file is still a credential source for this run.

Suggested fix: state in the --env-file help and the PR body that LLM diagnostics ignore it.

P3: small rename and interpolation leftovers

  • src/harness/web_fetch/publication_verify.py:101: the docstring still says "a known Hub bootstrap". The artifact[-_ ]?hub search misses it. Change it to "Artifact Site bootstrap".
  • src/harness/web_search/relevance.py:485: dotenv_values(runtime_config.ROOT / ".env") still interpolates. A ${NAME} value for SEARCH_JUDGE_BASE_URL would be resolved from the shell, and that value is the host allowlist for the judge token. This is the same class of problem the PR fixes for OPENAI_BASE_URL. Pass interpolate=False, or list it under remaining work.

Verified with no defect

  • Token files: host-agnostic files and other-host files are refused. The legacy per-host key is the same lowercase host string as before.
  • Default host: no hardcoded default remains in src or scripts. DEFAULT_BASE, current_publication_target, public_report_url and WEBFETCH_REPORT_PUBLIC_URL have no references left.
  • Token destinations: every load_token caller takes its host from a profile or receipt, or from a value checked against one. verify_artifact_site.py rejects a mismatched --base-url or ARTIFACT_SITE_BASE_URL before loading a token, for both flat and nested profiles.
  • Public WebArena release: _verification_command now passes --profile and --export. The nested publication.base_url resolves through publication_document.
  • Redaction: browser_use/publication.py derives its tables from harness.environments.webarena.topology, so "no change needed" holds.
  • Credentials: OPENAI_* is read only from the .env paths in browser_use/runner.py and the two diagnostics.py modules. The tests fail if interpolate=False is removed from repository_env or _load_repo_env.
  • Rename: the seven scripts were renamed with no aliases, and no old script name or ARTIFACT_HUB_BASE_URL remains. The surviving Artifact Hub strings are published URLs, historical records, the two allowed fallbacks and the stored artifact_hub_* profile keys, which the PR lists as remaining.
  • Receipt rename: a receipt left at an old default path fails closed on update for Web Fetch and Browser Use (report_publish.py:151-152, browser_use/report_publish.py:264-265), so a missed move cannot create a duplicate site.
  • Scope claim: "Part of #95" is accurate, and hash-bound evidence and frozen profiles are unchanged.

Local test results

  • Lint gate: both ruff check commands pass.
  • tests/test_golden_reports.py plus the auth, verify, runtime entrypoint, publish, report template, Browser Use runner, diagnostics, release and WebArena publish test files: 267 passed.
  • Golden changes match the routes the PR body lists: accounts/index.html and en/accounts/index.html for the two Browser Use fixtures, and report-manifest.json for web-fetch.
  • I did not run the full suite locally or perform a live publish or device authorization. CI is the full-suite gate.

@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Review round 1: all four findings are fixed, none disputed.

  • P2, token order (bd1efd2): load_token now reads ARTIFACT_SITE_TOKEN, ~/.config/artifact-site/tokens/<host>, ~/.config/artifact-hub/tokens/<host>, then ARTIFACT_HUB_TOKEN. I put the legacy host file before the legacy variable because the same stale-value problem applies to it. docs/report-hosting.md states the order. The new test covers a saved current token winning, a saved legacy token winning, and ARTIFACT_HUB_TOKEN being used when nothing host-scoped exists.
  • P3, --env-file (234f55a): the public replay CLI help now says --llm-diagnostics ignores it, and the PR body's Remaining note says the same. I left the qualification script's --env-file help alone because it has no LLM diagnostics option.
  • P3, docstring (16c5587): now reads "Artifact Site bootstrap".
  • P3, judge allowlist (67e5e3b): SEARCH_JUDGE_BASE_URL now comes from repository_env(), the existing owner that disables interpolation, rather than a second dotenv_values call. The new test failed before the fix, with the token request reaching a host chosen through a shell ${NAME} value.

Local checks: both lint commands pass, and the golden, artifact auth, web search and diagnostics tests gave 528 passed with no golden changes. CI on this head is still running.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Re-review complete · 67e5e3b

No findings in this incremental review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review, round 2

Reviewed head 67e5e3ba. All four round 1 fixes hold. I found no P0, P1 or P2 defects, and two P3 items.

Findings

P3: src/harness/browser_use/runner.py:535: the explicit --env-file read has no interpolation test.

  • Problem: the PR body says the runner's dotenv reads disable interpolation and that tests cover ${NAME} references. test_provider_credentials_come_only_from_the_repository_env only exercises _load_repo_env (line 77). When I removed interpolate=False from line 535 alone, all 70 tests in tests/browser_use/test_runner.py still passed, so a regression there would let a ${NAME} in that file pull a credential from the shell without any test failing.
  • Fix: send both reads through one small helper that takes the file path and always disables interpolation, then test that helper. Or add a test that drives the --env-file branch of run().

P3: src/harness/web_fetch/README.md:461: the credentials paragraph is wrong about exported variables.

  • Problem: "Credentials and local executable/repository paths belong in the root .env ... Exported environment variables take precedence." This is false for credentials. I ran load_runtime_env() with OPENAI_API_KEY=exported in the process and OPENAI_API_KEY=fromfile in .env, and it resolved to fromfile. It also contradicts line 845 of the same README and the rule this PR enforces. The sentence predates the PR, but it is outside the disclosed remaining work and misleads on the subject of #95.
  • Fix: limit the precedence statement to non-credential paths, for example "Exported variables take precedence for runtime paths; evaluation credentials come only from the repository .env."

What I verified

  • Round 1 fixes:
    • Token order is ARTIFACT_SITE_TOKEN, the current per-host file, the legacy per-host file, then ARTIFACT_HUB_TOKEN. Moving ARTIFACT_HUB_TOKEN back ahead of the files fails tests/test_artifact_auth.py.
    • The public replay CLI's --env-file help is updated. The curated replay CLI has no --env-file. The other two --env-file and --credential-env-file options sit in code with no --llm-diagnostics option.
    • The publication_verify.py docstring is fixed.
    • SEARCH_JUDGE_BASE_URL now comes from repository_env().
  • Mutation checks (each reverted afterwards): each of these made a test fail:
    • restoring interpolation in repository_env (judge and diagnostics tests)
    • letting verification skip the profile host check
    • adding a default host to authorize_main
    • adding a default host to require_publication_site
  • Host binding: every load_token caller gets its host from a bound profile or receipt, apart from authorize_main, which takes an explicit --base-url or ARTIFACT_SITE_BASE_URL. The Web Fetch, public replay and WCXB paths use publication_base. The Browser Use and curated replay publishers read the profile's publication.base_url, and rename reads the receipt's host. No Artifact Site default host remains in src, scripts or the Makefile.
  • Public replay release: the verification command now passes the --profile and --export that verify_artifact_site.py needs. Nested publication profiles resolve through publication_document.
  • Redaction: browser_use/publication.py has no plaintext passwords and imports from harness.environments.webarena.topology.
  • Rename:
    • All ten scripts/*_artifact_site.py entry points run with --help, and no *_artifact_hub.py script remains.
    • The remaining old-name hits outside evaluation/ and research/report-changes.json are the allowed migration fallbacks and their tests, a test helper that strips those variables, stored artifact_hub_* keys, published URLs, one translation key for historical release text, and research/browser-use-bridge-inputs/trajectory-run-profile.json.
    • ARTIFACT_HUB_BASE_URL, DEFAULT_BASE, current_publication_target, public_report_url and WEBFETCH_REPORT_PUBLIC_URL are gone. On the base commit, the last three were referenced only by their own module, .env.example and tests.
  • Scope claim: "Part of #95" is accurate. The remaining list covers the stored artifact_hub_* keys and the explicit non-repository credential sources, and both need an owner decision.
  • Golden snapshots: only the routes named in the PR changed.
  • Local runs: both lint commands pass. tests/test_golden_reports.py and the affected publication, runner, diagnostics and judge test files gave 425 passed. I did not run the full suite locally, and I did not run a live publish or device authorization.
  • CI on 67e5e3ba: "Tests and static checks", "Installation and packaging", "Rendered reference and report checks", "Python 3.11" and the other checks all pass. The PR is mergeable and its base is the current main, 27401304.

lanyue-llk added a commit that referenced this pull request Nov 2, 2026
…elper

The explicit --env-file read disabled interpolation on its own line with no test covering it. Both reads now share _read_dotenv, and a test drives the --env-file branch of run(). A blank value in an --env-file now counts as unset, as it already did in the repository .env, so a blank OPENAI_BASE_URL selects the default URL.
@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Review round 2: both findings are fixed, and none are disputed.

  • --env-file read had no interpolation test (393ed5b): both runner dotenv reads now go through _read_dotenv, which always disables interpolation. A new test drives the --env-file branch of run() with ${NAME} values that are set in the shell, and checks the model receives them literally. I confirmed it fails when the helper re-enables interpolation and when run() bypasses the helper.
    • Behavior change: a blank value in an --env-file now counts as unset, as it already did in the repository .env. A blank OPENAI_BASE_URL therefore selects the default URL instead of passing an empty one.
  • README credential precedence (771f14f): the paragraph now says evaluation credentials come only from the repository .env, exported values are ignored, and an external --env-file that sets one is rejected. The precedence statement now covers only non-credential runtime paths. This is a docs-only change: tests/test_config.py already covers this behavior, and it passes.

Locally, lint passes and tests/browser_use/test_runner.py, tests/test_golden_reports.py and tests/test_config.py gave 92 passed, with no golden changes.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Re-review complete · 771f14f

No findings in this incremental review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review, round 3

Reviewed head 771f14f1. I found one defect, and CI is green on this head.

Finding

P2: src/harness/environments/webarena/rainbond.py:202 (entry point scripts/manage_webarena_rainbond_pool.py)

Problem: RAINBOND_API_TOKEN is still read only from the process environment, and pool_main never loads the repository .env. This is the same defect #95 describes for the curated replay CLI.

  • .env.example:97-99 tells operators to put the token in .env, and _evaluation_credential matches its name.
  • I constructed RainbondSlicePool against a temporary repository root, with PoolConfig.load and RainbondAPI stubbed:
    • With the token only in .env, it raises Rainbond API token environment variable is missing.
    • With the token also exported, it uses the shell value (fromshell).
  • The PR's "Remaining" list names only --env-file, --credential-env-file and the credentials_env site passwords, so a reader would conclude this path is done.

Fix: Read the token with repository_env().get(self.config.token_env, "") and add a test that a shell value is ignored. web_fetch/config.py holds repository_env(), and the replay diagnostics already import it from there. If the operator workflow makes that an owner decision, add this path to the PR's "Remaining" list instead.

Verified with no defect

Previous rounds

  • All round 1 and round 2 fixes are present, and neither round's findings need raising again.

Token order and host binding

  • load_token reads ARTIFACT_SITE_TOKEN, then the current per-host file, then the legacy per-host file, then ARTIFACT_HUB_TOKEN. The host-agnostic files are no longer read.
  • verify_artifact_site.py compares the requested host with the profile before any token load, for both flat and nested profiles.
  • require_publication_site rejects a profile with no host.
  • The public WebArena --profile --export command matches the verifier's parser.

Credential reads

  • The diagnostics callers pass no api_key or api_base.
  • .env.example has no $ references, so disabling interpolation changes no documented value.

Scope and rename

  • The only remaining old names are the disclosed profile keys, the allowed fallbacks, historical records and published URLs.
  • ARTIFACT_HUB_BASE_URL, WEBFETCH_REPORT_PUBLIC_URL and the removed functions have no remaining references.
  • All ten scripts/*artifact_site.py entry points answer --help with no host set.
  • Redaction uses topology, and I found no plaintext password copies under src, scripts, configs or top-level tests.

Goldens

  • Only the disclosed routes changed. browser-use-pass and browser-use-fail hashes match for both accounts routes, and web-fetch changed only report-manifest.json.

Mutation checks

I reintroduced each regression below, and the listed tests failed each time.

Regression reintroduced Failing tests
Host-agnostic token file tests/test_artifact_auth.py
ARTIFACT_HUB_TOKEN read first tests/test_artifact_auth.py
Interpolation in repository_env 3 tests in tests/trajectory_replay/test_diagnostics.py and tests/web_search/test_judge_receipts.py
Unbound verify host tests/test_publication_verify.py
Default host in require_publication_site tests/test_runtime_entrypoints.py
Shell OPENAI_API_KEY in the runner tests/browser_use/test_runner.py
Optional authorize host tests/test_artifact_auth.py

Local test runs

  • Lint gate passes.
  • The golden, publication, config, runner, judge, diagnostics, replay and public WebArena targets gave 1054 passed, 3 skipped, 1 failed.
  • The failure is tests/test_config.py::ConfigTest::test_migrated_roots_and_worker_paths, a path comparison of /tmp against /private/tmp caused by where my worktree sits on macOS, not by the PR.

CI on 771f14f1

  • Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11 all pass.

Checked and not reported

  • OXYLABS_PASSWORD and OXYLABS_USERNAME are not covered by the credential pattern, but no code reads them.
  • HF_TOKEN is a documented optional dataset-hub token read from the process. It is not in .env.example.
  • dotenv_values in report_languages.py still interpolates, but it reads only the report language, not a credential.

I did not run a real publish or device authorization.

@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Review round 3:

Fixed:

  • 9dd25f08: RainbondSlicePool now reads the API token from repository_env().get(token_env). An exported value is ignored, and a token only in .env now works for scripts/manage_webarena_rainbond_pool.py and the public replay environment. The public WebArena README said to use the process environment, so it now says the repository .env. The new test covers a shell value being ignored, a value in .env, and an uninterpolated ${NAME}; it failed before the fix.

Operators who only export RAINBOND_API_TOKEN must now move it to .env.

Disputed: none.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Re-review complete · 9dd25f0

No findings in this incremental review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review, round 4

Reviewed head 9dd25f08. I found no P0, P1 or P2 defects. Three P3 findings cover documentation and the scope list; none needs a code change.

Findings

P3: src/harness/trajectory_replay/public_webarena/cli.py:83 (also qualification.py:983)

  • Problem: since 9dd25f08, a Rainbond slice run also ignores --env-file, but the help text and the PR's Remaining note name only --llm-diagnostics. I reproduced this with the public replay load_runtime_env(other.env) and RainbondSlicePool. With no repository .env, a token that only other.env holds raises Set a nonempty ... in the repository .env. With a repository .env, the repository token is used silently, even though the operator named another file. webarena_environment.py:110 builds the pool on this path. This is the same class as the round 1 diagnostics note, and the behavior itself matches the rule.
  • Fix: state in the --env-file help and the PR's Remaining note that the Rainbond API token is also read only from the repository .env.

P3: examples/trajectory_replay/README.md:129

  • Problem: it says TRAJECTORY_REPLAY_LLM_DIAGNOSTICS=1 "requires OPENAI_API_KEY plus OPENAI_BASE_URL" without saying where they come from. run.sh does not load .env, so before this PR exported values were the working route for this example. Those exports are now ignored, and the run records the missing-credentials error instead of a diagnosis. The PR updated the equivalent Rainbond sentence but not this one.
  • Fix: say both values must be in the repository .env and that exported values are ignored.

P3: src/harness/benchmarks/data.py:163

  • Problem: HF_TOKEN is read only from the process environment, and it is absent from .env.example. It is not in the PR's Remaining list, which reads as the complete set of non-repository sources. Whether a dataset-transport token counts as an evaluation credential under AGENTS.md is a fair question, but the PR does not address it.
  • Fix: add one line to Remaining, either as an owner decision or stating that it is a dataset transport token outside the evaluation-credential rule. No code change is needed in this PR.

What I verified

  • Token selection: load_token reads ARTIFACT_SITE_TOKEN, the current host file, the legacy host file, then ARTIFACT_HUB_TOKEN. Every Authorization header for Artifact Site goes through it. No other reader of the host-agnostic token files remains.
  • Hosts: there is no default host in src/ or scripts/. verify_artifact_site.py rejects a host outside the bound profile before it loads a token.
  • Rename: all seven scripts are pure renames. A repository-wide search finds the old name only in the allowed fallbacks, the stored artifact_hub_* keys, published URLs and the historical files the PR lists. No caller of *_artifact_hub.py, ARTIFACT_HUB_BASE_URL or the old receipt paths remains.
  • Evaluation credentials: I went through the os.environ and getenv reads in src/ and scripts/. Apart from HF_TOKEN above and the disclosed site-password path, evaluation credentials reach the code through repository_env() or load_runtime_env().
  • Test strength: I applied five temporary mutations, and each one made at least one test fail:
    • restoring dotenv interpolation in repository_env
    • letting --base-url bypass the profile check in publication_verify
    • dropping --export from the release verification command
    • restoring the host-agnostic token file
    • restoring the shell OPENAI_API_KEY override in the Browser Use runner
  • Local runs: both ruff gates pass. Golden, auth, verify, privacy, entrypoint, config, publish/package, Browser Use runner, trajectory replay, judge and Rainbond pool tests gave 2379 passed, 5 skipped, 1 failed. The failure is tests/test_config.py::ConfigTest::test_migrated_roots_and_worker_paths, caused by my worktree path: /tmp versus /private/tmp on macOS. It is not caused by this PR. I did not run the full suite locally.
  • Goldens: no snapshot changed in this run, and the committed golden changes match the three snapshots and the routes the PR explains.
  • CI on this head: all checks pass, including Tests and static checks, Installation and packaging, and Rendered reference and report checks.

I did not run a real publish, device authorization or live Rainbond call.

@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Review round 4: all three findings are addressed, none disputed.

  • Rainbond token and --env-file (97eff58f): the --env-file help in public_webarena/cli.py and qualification.py now says the Rainbond API token of a slice run ignores that file and comes only from the repository .env. The PR's Remaining note says the same. I added a test that a token only in a file loaded through load_runtime_env is refused and the repository .env value is used.
  • LLM diagnostics README (21a029ac): examples/trajectory_replay/README.md now says OPENAI_API_KEY and OPENAI_BASE_URL must be in the repository .env, that exported values are ignored, and that without them the run records a missing-credentials error instead of a diagnosis.
  • HF_TOKEN: no code change, as the finding asked. Remaining now has a line stating that it is a dataset transport token, read only from the process environment, which this PR treats as outside the evaluation-credential rule. The owner can reclassify it.

Lint passes and the targeted tests pass with no golden changes; the PR's Test plan has the counts. CI on this head is still running.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Re-review complete · 21a029a

No findings in this incremental review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review, round 5

Head: 21a029ac. CI on this head passes: "Tests and static checks", "Installation and packaging" and "Rendered reference and report checks".

Findings

P2, src/harness/browser_use/report_check.py:272 and :295: the Browser Use release privacy check still hardcodes the site passwords, and the PR says no redaction change is needed.

  • Problem: both forbidden_text regexes contain Password\.123|admin1234|test1234|hello1234. These are plaintext copies of the passwords in environments/webarena/topology.json, the same kind of copy #95 asks to remove. sanitize_text takes its values from known_site_secrets(), but the release check that should catch a leak does not. If a password is added or rotated in the registry, the check no longer looks for it.
  • Reproduced: I patched DEFAULT_SITE_CREDENTIALS with a new password, and known_site_secrets() returned it. _check_public_privacy still accepted a report page containing that password, while it rejected hello1234.
  • Scope claim: the summary line "Redaction: no change needed. #130 already derives the tables" holds for browser_use/publication.py only, and the Remaining list does not mention this path.
  • Fix: build one module-level pattern from re.escape over known_site_secrets(), use it in both functions, and add a test that a registry password not in the old list is rejected. No rendered output or stored evidence changes. If you defer this instead, add it to Remaining and narrow the summary line.

What I verified without finding a defect

  • Token order: load_token reads ARTIFACT_SITE_TOKEN, the current per-host file, the legacy per-host file, then ARTIFACT_HUB_TOKEN. Host-agnostic token files are no longer read.
  • Hosts: no default host remains in src/ or scripts/. verify_artifact_site.py checks the host against the flat or nested profile before it loads a token. The public WebArena release command now passes --profile and --export, which the parser accepts.
  • Rename: a repository search finds no old script names, ARTIFACT_HUB_BASE_URL, WEBFETCH_REPORT_PUBLIC_URL or removed helpers. Every scripts/*.py path in configs/report-templates.json exists. The remaining "Hub" hits are stored profile keys, allowed fallbacks, historical URLs and the historical files listed in the PR.
  • Evaluation credentials: every process-environment read in src/ is either a non-secret setting, comes after load_runtime_env(), or is covered by the Remaining list. Publishing entry points do not load .env, and no shell script or Makefile target supplies OPENAI_*.
  • Round 4 fixes: the --env-file help, the trajectory replay README and the HF_TOKEN note are present and accurate.

Test results

  • Lint: both ruff check commands pass.
  • Focused tests: 1070 passed, 3 skipped, 1 failed, covering golden reports, publication, auth, config, Browser Use runner, trajectory replay, public WebArena, judge receipts and the Rainbond pool. Golden snapshots are unchanged.
  • The one failure: tests/test_config.py::ConfigTest::test_migrated_roots_and_worker_paths fails here because my worktree is under /tmp, a symlink to /private/tmp on macOS (/tmp/... versus /private/tmp/...). I attribute it to that location, not the PR, and the test is part of the Linux CI run that passes.
  • Not run: a real publish, a device authorization or a live Rainbond call.

lanyue-llk added a commit that referenced this pull request Nov 2, 2026
…rom the registry

Both forbidden-text patterns hardcoded a plaintext copy of the passwords in
topology.json, so a password added or rotated in the registry was redacted by
sanitize_text but not detected by the release check. One module-level pattern
now escapes known_site_secrets(), and both checks use it.
@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Fixed the open P2 finding. I verified it first and it was correct: _check_execution_artifacts and _check_public_privacy each hardcoded the four site passwords, while sanitize_text used known_site_secrets(), so a registry password was redacted but not detected.

  • report_check.py now has one module-level pattern built with re.escape over known_site_secrets(), and both checks use it. The other patterns (private keys, bearer tokens, sk- keys, local paths) are unchanged.
  • New tests load the checker against a registry with an extra password. They cover both checks and failed on the previous source for that password. The four existing passwords are still rejected.
  • The PR body's "Redaction: no change needed" line is corrected.

Lint passes. tests/test_golden_reports.py, tests/browser_use and tests/environments/test_webarena_topology.py gave 305 passed, with no golden changes.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Re-review complete · ae92aa6

No findings in this incremental review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review, round 6

Head: ae92aa66. CI on this head passes, including "Tests and static checks", "Installation and packaging", "Rendered reference and report checks" and "Python 3.11". The PR is mergeable and its base is current main.

I found no P0, P1 or P2 defects, and one P3.

Finding

P3: src/harness/browser_use/report_check.py:56-60: an empty registry or a blank password makes the pattern match everything.

  • Problem: the secrets are joined and followed by a literal |, so with no secrets the pattern starts (?:|-----BEGIN. That empty alternative matches any text, and a blank password produces the same result. topology._load allows both: topology.py:44 only ties credentials to mutable, and nothing checks that a password is nonblank or that a mutable site exists.
  • Reproduced: I loaded the real module with DEFAULT_SITE_CREDENTIALS emptied, then again with one extra blank password. Both times _FORBIDDEN_PUBLIC_TEXT.search("xyz") matched, and _check_public_privacy rejected a clean {"note": "clean"} file with "published report contains sensitive text".
  • Impact: this cannot happen with the committed topology.json, which has four nonblank passwords. It also fails closed, so nothing leaks. But the error would send an operator looking for a leak in a clean report. The hardcoded pattern this replaced could not do this.
  • Fix: reject a blank password in topology._load, which also protects sanitize_text, where text.replace("", "[REDACTED]") would corrupt every string. In report_check.py, join the secrets and the fixed alternatives as one list, so no secrets leaves no empty alternative. Add a test that an empty registry accepts clean text.

Verified with no defect

_FORBIDDEN_PUBLIC_TEXT

  • Error output: both checks raise with the file path only, never the match or the pattern. report_check.py holds no plaintext password. Outside tests and evaluation/, a git grep finds the four passwords only in topology.json.
  • Escaping: re.escape is applied to each secret, and Rotated.Secret+42(x compiles and matches literally.
  • Behavior preserved: old and new patterns agree on 12 controls, covering each password in different case, private key, bearer, sk- and local paths, including the case-sensitive /users/x control. The registry's password set equals the old list.
  • Module load: topology imports only the standard library and has no cycle. report_check.py already imported browser_use/publication.py, which calls known_site_secrets() at import, so the new import-time read adds no new way to fail.

Tests really fail without the fix

Each mutation was reverted afterwards.

Mutation Failing tests
Previous report_check.py 2: the privacy test and the Rotated.Secret+42(x execution-artifact case, as the PR says
Hardcoded list in the new pattern the same 2
re.escape removed 3
_check_execution_artifacts skips the scan 2
_check_public_privacy skips the scan 5

Rest of the PR

  • Earlier rounds: all fixes from rounds 1 to 5 are present, and I am not raising any accepted point again.
  • Tokens and hosts: token order, ignored host-agnostic files and explicit authorize host hold. Verification checks the profile host before loading a token, and no default host remains.
  • Credentials: the OPENAI_*, Rainbond and judge allowlist reads use the repository .env without interpolation.
  • Public WebArena: the verification command now passes --profile and --export.
  • "## Issues" section:
    • "Part of #95" is accurate, because the listed items remain open.
    • The stored artifact_hub_* keys are in use, including artifact_hub_share_url.
    • The WCXB digest excludes artifact_hub_expected_version at wcxb_publication.py:37.
    • The --env-file statements match the code.
    • HF_TOKEN is read only at benchmarks/data.py:163.
  • AGENTS.md:
    • A repository search finds no old script names, ARTIFACT_HUB_BASE_URL, old receipt paths or removed helpers, and no compatibility aliases.
    • Remaining "Hub" hits are the allowed fallbacks, stored keys, published URLs and the historical files the PR lists.
    • The PR changes no file under evaluation/, research/ or deploy/.
    • New default receipts stay under the ignored /publish/.
  • Golden snapshots: only the explained routes differ, namely both accounts routes in the two Browser Use snapshots and report-manifest.json in web-fetch. Rerunning them changed nothing.
  • PR body: exactly one <!-- pr-picture --> block, and its image link returns a PNG.

Local runs

  • Lint: both ruff check commands pass.
  • Latest commit's targets: tests/test_golden_reports.py, tests/browser_use and tests/environments/test_webarena_topology.py gave 305 passed, the count the PR states.
  • Wider targets: adding auth, verify, privacy, entrypoint, publish and package, config, tests/trajectory_replay, judge and Rainbond pool tests gave 2605 passed, 5 skipped, no failures.
  • Not run: the full suite locally, where CI is the gate, or a real publish, device authorization or live Rainbond call.

…swords

Join the registry secrets and the fixed alternatives as one list, so no secrets
leaves no empty alternative that matches any text. Reject a blank or missing
site password when loading the topology, which also protects sanitize_text from
replacing the empty string.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Re-review complete · 54e938c

No findings in this incremental review.

@lanyue-llk

Copy link
Copy Markdown
Contributor Author

Round 6: the P3 finding is fixed in 54e938c7. I verified it first and it was correct: with no secrets the pattern began (?:|-----BEGIN, which matches any text, and topology._load accepted a blank password.

  • report_check.py: the secrets and the fixed alternatives are now joined as one list, so no secrets leaves no empty alternative. With the committed registry the compiled pattern is identical to the previous one.
  • topology._load: a mutable site with an empty, whitespace-only, non-string or missing password is now rejected. This also protects sanitize_text from replace("", "[REDACTED]").
  • Tests: with an empty registry, clean text is accepted and a private key marker is still rejected. _load rejects each blank password form.

Tests fail without the fix

Reverted Failing tests
report_check.py the empty-registry test, on the clean file
topology.py all 4 password cases

Local runs: both ruff check commands pass. tests/test_golden_reports.py, tests/browser_use and tests/environments/test_webarena_topology.py gave 310 passed.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review, round 7

Head: 54e938c7. I found no defects of any severity. CI on this head passes: "Tests and static checks", "Installation and packaging", "Rendered reference and report checks", "Python 3.11", "Select check scope", "OCR dispatch" and ocr-review.

What I verified

_FORBIDDEN_PUBLIC_TEXT

  • Committed registry: the pattern string and flags are identical to the hardcoded pattern this PR removed, so release checks behave the same today.
  • Empty registry: there is no empty alternative. Clean text passes and a private key marker is still rejected.
  • Isolation: the fixtures execute a private copy of the module, and the real checker is unaffected, which test_public_privacy_rejects_a_password_only_the_registry_knows also asserts.

topology._load

  • Rejected on a mutable site: "", " ", "\t\n", None, 123, True, [], {}, a missing password and credentials: {} all raise the "nonblank password" ValueError with the site name.
  • Not newly rejected:
    • map and wikipedia, the two immutable sites, carry no credentials and never reach the new check. A registry with no mutable site also still loads.
    • _load has one production caller, on the committed topology.json. All four of its passwords load.
  • Runtime configs:
    • deploy/webarena/runtime.example.json and examples/trajectory_replay/public_webarena/webarena.config.example.json hold credentials_env variable names and never pass through _load.
    • examples/trajectory_replay/public_webarena/rainbond-pool.example.json names only token_env and never passes through _load either.
    • verify_deployment_contract passes against the deploy and example files, with 6 sites.

Tests fail without the fix

Each mutation was reverted afterwards.

Mutation Result
Remove the password check 4 topology tests fail
Drop .strip() the whitespace case fails
Drop isinstance the None and missing-password cases fail
Previous report_check.py the empty-registry test fails
Hardcoded password list in the pattern the test_public_privacy_rejects_a_password_only_the_registry_knows test and the Rotated.Secret+42(x execution-artifact case fail
_check_execution_artifacts skips the scan both execution-artifact cases fail
re.escape removed the probe password is not a valid regex, so the pattern fails to compile and the test run reports errors

These results match the table in the round 6 reply.

Rest of the PR

  • Credentials: I reread the source, config and docs diff against the base commit. Token order, host binding, repository_env and the _read_dotenv helper hold, and the disclosed Remaining items still match the code.
  • Rename: a search outside evaluation/ and research/report-changes.json finds no old script names, ARTIFACT_HUB_BASE_URL, WEBFETCH_REPORT_PUBLIC_URL, DEFAULT_BASE or old receipt paths. All ten scripts/*_artifact_site.py entry points answer --help.
  • Packaging: python-dotenv is a core dependency, so the new import in web_fetch/config.py is safe in a base install.
  • Plaintext passwords: under src, scripts, configs, deploy, examples and the Makefile, the four passwords appear only in topology.json.

Checked and not reported

A non-object credentials value on a mutable site, such as null or a string, raises AttributeError rather than the named ValueError. It still fails at import, and the same loader raises raw KeyError for other malformed fields, so I do not think this is worth changing.

Local runs

  • Lint: both ruff check commands pass.
  • Requested targets: tests/test_golden_reports.py, tests/browser_use and tests/environments gave 385 passed. No golden snapshot changed.
  • Wider targets: adding auth, verify, privacy, entrypoint, publish and package, config, tests/trajectory_replay, judge and Rainbond pool tests gave 2685 passed, 5 skipped, no failures.
  • Not run: the full suite locally, where CI is the gate, or a real publish, device authorization or live Rainbond call.

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.

Harden publication credentials and finish the Artifact Hub to Artifact Site rename

1 participant