Skip to content

Redact path-embedded Newznab credentials - #468

Draft
aryan-j wants to merge 2 commits into
Appz4Fun:mainfrom
aryan-j:agent/redact-getnzb-path-credentials
Draft

Redact path-embedded Newznab credentials#468
aryan-j wants to merge 2 commits into
Appz4Fun:mainfrom
aryan-j:agent/redact-getnzb-path-credentials

Conversation

@aryan-j

@aryan-j aryan-j commented Jul 29, 2026

Copy link
Copy Markdown

What changed

  • redact Newznab download credentials embedded in non-standard /getnzb/*.nzb&i=...&r=... URL paths
  • apply the same protection to free-form exception and error text
  • keep short i and r parameters untouched outside getnzb-shaped paths
  • add regression coverage for URL and text redaction

Why

Some Newznab indexers return NZB download links without a ?, which makes account and API credentials part of the parsed URL path. Existing query-parameter redaction therefore leaves those values visible in logs and error messages.

Validation

  • just lint: passed (Ruff, Black, Pylint 10.00/10, Python 3.8 Vermin gate)
  • focused HTTP utility tests: passed as part of the full suite
  • just test: 2,587 passed, 2 skipped; 3 unrelated existing Windows-environment/timing failures (test_install_nzbdav_addon_script and two completed-hint latency tests)

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 54 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: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e34d9f6b-036f-4382-834d-edf0835ae96a

📥 Commits

Reviewing files that changed from the base of the PR and between 38fcf74 and 9136960.

📒 Files selected for processing (2)
  • repo/plugin.video.nzbdav/resources/lib/http_util.py
  • tests/test_http_util.py
📝 Walkthrough

Walkthrough

Credential redaction now handles Newznab-style i and r values embedded in GETNzb URL paths. URL and free-form text redaction apply the scoped rewrite, while unrelated short parameters remain unchanged. Tests cover both behaviors.

Changes

GETNzb path credential redaction

Layer / File(s) Summary
Path matching, redaction, and tests
repo/plugin.video.nzbdav/resources/lib/http_util.py, tests/test_http_util.py
Adds scoped matching for &i= and &r= credentials in GETNzb-like paths, applies redaction in redact_url() and redact_text(), and tests preservation outside GETNzb paths.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: xbmc4lyfe

Poem

A rabbit hops where GETNzb keys once lay,
Scrubbing secret trails from paths away.
The matching ears know where to tread,
While other little params stay spread.
“REDACTED!” the bunny cheers—
Safer URLs for all these years!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: redacting Newznab credentials embedded in URL paths.
Description check ✅ Passed The description directly matches the changeset by describing the redaction behavior, scope, and added tests.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


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 requested a review from xbmc4lyfe July 29, 2026 11:53
@codacy-production

codacy-production Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@repo/plugin.video.nzbdav/resources/lib/http_util.py`:
- Around line 160-161: Update the GETNzb handling in redact_url() so
_GETNZB_PATH_CRED_RE is applied only to matched URL path components, not the
entire free-form redacted string. Preserve unrelated URLs, ordinary text, and
query parameters, and add a regression test covering a message containing both a
GETNzb URL and unrelated content.
🪄 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: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 50fd7b21-c0b4-4b26-a4e3-e4adb44f9cf4

📥 Commits

Reviewing files that changed from the base of the PR and between 000221a and 38fcf74.

📒 Files selected for processing (2)
  • repo/plugin.video.nzbdav/resources/lib/http_util.py
  • tests/test_http_util.py
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (4)
repo/plugin.video.nzbdav/resources/lib/http_util.py (2)

44-53: LGTM!


104-107: LGTM!

tests/test_http_util.py (2)

232-249: LGTM!


306-319: LGTM!

Comment on lines +160 to +161
if "getnzb" in redacted.lower() or ".nzb&" in redacted.lower():
redacted = _GETNZB_PATH_CRED_RE.sub(r"\1=REDACTED", redacted)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Scope GETNzb redaction to URL paths.

Unlike redact_url(), this applies _GETNZB_PATH_CRED_RE to the entire free-form string once any getnzb marker is present. It therefore redacts unrelated &i=/&r= parameters in another URL, ordinary text, or even the query portion of the same URL. Apply the substitution only to matched URL paths and add a mixed-message regression test.

🤖 Prompt for 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.

In `@repo/plugin.video.nzbdav/resources/lib/http_util.py` around lines 160 - 161,
Update the GETNzb handling in redact_url() so _GETNZB_PATH_CRED_RE is applied
only to matched URL path components, not the entire free-form redacted string.
Preserve unrelated URLs, ordinary text, and query parameters, and add a
regression test covering a message containing both a GETNzb URL and unrelated
content.

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.

1 participant