adding openspec proposal #2428
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!2428
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/2428/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #1960
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1960
Original created: 2025-11-19T19:13:40Z
Original updated: 2025-11-20T03:44:35Z
Original head: carverauto/serviceradar:chore/fixing_kv_seeding_k8s
Original base: main
Original merged: 2025-11-20T03:43:57Z by @mfreeman451
User description
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
PR Type
Enhancement, Documentation
Description
Add KV store automatic seeding proposal for ServiceRadar components
Define configuration precedence: Pinned FS > KV > Default FS
Specify requirements and test scenarios for configuration management
Outline implementation tasks across Go, Rust, and Kubernetes
Diagram Walkthrough
File Walkthrough
proposal.md
KV seeding proposal with configuration precedence designopenspec/changes/add-kv-seeding/proposal.md
components
spec.md
KV configuration specification with requirements and scenariosopenspec/changes/add-kv-seeding/specs/kv-configuration/spec.md
settings
tasks.md
Implementation tasks for KV seeding across servicesopenspec/changes/add-kv-seeding/tasks.md
libraries
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1960#issuecomment-3554248786
Original created: 2025-11-19T19:14:07Z
PR Compliance Guide 🔍
(Compliance updated until commit
github.com/carverauto/serviceradar@4e00bea9c6)Below is a summary of compliance checks for this PR:
Insecure TLS fallback
Description: The NATS mTLS connection setup allows proceeding without TLS if any of cert, key, or CA
file is missing (it only applies nats.Secure when all three are set), which can silently
downgrade to an unauthenticated/plain connection if KV_SEC_MODE is set to mTLS but files
are misconfigured, risking interception or unauthorized access.
kv_client.go [647-706]
Referred Code
Unpinned container image
Description: The CNPG operator Deployment container image is set to a placeholder 'controller:latest'
without a pinned registry, digest, or trusted source, enabling image spoofing or
supply-chain compromise in cluster.
operator.yaml [44-66]
Referred Code
Secret material handling
Description: The script creates a Kubernetes Secret from locally generated TLS material and applies it
directly, which may leave sensitive key files on disk and risks accidental commit or
exposure if OUT_DIR is shared; advise secure temp handling and explicit cleanup.
generate-nats-certs.sh [75-83]
Referred Code
Insecure test file input
Description: The test writes base64-decoded TLS keys and certs to disk with file mode 0600 but also
attempts to read arbitrary paths from NATS_*_B64 env vars, allowing path traversal if
misused in shared CI environments; ensure values are validated and paths are restricted to
test temp dir.
kv_seeding_test.go [281-301]
Referred Code
Unbounded watch buffering
Description: The watch goroutine forwards raw KV values (or nil on delete) without size limits or
context-based backpressure, which could enable memory pressure/DoS if an attacker floods
KV updates; consider bounded buffering and drop/merge strategies.
client.go [83-125]
Referred Code
🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status: Passed
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status: Passed
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status: Passed
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status:
Config Observability: The new logging of merged configuration (with redaction) improves observability but there
is no explicit audit trail added for critical actions; confirm if configuration changes
and KV writes are logged with user/context elsewhere.
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Watch Error Handling: The NATS KV watch goroutine ignores watcher.Stop errors and may not surface reconnection
or parsing failures; verify higher-level retry/backoff and error logging cover these edge
cases.
Referred Code
Compliance status legend
🟢 - Fully Compliant🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label
Previous compliance checks
Compliance check up to commit 2b7adee
No security concerns identified
No security vulnerabilities detected by AI analysis. Human verification advised for critical code.🎫 No ticket provided
Codebase context is not defined
Follow the guide to enable codebase context checks.
Generic: Meaningful Naming and Self-Documenting Code
Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting
Status: Passed
Generic: Comprehensive Audit Trails
Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.
Status:
Auditing Undefined: The proposal introduces automatic KV seeding and precedence changes but does not specify
audit logging of these critical configuration actions (who/when/what/outcome).
Referred Code
Generic: Robust Error Handling and Edge Case Management
Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation
Status:
Edge Cases Missing: The spec defines desired behaviors but lacks handling guidance for failures like
missing/invalid default files, KV write errors, or partial merges, which are likely at
seeding time.
Referred Code
Generic: Secure Error Handling
Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.
Status:
Error Exposure Unset: The proposal does not specify user-facing vs. internal error messaging for configuration
load/seed failures, risking accidental leakage of internals.
Referred Code
Generic: Secure Logging Practices
Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.
Status:
Logging Undefined: New seeding and precedence operations are not accompanied by guidance on structured logs
or prohibiting sensitive config values from being logged.
Referred Code
Generic: Security-First Input Validation and Data Handling
Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities
Status:
Validation Gaps: The spec lacks requirements for validating configuration content from KV/FS, handling
schema/versioning, and protecting pinned security-sensitive keys from unsafe overrides.
Referred Code
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1960#issuecomment-3554252795
Original created: 2025-11-19T19:15:16Z
PR Code Suggestions ✨
Explore these optional code suggestions:
Clarify configuration merging strategy
The proposal should specify whether the configuration merging strategy is a deep
merge or a shallow replacement of top-level keys. This is needed to ensure
consistent behavior between the Go and Rust implementations for nested
configuration objects.
Examples:
openspec/changes/add-kv-seeding/specs/kv-configuration/spec.md [22-23]
Solution Walkthrough:
Before:
After:
Suggestion importance[1-10]: 9
__
Why: This suggestion highlights a critical ambiguity in the design proposal; failing to define the merge strategy for nested configurations could lead to major inconsistencies between the Go and Rust implementations.
✅
Clarify config merging and seedingSuggestion Impact:
The previous "Seeding missing config" and "Existing config preservation" sections were removed, aligning with the suggestion to change the seeding behavior toward a merge-based approach. Additionally, a "Configuration Precedence" requirement (KV over default, with pinned overriding KV) was added, reflecting part of the suggested precedence/merge intent, though without explicitly stating deep-merge or writing back the merged config.code diff:
Update the specification to mandate a deep merge of the default and KV
configurations, writing the result back to the KV store, to handle partial
configurations and new default values correctly.
openspec/changes/add-kv-seeding/specs/kv-configuration/spec.md [6-20]
[Suggestion processed]Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a critical design flaw where new default configuration values would not be applied if any configuration already exists, and proposes a robust deep-merge strategy to fix it.
Prevent seeding race conditions
Modify the specification to require an atomic write operation during KV seeding
to prevent race conditions when multiple service instances start simultaneously.
openspec/changes/add-kv-seeding/specs/kv-configuration/spec.md [6-13]
Suggestion importance[1-10]: 9
__
Why: This suggestion addresses a critical race condition that would occur in a multi-instance environment, proposing an atomic operation for seeding, which is essential for the feature's reliability.
Improve configuration change observability
Add a requirement for services to expose their final, merged configuration
(e.g., via logs or an API endpoint) to improve observability and aid debugging.
openspec/changes/add-kv-seeding/proposal.md [8-11]
Suggestion importance[1-10]: 8
__
Why: This is a valuable suggestion that improves the operability and debuggability of the system by making the final, effective configuration observable, which is crucial in a system with multiple configuration sources.