Skip to content

docs: correct credential guidance left stale by #595 and #607 - #610

Merged
NotYuSheng merged 3 commits into
mainfrom
feature/hardening-doc-credential-drift
Jul 28, 2026
Merged

docs: correct credential guidance left stale by #595 and #607#610
NotYuSheng merged 3 commits into
mainfrom
feature/hardening-doc-credential-drift

Conversation

@NotYuSheng

@NotYuSheng NotYuSheng commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Problem

docs/operations/production-hardening.rst was not updated alongside the two credential PRs, so following it now produces a broken or insecure deployment:

Doc says Reality after #595 / #607
Edit MINIO_ROOT_USER / MINIO_ROOT_PASSWORD in docker-compose.yml Credentials come from .env; editing compose is no longer the mechanism
Set SPRING_DATASOURCE_PASSWORD to match This variable exists nowhere in the codebase — the real one is DATABASE_PASSWORD, and it is already wired from POSTGRES_PASSWORD
Keycloak admin default is user / P@ssw0rd Removed — the prod overlays now abort if KEYCLOAK_ADMIN* is unset

An operator following the page would either leave credentials unchanged in a file that no longer drives them, or set a variable nothing reads.

Changes

  • Rewrites Change Default Credentials around .env, listing every required variable with the MinIO 8-character minimum.
  • Explains the base-vs-overlay split: base defaults are public and exist for local/CI; the *-prod.yml overlays require every credential and abort otherwise.
  • Notes that one value feeds every consumer (backend, Postgres healthcheck, MinIO bucket bootstrap), so they cannot drift.
  • Corrects the Enable Authentication section: no Keycloak admin default; the analyst / analyst app login does still exist and still needs changing.

Added: the caveat that only shows up as a startup failure

POSTGRES_USER and POSTGRES_DB apply only on first volume init. Setting them against an existing deployment does not rename the role or database — Postgres keeps the old ones while the backend connects with the new, and startup fails.

This was documented in .env.example but not on the page an operator reads when hardening a running box, which is exactly where it bites.

Verification

No stale references remain (P@ssw0rd, SPRING_DATASOURCE_PASSWORD, the compose-editing instruction). Sphinx builds clean.

Docs-only — no code or compose changes.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated production deployment guidance to require providing all credentials via .env and to fail fast if any required values are missing.
    • Clarified that Keycloak has no default admin credentials and documented KEYCLOAK_ADMIN/KEYCLOAK_ADMIN_PASSWORD requirements; added instructions to change the seeded demo login.
    • Refined Postgres guidance: documented that backend password derivation prevents drift, removed the now-unneeded separate datasource password entry, and added a Postgres role password rotation example.
    • Clarified that POSTGRES_USER/POSTGRES_DB only apply during first-time volume initialization.

The hardening page still told operators to edit MinIO credentials directly in
docker-compose.yml and to set SPRING_DATASOURCE_PASSWORD — a variable that
exists nowhere in the codebase. It also listed the Keycloak admin default as
user / P@ssw0rd, which #607 removed: the prod overlays now abort instead.

Following that page after those two PRs would have produced a deployment that
either fails to start or leaves credentials unchanged in a file that is no
longer the place to change them.

Rewrites the section around .env, lists every required variable, and documents
the POSTGRES_USER/POSTGRES_DB first-init caveat that otherwise only surfaces as
a startup failure on an existing volume.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@NotYuSheng, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 91e22a8b-edb3-4725-bb20-33b39a20d7bb

📥 Commits

Reviewing files that changed from the base of the PR and between 5e67d55 and 0264ee5.

📒 Files selected for processing (1)
  • docs/operations/production-hardening.rst
📝 Walkthrough

Walkthrough

Production and deployment documentation now requires .env credentials, documents fail-fast overlays and database initialization behavior, clarifies Keycloak authentication defaults, and aligns PostgreSQL password configuration guidance.

Changes

Production credential hardening

