fix(feishu): suppress stale missing-scope grant notices#31870
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🔵 Untrusted Feishu API error message logged verbatim (info leak + possible log forging)
DescriptionIn This introduces two concrete risks:
Vulnerable code: if (shouldSuppressPermissionErrorNotice(permErr)) {
log(`feishu: ignoring stale permission scope error: ${permErr.message}`);
return {};
}Data flow evidence:
RecommendationAvoid logging the full remote error message, or sanitize it before logging. Option A (preferred): log only stable/safe fields if (shouldSuppressPermissionErrorNotice(permErr)) {
log(`feishu: ignoring stale permission scope error: code=${permErr.code}`);
return {};
}Option B: sanitize + truncate before logging (if message is needed for debugging) const sanitizeForLog = (value: string) =>
value.replace(/[\r\n\t\0\u001b]/g, " ").slice(0, 200);
if (shouldSuppressPermissionErrorNotice(permErr)) {
log(
`feishu: ignoring stale permission scope error: code=${permErr.code} msg=${sanitizeForLog(permErr.message)}`,
);
return {};
}Additionally consider redacting/omitting URLs in logs (e.g., replace Analyzed PR: #31870 at commit Last updated on: 2026-03-02T16:17:05Z |
Greptile SummaryThis PR adds a targeted suppressor for stale Feishu permission errors during sender name lookup. When the API returns error code 99991672 with the stale scope Key changes:
Impact: Users will no longer see false permission grant prompts for the non-existent stale scope, improving the user experience while maintaining proper error handling for legitimate permission issues. Confidence Score: 5/5
Last reviewed commit: 6594d46 |
6594d46 to
fe06b78
Compare
|
PR #31870 - fix(feishu): suppress stale missing-scope grant notices (#31870) Merged after verification.
|
…) thanks @liuxiaopai-ai Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check (fails on unrelated baseline lint in src/browser/chrome.ts) Co-authored-by: liuxiaopai-ai <73659136+liuxiaopai-ai@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…) thanks @liuxiaopai-ai Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check (fails on unrelated baseline lint in src/browser/chrome.ts) Co-authored-by: liuxiaopai-ai <73659136+liuxiaopai-ai@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
…) thanks @liuxiaopai-ai Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check (fails on unrelated baseline lint in src/browser/chrome.ts) Co-authored-by: liuxiaopai-ai <73659136+liuxiaopai-ai@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
Summary
Describe the problem and fix in 2–5 bullets:
contact:contact.base:readonlytriggered repeated user-facing grant notices.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
contact:contact.base:readonly.Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
contact.user.getreturning permission error code99991672with message containingcontact:contact.base:readonly.Expected
Actual
Evidence
Attach at least one:
pnpm test extensions/feishu/src/bot.test.tsignores stale non-existent contact scope permission errorsHuman Verification (required)
What you personally verified (not just CI), and how:
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
6594d461a.extensions/feishu/src/bot.tsextensions/feishu/src/bot.test.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.