iflytek/astron-agent · error · BusinessException

EXCEED_AUTHORITY

EXCEED_AUTHORITY

Error message

BusinessException(ResponseEnum.EXCEED_AUTHORITY)

What it means

selfModelConfig verifies that the current user (from UserInfoManagerHandler) owns the model row. If the stored uid differs from the caller's uid, it throws BusinessException(EXCEED_AUTHORITY): the user is attempting to read/modify another user's custom model configuration.

Solutions

  1. Confirm the caller owns the model id before calling the endpoint
  2. Check the auth token/session is valid and resolves to the expected userId
  3. Do not reuse model ids from other users or spaces in clients
  4. If admin access is needed, add an explicit admin path rather than bypassing ownership
Defensive patterns

Strategy: validation

Validate before calling

// ownership check before calling
Model m = modelMapper.selectById(id);
if (m == null || !Objects.equals(currentUserId, m.getUid())) {
    throw new SecurityException("model " + id + " is not owned by the current user");
}

Try / catch

try {
    llmService.selfModelConfig(id, 0);
} catch (BusinessException e) {
    // EXCEED_AUTHORITY: return 403-style response, do not retry
}

Prevention

When it happens

Trigger: Authenticated user A requests self-model config for a model id owned by user B. Also occurs when the auth context is missing/misresolved so uid resolves to a different (or empty) identity than the model owner.

Common situations: Sharing model ids across accounts/spaces; broken auth header so userId resolves incorrectly; admin tooling acting without impersonation; id guessed/enumerated by a client.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/cdbe7a477692e347. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/LLMService.java:553

                        .fluentPut("patchId", patchId));
            }
        });

        return array;
    }

    public Object selfModelConfig(Long id, Integer llmSource) {
        if (llmSource != 0) {
            throw new BusinessException(ResponseEnum.NOT_CUSTOM_MODEL);
        }
        String uid = UserInfoManagerHandler.getUserId();

        Model one = modelMapper.selectOne(new LambdaQueryWrapper<Model>().eq(Model::getId, id));
        if (one == null) {
            throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);
        }
        if (!Objects.equals(uid, one.getUid())) {
            throw new BusinessException(ResponseEnum.EXCEED_AUTHORITY);
        }
        List<Config> configs = JSON.parseArray(one.getConfig(), Config.class);
        if (CollUtil.isNotEmpty(configs)) {
            for (Config config : configs) {
                Float precision = config.getPrecision();
                if (precision != null) {
                    // If precision is an integer greater than 1, convert to decimal form, e.g., 1 to 0.1, 2 to 0.01,
                    // etc.
                    int intPrec = Math.round(precision);
                    if (precision >= 1 && Math.abs(precision - intPrec) < 1e-6) {
                        float newPrec = 1f / (float) Math.pow(10, intPrec);
                        config.setPrecision(newPrec);
                    }
                }
            }
        }
        return ApiResult.success(configs);
    }

View on GitHub (pinned to 5e758547a8)