Layer / File(s) Summary
Credential configuration contract
docs/configuration/environment-variables.rst
Documents that compose derives the backend database password from POSTGRES_PASSWORD and removes the separate datasource password variable.
Credential and authentication guidance
docs/operations/production-hardening.rst, docs/configuration/user-management.rst, docs/getting-started/offline-deployment.rst
Documents .env credential requirements, production overlay fail-fast behavior, database initialization caveats, and Keycloak admin and demo-login requirements.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related issues

  • NotYuSheng/TracePcap issue 595: The documentation covers operator-supplied credentials and fail-fast behavior described by the issue.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the documentation-only credential guidance fixes across the affected docs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/operations/production-hardening.rst`:
- Around line 51-53: Update the production-hardening documentation around the
“Those defaults are public” statement to clarify that credential presence checks
only reject unset values, not known defaults. State that operators must replace
values such as tracepcap_pass and minioadmin in .env with unique production
secrets.
- Around line 72-77: Update the existing-volume caveat in the production
hardening documentation to cover POSTGRES_PASSWORD as well as POSTGRES_USER and
POSTGRES_DB, including that changing it does not update the existing role
password and requires password rotation guidance; keep the existing
initialization and data-preservation warnings accurate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bbde0553-dcfb-47bf-9097-cf786581dad5

📥 Commits

Reviewing files that changed from the base of the PR and between 5f1c22e and 39ab76f.

📒 Files selected for processing (1)
  • docs/operations/production-hardening.rst

Comment thread docs/operations/production-hardening.rst Outdated
Comment thread docs/operations/production-hardening.rst Outdated
Addresses review on #610.

- Presence checks only reject UNSET values, not known-bad ones. The page implied
  the overlays prevent public defaults; an operator can still write
  tracepcap_pass into .env and it starts fine. Says so now.

- POSTGRES_PASSWORD carries the same first-init-only caveat as POSTGRES_USER and
  POSTGRES_DB, which the warning omitted. Verified empirically: recreating a
  container with a changed password against an existing volume leaves the OLD
  password active and silently ignores the new one (the new one fails
  authentication from a remote client; localhost hides this behind trust auth).
  That is the more dangerous case — the deployment looks like it accepted a
  rotated credential. Added ALTER ROLE as the fix.

- Documented POSTGRES_USER=tracepcap, but the real default everywhere else is
  tracepcap_user. Copying that block against an existing volume would trigger
  exactly the failure the adjacent warning describes. Corrected, and the
  first-init-only values are now flagged inline.

- The PR claimed no stale references remained; that held only for the file it
  touched. Fixed the same P@ssw0rd guidance in user-management.rst and
  offline-deployment.rst, and removed SPRING_DATASOURCE_PASSWORD from the
  environment-variables reference table — the variable exists nowhere in the
  codebase, and that table is where someone looks a variable up.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/operations/production-hardening.rst`:
- Around line 96-99: Update the password-rotation example to avoid passing the
new password through the ALTER ROLE command line. Show an interactive psql
session using \password <user>, or another secret-safe mechanism that prevents
exposure in shell history and process listings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ddf7c00c-308e-4695-8acf-a47db1bb6719

📥 Commits

Reviewing files that changed from the base of the PR and between 39ab76f and 5e67d55.

📒 Files selected for processing (4)
  • docs/configuration/environment-variables.rst
  • docs/configuration/user-management.rst
  • docs/getting-started/offline-deployment.rst
  • docs/operations/production-hardening.rst

Comment thread docs/operations/production-hardening.rst Outdated
The ALTER ROLE example added in the previous commit put the new password on the
command line, exposing it in shell history and the process list — and, since
ALTER ROLE ... WITH PASSWORD sends plaintext, in the server log too.

Replaced with psql's \password meta-command, which prompts for the value and
sends it pre-hashed.

Verified the documented procedure end to end: rotated a password via \password
against a live container, then confirmed over the network that the new password
authenticates and the old one is rejected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@NotYuSheng
NotYuSheng merged commit c9657cb into main Jul 28, 2026
3 checks passed
@NotYuSheng
NotYuSheng deleted the feature/hardening-doc-credential-drift branch July 28, 2026 04:12
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.

1 participant