Skip to content

feat(otel): use dedicated least-privilege monitoring user for OTel Collector sidecar #344

Closed

Description

@WentingWu666666

Summary

The OTel Collector sidecar (added in #342) currently uses PGUSER/PGPASSWORD from the <cluster>-app secret (the CNPG application user) to connect to PostgreSQL. Following the principle of least privilege, the sidecar should use a dedicated monitoring user with only pg_monitor role access.

Motivation

  • Least privilege: The monitoring sidecar only needs to run health-check queries and read pg_stat_* views — it should not have application-level read/write access.
  • Audit clarity: Monitoring queries would be attributable to a separate role in pg_stat_activity.
  • Future-proof: pg_monitor already grants read access to all stats views, supporting richer metrics without needing superuser.
  • Blast radius: If the OTel Collector is compromised, the attacker only gets read-only stats access.

Proposed Implementation

  1. Operator creates a dedicated otel_monitor PostgreSQL role with pg_monitor grant
  2. Store credentials in a dedicated secret (e.g., <cluster>-otel-monitor)
  3. OTel sidecar reads from the dedicated secret instead of <cluster>-app

Context

Raised by @xgerman in PR #342 review: #342 (comment)

Activity

  1. added
    enhancement
    on Apr 17, 2026
  2. added
    go
    on Apr 29, 2026
  3. documentdb-triage-tool commented on Apr 29, 2026

    @documentdb-triage-tool

    🤖 Auto-triaged by documentdb-triage-tool.

    Applied: go
    Project fields suggested: Component controllers · Priority P2 · Effort L · Status Triage
    Confidence: 0.80 (llm)

    Reasoning

    LLM: Security-motivated least-privilege refactor touching role creation, secret management, and OTel sidecar configuration across multiple controller components.

    If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

  4. moved this from In progress to In review in DocumentDB k8s operator planning boardon Jul 28, 2026
  5. documentdb-triage-tool commented on Aug 27, 2026

    @documentdb-triage-tool

    👋 @udsmicrosoft — this issue has been assigned for 56 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

  6. documentdb-triage-tool commented on Sep 11, 2026

    @documentdb-triage-tool

    👋 @udsmicrosoft — this issue has been assigned for 14 days with no activity. Is it still in progress? If you've made progress, please leave a quick update. Otherwise it'll be flagged for re-assignment at the next triage meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgo

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions