fix(logging): redact OpenTelemetry setup exception telemetry - #1713
seonghobae wants to merge 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe OpenTelemetry setup failure path now logs redacted exception details instead of raw tracebacks. A regression test checks sensitive-value exclusion and unchanged application state. Documentation records the contract, verification boundary, references, and integration gate. ChangesTelemetry exception redaction
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The telemetry setup failure path retains bounded diagnostic information without writing exception secrets or tracebacks to application logs. No actionable current-head risk remains. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review Please review exact base |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='2d6800aea110ac04eeedcd5faa91479f62877408'
head='76d54e20a020fb96e31554fd43fa3de2bf5053af'
echo '== Commit topology =='
git merge-base "$base" "$head"
git rev-list --left-right --count "$base...$head"
git diff --name-status "$base" "$head"
echo '== Exact diff =='
git diff --find-renames --find-copies --no-ext-diff "$base" "$head" -- \
backend/core/telemetry.py \
backend/tests/test_telemetry_exception_redaction.py \
docs/doctoring/otel-exception-telemetry.md
echo '== telemetry module outline =='
ast-grep outline backend/core/telemetry.py --items all --view expanded || true
echo '== safe_logging candidates =='
fd -a -i 'safe_logging' backend || true
rg -n -C 5 '\bdef\s+redacted_exception_info\b|\bredacted_exception_info\s*\(' backend/core
echo '== Relevant source ranges =='
sed -n '1,280p' backend/core/telemetry.py
safe_file=$(fd -a -i 'safe_logging.py' backend | head -n1 || true)
if [ -n "$safe_file" ]; then
echo "== $safe_file =="
ast-grep outline "$safe_file" --items all --view expanded || true
sed -n '1,320p' "$safe_file"
fi
echo '== Regression test =='
cat -n backend/tests/test_telemetry_exception_redaction.py
echo '== Doctoring =='
cat -n docs/doctoring/otel-exception-telemetry.mdLength of output: 24083 🏁 Script executed: #!/bin/bash
set -euo pipefail
base='2d6800aea110ac04eeedcd5faa91479f62877408'
head='76d54e20a020fb96e31554fd43fa3de2bf5053af'
repo='ContextualWisdomLab/naruon'
pr='1713'
echo '== Static patch checks =='
git diff --check "$base" "$head"
git diff --word-diff=porcelain "$base" "$head" -- backend/core/telemetry.py
echo '== PR head and merge state =='
gh pr view "$pr" --repo "$repo" \
--json number,state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup \
--jq '{number,state,isDraft,headRefOid,baseRefOid,mergeStateStatus,reviewDecision,statusCheckRollup: [.statusCheckRollup[] | {name,conclusion,status}]}' || true
echo '== Reviews and review threads =='
gh api "repos/$repo/pulls/$pr/reviews" --paginate \
--jq '.[] | {user: .user.login, state, commit_id, submitted_at}' || true
gh api graphql -F owner='ContextualWisdomLab' -F name='naruon' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes { isResolved comments(first: 10) { nodes { author { login } body path originalLine } } }
}
}
}
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)' || trueLength of output: 2776
I did not execute repository tests. GitHub currently reports this PR as Draft. The queried status rollup has no terminal conclusions, and no submitted reviews or unresolved review threads were returned. The required exact-head hosted checks and independent review remain pending.
|
|
Focused source-equivalent RED/GREEN receipt (not hosted merge evidence): I materialized the exact #1700 helper + #1713 telemetry/test contents into an isolated local Python harness and ran only This receipt is deliberately scoped: it validates the causal formatter contract, not the full repository checkout, hosted required contexts, dependency lock, or merge authority. Exact-head workflow inventory remains zero because this is a stacked PR. CodeRabbit selected the exact 3-file range but reported its review-capacity limit, so no formal independent approval is claimed. |
|
@coderabbitai review Please review the unchanged exact range |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base='2d6800aea110ac04eeedcd5faa91479f62877408'
head='76d54e20a020fb96e31554fd43fa3de2bf5053af'
echo '== Topology and changed paths =='
git merge-base "$base" "$head"
git rev-list --left-right --count "$base...$head"
git diff --name-status "$base" "$head"
git diff --check "$base" "$head"
echo '== Exact 3-file diff =='
git diff --find-renames --find-copies --no-ext-diff "$base" "$head" -- \
backend/core/telemetry.py \
backend/tests/test_telemetry_exception_redaction.py \
docs/doctoring/otel-exception-telemetry.md
echo '== telemetry.py outline and relevant content =='
ast-grep outline backend/core/telemetry.py --items all --view expanded || true
sed -n '1,320p' backend/core/telemetry.py
echo '== safe_logging definition and all call contexts =='
safe_file=$(fd -a -i 'safe_logging.py' backend | head -n1 || true)
if [ -n "$safe_file" ]; then
echo "== $safe_file outline =="
ast-grep outline "$safe_file" --items all --view expanded || true
sed -n '1,360p' "$safe_file"
fi
rg -n -C 4 '\bredacted_exception_info\s*\(' backend --glob '*.py'
echo '== Regression test =='
cat -n backend/tests/test_telemetry_exception_redaction.py
echo '== Doctoring =='
cat -n docs/doctoring/otel-exception-telemetry.md
echo '== Prior handler and current handler context =='
git show "$base:backend/core/telemetry.py" | sed -n '1,320p'
echo '--- current ---'
git show "$head:backend/core/telemetry.py" | sed -n '1,320p'Length of output: 36684
I did not execute repository code or tests in this review environment. The focused local receipt in the discussion supports the formatter-level causal contract, but it does not replace exact-head hosted checks or an independent review. ✅ Action performedReview finished.
|
Refs #1698.
Current authority
2d6800aea110ac04eeedcd5faa91479f6287740876d54e20a020fb96e31554fd43fa3de2bf5053afbackend/core/telemetry.py,backend/tests/test_telemetry_exception_redaction.py,docs/doctoring/otel-exception-telemetry.mdVerified finding
setup_telemetry()retainedlogger.exception("OpenTelemetry setup failed; continuing without tracing."). Python logging renders the current exception information on that path. OTLP/exporter/instrumentation failures may carry connection strings, provider response text, tokens, or internal paths, so the original value and traceback can enter the ordinary application log. This is a bounded CWE-532 / OWASP Logging Cheat Sheet confidentiality gap, not a telemetry architecture rewrite.RED → minimal causal repair
Test-first commit
d7289799e2661ad3ebbf5c309579ec8bdc45738binjects a secret-bearingRuntimeErrorat the real OpenTelemetry import boundary and formats the resulting log record. It requires the operation label, exception type, andexception_fingerprint=while rejecting a token-shaped value, PostgreSQL connection string, internal path, and traceback header. The predecessorlogger.exception()behavior cannot satisfy this contract.Production repair
96446d87fdbf59de1868a55f01be999990d31df8consumes #1700'score.safe_logging.redacted_exception_info()helper. Log severity and the fixed operation message remain unchanged; raw exception value/traceback are no longer attached. Application behavior still fails open only with respect to tracing itself: telemetry setup failure continues without tracing exactly as before.Doctoring
76d54e20a020fb96e31554fd43fa3de2bf5053afrecords scope, rejected alternatives, evidence limits, and traceability to Python 3.14 logging, CWE-532, and OWASP Logging Cheat Sheet. This PR intentionally does not alter the existing OTEL bootstrap environment-variable boundary or create a second sanitizer.Independent review
CodeRabbit reviewed exact unchanged range
2d6800aea110ac04eeedcd5faa91479f62877408 → 76d54e20a020fb96e31554fd43fa3de2bf5053afand submitted formal APPROVED reviewPRR_kwDOSNjZ2s8AAAABN4zxWAat2026-09-16T18:48:02Z. Fresh review-thread inventory is empty. This satisfies the current-head independent-review lane only while the head remains unchanged; it does not substitute for hosted required contexts.Evidence boundary
Fresh exact-head repository workflow lookup for
76d54e20...still returns zero PR-triggered repository workflows despite the material three-file delta and exact valid stacked parent. This is another #1691 stacked-admission RED, not hosted GREEN. Parent #1700 receipts/reviews do not transfer.A focused source-equivalent regression harness previously reproduced the predecessor disclosure and passed after the bounded-helper repair, but this connector session has not executed the full repository test suite or a hosted CI job. Keep that distinction explicit.
Keep Draft until #1700 reaches valid protected ancestry and this unchanged effective delta obtains every then-live required context terminal-success with zero valid findings/threads and qualifying post-last-push independent review. No temporary
developretarget, workflow copy, dummy/no-op evidence commit, synthetic status, self-approval, force push, destructive rebase, or gate weakening.Summary by CodeRabbit
Bug Fixes
Documentation