fix(auth): add scope on refresh and bypass accountId validation on RT exchange#675
Open
icebear0828 wants to merge 2 commits into
Open
fix(auth): add scope on refresh and bypass accountId validation on RT exchange#675icebear0828 wants to merge 2 commits into
icebear0828 wants to merge 2 commits into
Conversation
Owner
Author
Review总体评价两个修复方向正确:refresh 加 scope 防止权限缩减,bypass 🔴 High
需要显式检查: const payload = decodeJwtPayload(trimmed);
if (!payload || typeof payload.exp !== "number") {
return { valid: false, error: "Token missing or invalid exp claim" };
}🟡 Medium核心 bug 场景(JWT 无 所有 RT exchange 测试用例都用带 需补: it("accepts RT-exchanged token with no chatgpt_account_id claim", async () => {
const noAccountIdJwt = createValidJwt({ accountId: undefined });
const result = await svc.importMany([{ refreshToken: "some_rt" }]);
expect(result.added).toBe(1);
expect(result.failed).toBe(0); // 老代码此处 failed=1
});🟢 Low
|
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.
This PR adds the openid scope to the token refresh payload to ensure Auth0/OpenAI returns the id_token, and bypasses metadata.accountId requirements for RT-exchanged tokens to improve robustness on account imports.