Skip to content

fix(core): isolate token cache by app secret - #218

Open
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/token-cache-credential-fingerprint
Open

fix(core): isolate token cache by app secret#218
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/token-cache-credential-fingerprint

Conversation

@Zhang-986

Copy link
Copy Markdown

Summary

  • Include an app secret fingerprint in app and tenant access token cache keys.
  • Prevent clients with the same app ID but different app secrets from reusing cached tokens.
  • Keep raw app secrets out of cache keys by hashing them with SHA-256.

Fixes #126

Test Plan

  • go test ./core -run 'Test(TenantAccessTokenCacheKeysIncludeCredentialMode|GetAppAccessTokenDoesNotReuseCacheAcrossAppSecrets|GetTenantAccessTokenDoesNotReuseCacheAcrossAppSecrets)' -count=1\n- go test ./core -count=1\n- go test ./... -count=1\n- go test -race ./core -count=1\n- go vet ./core\n- git diff --check

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.

tokenmanager.appAccessTokenKey(appID)为固定参数,导致NewClient验证第二次传入的错误appsecret时绕过了服务端请求

1 participant