[fix][evaluation] enforce authorization on eval-target debug/async-debug, template update, and evaluator delete/draft-update#585
Merged
Conversation
DebugEvalTarget 入口的 space 级 debug 鉴权此前被整段注释,任何登录用户可跨 workspace 触发调试执行并写入评测记录。恢复 e.auth.Authorization 校验,补充无权限被拒单测。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…emplate 写接口此前只做空间级 list/read 权限校验,同空间低权限用户可越权修改他人模板。改为先取模板拿 owner,再用 AuthorizationWithoutSPI 做对象级 edit 校验(对齐 UpdateExperiment),补充无 edit 权限被拒单测。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ype confusion DeleteEvaluator 改用带空间校验的 GetEvaluator(跨空间/查不到返回 NotExist 并拒删),消除空结果跳过鉴权的隐患;UpdateEvaluatorDraft 的 CustomRPC/Agent 写门禁改按服务端真实类型触发,并增加请求类型与服务端类型一致性校验,堵住类型混淆写入。补充相应单测。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
VinCinx
previously approved these changes
Jul 20, 2026
xueyizheng
previously approved these changes
Jul 20, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #585 +/- ##
==========================================
+ Coverage 77.44% 77.47% +0.02%
==========================================
Files 678 679 +1
Lines 80813 80845 +32
==========================================
+ Hits 62589 62631 +42
+ Misses 14491 14484 -7
+ Partials 3733 3730 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
AsyncDebugEvalTarget 与 DebugEvalTarget 同源:入口鉴权此前被整段注释,异步调试路径可未授权跨 workspace 触发。恢复 space 级 debug 鉴权,补无权限被拒单测。前端对象调试功能同时使用同步/异步两条路径,需一并修复才能真正闭合。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
xueyizheng
self-requested a review
July 20, 2026 08:29
xueyizheng
approved these changes
Jul 20, 2026
VinCinx
self-requested a review
July 20, 2026 08:33
VinCinx
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix authorization gaps in the evaluation module's application layer:
DebugEvalTarget/AsyncDebugEvalTarget— the authorization call wascommented out in both the sync and async eval-target debug handlers, so any
authenticated caller could trigger a debug run against an arbitrary
workspace_id. Restored the space-levelAuthorizationcheck(
ActionDebugEvalTarget/AuthEntityType_Space) on both. (The frontend"debug target" feature calls both endpoints depending on sync/async mode, so
both must be fixed.)
UpdateExperimentTemplate— the write path only checked space-levelread/list permission, allowing a low-privilege member to modify templates
owned by others. Switched to an object-level edit check
(
AuthorizationWithoutSPIwith the template's owner), consistent withUpdateExperiment.DeleteEvaluator— authorization relied on the result of an unfilteredbatch lookup; an empty result silently skipped the auth check and fell
through to a global-id soft delete. Reworked to use the space-scoped
GetEvaluator, returnEvaluatorNotExistCodewhen not found, and authorizeagainst the resolved object — aligned with
UpdateEvaluator.UpdateEvaluatorDraft— the CustomRPC/Agent write gate keyed off theclient-supplied
evaluator_type, while persistence used the server object'sreal type (type confusion): a caller could declare a non-CustomRPC type to
skip the gate yet still write CustomRPC content. The gate now keys off the
server-side type, plus a consistency check that rejects a request whose
declared type does not match the stored object.
Why
Each is an authorization boundary defect: missing (1), downgraded to a weaker
permission (2), auth object vs. write object mismatch (3), or auth decision
driven by client-controllable input (4).
Tests
Added/updated unit tests covering the unauthorized/mismatched paths for all
handlers (permission-denied, not-found rejection, cross-space rejection,
type-mismatch rejection). All evaluation application tests pass:
cd backend && go test -gcflags="all=-N -l" ./modules/evaluation/application/...