Skip to content

backport: bitcoin#35117 i2p: clean up SAM error logging - #7661

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:codex/fix-i2p-session-error-redaction
Sep 9, 2026
Merged

PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:codex/fix-i2p-session-error-redaction

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

A failed I2P SAM SESSION CREATE request can expose the persistent destination private key in the node log. Generic SAM errors also echo raw router-controlled replies.

What was done?

Backport bitcoin#35117, commit b6c367044288f83ab61c1a77ad34c33adf39ecf6, without code changes. Use the existing redacted request for non-OK results and omit raw replies from both non-OK and missing-field errors. The complete upstream patch is included; no prerequisites or hunks are omitted.

How Has This Been Tested?

  • Full local macOS arm64 build with prebuilt depends: make -j15.
  • Existing I2P unit suite: ./src/test/test_dash --run_test=i2p_tests --log_level=message (3 cases passed).
  • Existing functional tests: p2p_i2p_ports.py and p2p_i2p_sessions.py (both passed using the existing Python environment with dash_hash).
  • Whitespace and assertion lint passed; the final patch ID matches the upstream commit.
  • No additional regression tests are included, matching the upstream patch and the review request.

Breaking Changes

No network behavior changes. Generic SAM error messages no longer include raw router replies.

Checklist:

  • I have performed a self-review of my own code
  • I have added or updated relevant unit/integration/functional/e2e tests

This pull request was created by Codex.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-08T22:00:18.934362Z cf8dbda New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7e6bdfd9-5d51-481b-8c94-a4f01fae6883

📥 Commits

Reviewing files that changed from the base of the PR and between 1b6e55c and cf8dbda.

📒 Files selected for processing (1)
  • src/i2p.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/i2p.cpp

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


Walkthrough

The I2P session error paths no longer include raw reply content. Unexpected-RESULT errors now use the sanitized request, which masks the private key in SESSION CREATE requests.

Priority: ➖ Normal

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

Merge Risk: ⚪ Minimal · up to cf8db

This change redacts I2P session destination private keys from relevant error diagnostics while retaining useful request context. No current merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the backport and the I2P SAM error-logging cleanup. It describes the primary change in a concise form.
Description check ✅ Passed The description directly explains the private-key leakage fix, the logging changes, the backported commit, and the validation performed.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@thepastaclaw

thepastaclaw commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit cf8dbda) · triage: critical · Phase 2 only (queue backlog)

knst
knst previously requested changes Sep 8, 2026

@knst knst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do backport bitcoin#35117 instead ; regressions tests also non-needed here IMO

Comment thread src/i2p.cpp Outdated
if (check_result_ok && reply.Get("RESULT") != "OK") {
throw std::runtime_error(
strprintf("Unexpected reply to \"%s\": \"%s\"", request, reply.full));
strprintf("Unexpected reply to \"%s\": \"%s\"", reply.request, reply.full));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do backport bitcoin#35117 instead ; regressions tests also non-needed here IMO

SESSION CREATE requests can contain the I2P private key. Keep using the redacted request text in error messages, and avoid echoing raw SAM replies in the generic reply error path.

This keeps the error useful while avoiding logging either the private-key-bearing request or unescaped router-controlled reply bytes. No network behavior change is intended.

(cherry picked from commit b6c3670)
@PastaPastaPasta
PastaPastaPasta force-pushed the codex/fix-i2p-session-error-redaction branch from 1b6e55c to cf8dbda Compare September 8, 2026 21:58
@PastaPastaPasta PastaPastaPasta changed the title fix: redact I2P session requests in error messages backport: bitcoin#35117 i2p: clean up SAM error logging Sep 8, 2026

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

LGTM

@PastaPastaPasta
PastaPastaPasta merged commit 3e00814 into dashpay:develop Sep 9, 2026
45 checks passed
@knst knst added this to the 24 milestone Sep 11, 2026

@knst knst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

post-utACK cf8dbda

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants