Skip to content

fix: expose param override audits for sensitive message fields - #4974

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/expose-messages-fields
May 19, 2026
Merged

fix: expose param override audits for sensitive message fields#4974
seefs001 merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/expose-messages-fields

Conversation

@seefs001

@seefs001 seefs001 commented May 19, 2026

Copy link
Copy Markdown
Collaborator

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)

完善参数覆盖记录的字段

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features

    • Parameter override details in usage logs are now visible to all users, previously restricted to administrators only.
  • Refactor

    • Parameter override audit detection logic updated to improve accuracy in identifying sensitive operation paths through enhanced prefix matching.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6df991f8-82fc-44f5-92ed-3e3fd4298227

📥 Commits

Reviewing files that changed from the base of the PR and between 146dd77 and 50c7051.

📒 Files selected for processing (3)
  • relay/common/override.go
  • relay/common/override_test.go
  • web/default/src/features/usage-logs/components/dialogs/details-dialog.tsx

Walkthrough

This PR refactors the parameter override audit system by replacing exact-key matching with prefix-based path sensitivity detection, extending audit coverage to include operation.From paths, and removes the admin-only restriction from displaying param override audit data in the frontend UI.

Changes

Audit Path Sensitivity and Operation Coverage

Layer / File(s) Summary
Prefix-based Path Sensitivity Refactoring
relay/common/override.go, relay/common/override_test.go
Introduces paramOverrideSensitivePathPrefixes slice and refactors shouldAuditParamPath to use field-boundary prefix matching instead of exact-key lookup. Unit test verifies boundary-aligned prefix matching behavior and correctly rejects non-boundary prefixes.
Extended Operation Audit Coverage
relay/common/override.go, relay/common/override_test.go
Extends shouldAuditOperation to evaluate operation.From in addition to operation.Path and operation.To. Integration test validates the full flow of recording conversation/body operations and their corresponding ParamOverrideAudit entries.
Frontend Param Override Display Permission
web/default/src/features/usage-logs/components/dialogs/details-dialog.tsx
Removes props.isAdmin requirement from the "Param override" section render condition, making the audit data visible to all users when present.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • QuantumNous/new-api#3285: Direct refinement of the param-override audit feature introduced in this earlier PR, updating path sensitivity logic and expanding audited operation fields.
  • QuantumNous/new-api#1603: Earlier implementation of the centralized parameter-override system with ApplyParamOverride and operations model that this PR extends with enhanced audit coverage.

Suggested reviewers

  • Calcium-Ion

Poem

🐰 With prefix paths so wise, the audit grows keen,
From operation to From, all paths are seen.
Admin gates removed, transparency reigns,
The override truth in databases remains. ✨

✨ 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 and usage tips.

@seefs001
seefs001 merged commit 0d4b257 into QuantumNous:main May 19, 2026
1 of 2 checks passed
reggie-lula pushed a commit to WhaleCrane/new-api-hz that referenced this pull request May 21, 2026
SamuelSxy pushed a commit to SamuelSxy/new-api-rh that referenced this pull request Jun 7, 2026
fx247562340 pushed a commit to fx247562340/vancine-platform that referenced this pull request Jun 11, 2026
330079598 pushed a commit to 330079598/new-api that referenced this pull request Aug 19, 2026
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.

1 participant