Skip to content

Fix the method for verifying the existence of the appkey#6425

Closed
KANLON wants to merge 2 commits into
apache:masterfrom
KANLON:fix-updateAppSecretError
Closed

Fix the method for verifying the existence of the appkey#6425
KANLON wants to merge 2 commits into
apache:masterfrom
KANLON:fix-updateAppSecretError

Conversation

@KANLON

@KANLON KANLON commented Jul 15, 2026

Copy link
Copy Markdown

#6422

The GET /appAuth/updateSk endpoint always fails validation with the error updateSk.appKey: app key not existed, regardless of whether the provided appKey actually exists in the database.

Root cause: The @Existed validation on the appKey parameter uses AppKeyProvider, whose existed() method calls appAuthMapper.existed(key). However, AppAuthMapper.existed() queries the id (primary key) column instead of the app_key column:

<!-- Currently used (WRONG) - queries by id -->
<select id="existed" resultType="java.lang.Boolean">
    SELECT true FROM app_auth WHERE id = #{id} LIMIT 1
</select>

<!-- Should use this - queries by app_key -->
<select id="appKeyExisted" resultType="java.lang.Boolean">
    SELECT true FROM app_auth WHERE app_key = #{appKey} LIMIT 1
</select>

Since the passed appKey value is checked against the id column, the query never matches, so the validation always fails.

Fix: In AppKeyProvider.existed(), call appAuthMapper.appKeyExisted(key) instead of appAuthMapper.existed(key).

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

@Aias00

Aias00 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

pls add my wechat: aias00

@KANLON KANLON closed this Jul 15, 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.

2 participants