Skip to content

fix(admin): redact nested webhook urls in settings-change notifications - #1295

Merged
cameri merged 2 commits into
cameri:mainfrom
Priyanshubhartistm:fix/settings-notification-redact-nested-urls
Nov 30, 2026
Merged

cameri merged 2 commits into
cameri:mainfrom
Priyanshubhartistm:fix/settings-notification-redact-nested-urls

Conversation

@Priyanshubhartistm

@Priyanshubhartistm Priyanshubhartistm commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

PATCH /admin/settings builds a settings.changed notification and redacts secrets in it in two steps:

  • redactSettingsValue(path, value) for each change, which only replaced a string value at a sensitive path (passwordHash, secret, botToken or an admin.notifications.targets…url), and returned an object or array as it was;
  • redactSettingsSecrets(changes) on the list of { path, value, reload } records, which walks the list with paths such as [0].value.targets[0].url. The rule for a webhook url is path.startsWith('admin.notifications.targets'), so it never matches there.

So when the changed path is a parent of the webhook targets, for example admin.notifications or admin, the value is the whole object and the url of each target is sent to the notification recipients unredacted.

  • redactSettingsValue now walks an object or array value with the path it was written at (admin.notifications.targets[0].url), so the rules that already exist apply to the nested values;
  • redactSettingsSecrets uses the same walk, so nothing else changes for it;
  • the response of the settings request uses the same function, so it no longer echoes the url either.

Related Issue

Partly addresses #1022 (F-041). The other findings in that issue are handled separately.

Motivation and Context

A webhook url holds a token (a Discord or Slack webhook). The settings API and the dedicated notifications endpoint already hide it, and the settings-change notification is the one place that sent it to the recipients. CodeRabbit's scan did not establish reachability, so I checked the code: the path rule is startsWith('admin.notifications.targets') and the walk in redactSettingsSecrets starts at the list, so a parent-path change is not caught.

How Has This Been Tested?

  • New test in test/unit/utils/settings-redaction.spec.ts for a value written at admin.notifications, at admin.notifications.targets and at admin.
  • New test in test/unit/controllers/admin/patch-settings-controller.spec.ts: replacing admin.notifications puts no webhook url in the outbox payload or in the response. Both tests fail without the change.
  • pnpm run test:unit, pnpm lint and pnpm run build:check.

Screenshots (if appropriate):

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

Summary by CodeRabbit

  • Bug Fixes
    • Webhook URLs are masked in settings notifications and request responses, including when an entire parent settings path is replaced rather than an individual nested value.
    • Sensitive values remain hidden when paths include surrounding whitespace, while unrelated notification targets and recipient fields continue to appear unchanged.
    • Nested sensitive values are redacted consistently across settings updates and returned settings data.

Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
@changeset-bot

changeset-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a72384f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Settings redaction now recursively checks nested values beneath the supplied path. Tests cover webhook URL redaction in settings values, notification payloads, and responses, including paths with whitespace. A patch changeset documents the update.

Changes: Settings Redaction

Layer / File(s) Summary
Path-based recursive redaction
src/utils/settings-redaction.ts, test/unit/utils/settings-redaction.spec.ts, test/unit/controllers/admin/patch-settings-controller.spec.ts, .changeset/settings-notification-redact-nested-urls.md
The shared traversal recursively redacts non-empty strings at sensitive paths. Path checks trim the supplied path and its segments. Tests cover nested values and verify that replacing admin.notifications masks webhook URLs in notification payloads and responses. The changeset describes the patch.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • Issue 1022 describes settings-change notifications that fail to redact nested webhook URLs after a parent path is replaced. This PR adds nested redaction using the supplied path, addressing the described F-041 finding.
  • Issue 1193 describes container-valued settings writes echoing secrets in responses and outbox payloads. This PR addresses the TypeScript redaction behavior, but the Rust implementation mentioned in the issue is not included.
Merge Risk: Minimal · up to a7238

This change stops webhook URLs from appearing in notifications and settings responses when a parent settings path is replaced. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: nested webhook URLs are now redacted in settings-change notifications. It follows the conventional fix(scope) form and matches the PR objectives, which cover redacting…
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.
Full details: Title check

Explanation

The title names the main change: nested webhook URLs are now redacted in settings-change notifications. It follows the conventional fix(scope) form and matches the PR objectives, which cover redacting nested webhook URLs when PATCH /admin/settings changes a parent setting such as admin.notifications.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks each setting path,
And masks the webhook in its track.
Through nested fields, the secrets hide,
In payloads and responses, side by side.
Whiskers twitch; the tests pass by.

Recent review info

Automatic approval policy

Commit: a72384f593ef.

Setting Effective value Source
Automatic approvals Enabled Global configuration
Merge risk Minimal Global configuration
Security risk Not set Global configuration

Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7702fec2-b000-47cf-8f60-2cd8547ab092
Commits

Reviewing files that changed from the base of the PR and between df1f672 and a72384f.

Files selected for processing: 3

  • src/utils/settings-redaction.ts
  • test/unit/controllers/admin/patch-settings-controller.spec.ts
  • test/unit/utils/settings-redaction.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; the previous webhook-token leak through whitespace paths is fixed.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous webhook-token leak through whitespace paths is fixed.

Summary

The PR hides nested webhook URLs when an admin replaces a parent settings path.

  • Settings updates hide webhook URLs nested inside replaced parent paths.

Reviews (2) · Last reviewed commit: "fix(admin): read a settings path the way..." · Reviewed by Greptile

Comment thread src/utils/settings-redaction.ts Resolved
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 29, 2026
@coveralls

coveralls commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 46316944317

Warning

No base build found for commit c14342e on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 80.85%

Details

  • Patch coverage: 23 of 23 lines across 1 file are fully covered (100%).

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 15443
Covered Lines: 12986
Line Coverage: 84.09%
Relevant Branches: 8547
Covered Branches: 6410
Branch Coverage: 75.0%
Branches in Coverage %: Yes
Coverage Strength: 715.9 hits per line

💛 - Coveralls

…n redacting

Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
@cameri
cameri merged commit 1b957d4 into cameri:main Nov 30, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants