fix(autofix): require LLMO capability for LLMO auto-fix - #3036
Conversation
LLMO logins never carry the ASO `auto_fix` scope, so for LLMO (`x-product: LLMO`) requests the auto-fix access check falls back to plain org-membership (LLMO-6553), leaving LLMO auto-fix gated only on org membership. Add an early exit that also requires hasLlmoCapabilityForSite, matching the finer-grained capability gate used on other LLMO routes. S2S callers (authorized via CAP_FIX_ENTITY_CREATE, not FACS subjects) are exempt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Hey @ravverma,
⚠ Degraded review - no spec document was found for this change (searched the PR links, the touched repos' docs, the architecture/guidelines docs, and linked Jira). This review covers code-level quality but could not validate the change against an agreed design, so confidence is reduced. Add a spec link (PR template section 4) and re-request review for a full-confidence pass.
Verdict: Approve - clean, well-scoped authorization fix that follows established patterns.
Complexity: MEDIUM - small diff; API surface risk flag.
Changes: Adds LLMO capability enforcement to the auto-fix suggestions endpoint, closing an authorization gap where LLMO users were only gated by org membership (2 files).
Non-blocking (2): minor issues and suggestions
- suggestion: Assert the response body message in the 403 test to distinguish between the two nearby
forbidden()paths and guard against stub-wiring drift -test/controllers/suggestions.test.js:4462 - suggestion: Add a test verifying S2S callers with
x-product: LLMObypass the LLMO capability check (stubhasS2SCapabilityto{ allowed: true }, stubhasLlmoCapabilityForSitetofalse, assert request proceeds) -test/controllers/suggestions.test.js:4455
Skill: pr-review | Model: us.anthropic.claude-opus-4-6-v1[1m] | Duration: 1m 39s | Cost: $3.88 | Commit: 4b318e6ee2ba3c1633090299c55f25f6bf502a58
If this code review was useful, please react with 👍. Otherwise, react with 👎.
## [1.741.1](v1.741.0...v1.741.1) (2026-08-13) ### Bug Fixes * **autofix:** require LLMO capability for LLMO auto-fix ([#3036](#3036)) ([2c50d4a](2c50d4a))
|
🎉 This PR is included in version 1.741.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What
Adds an early exit to
autofixSuggestions(PATCH /sites/{siteId}/opportunities/{opportunityId}/suggestions/auto-fixes): when the request is for the LLMO product (x-product: LLMO) and the caller does not holdhasLlmoCapabilityForSite, the request is rejected with403.Why
LLMO logins never carry the ASO
auto_fixscope (dx_aem_perf_auto_fix), so for LLMO requests the existing access check intentionally falls back to plain org-membership (LLMO-6553). That left LLMO auto-fix gated only on org membership, not on the finer-grained LLMO capability that other LLMO routes already enforce. This closes that gap.How
hasAccessgate, requireaccessControlUtil.hasLlmoCapabilityForSite(site)whenxProduct === 'LLMO'.hasLlmoCapabilityForSite/llmoForbiddenMessagepair, same as the LLMO edge-optimize routes inllmo.js.CAP_FIX_ENTITY_CREATEand are not FACS subjects, so the gate is skipped whens2sResult.allowed— this avoids regressing the LLMO-6553 S2S path.Tests
403.207).auto-fix suggestionssuite (70 tests) and lint pass.🤖 Generated with Claude Code
Change Management