MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / runAwsAuthRefresh

Function runAwsAuthRefresh

source code/utils/auth.ts:614–646  ·  view source on GitHub ↗

* Run awsAuthRefresh to perform interactive authentication (e.g., aws sso login) * Streams output in real-time for user visibility

()

Source from the content-addressed store, hash-verified

612 * Streams output in real-time for user visibility
613 */
614async function runAwsAuthRefresh(): Promise<boolean> {
615 const awsAuthRefresh = getConfiguredAwsAuthRefresh()
616
617 if (!awsAuthRefresh) {
618 return false // Not configured, treat as success
619 }
620
621 // SECURITY: Check if awsAuthRefresh is from project settings
622 if (isAwsAuthRefreshFromProjectSettings()) {
623 // Check if trust has been established for this project
624 const hasTrust = checkHasTrustDialogAccepted()
625 if (!hasTrust && !getIsNonInteractiveSession()) {
626 const error = new Error(
627 `Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`,
628 )
629 logAntError('awsAuthRefresh invoked before trust check', error)
630 logEvent('tengu_awsAuthRefresh_missing_trust', {})
631 return false
632 }
633 }
634
635 try {
636 logForDebugging('Fetching AWS caller identity for AWS auth refresh command')
637 await checkStsCallerIdentity()
638 logForDebugging(
639 'Fetched AWS caller identity, skipping AWS auth refresh command',
640 )
641 return false
642 } catch {
643 // only actually do the refresh if caller-identity calls
644 return refreshAwsAuth(awsAuthRefresh)
645 }
646}
647
648// Timeout for AWS auth refresh command (3 minutes).
649// Long enough for browser-based SSO flows, short enough to prevent indefinite hangs.

Callers 1

auth.tsFile · 0.85

Calls 9

logAntErrorFunction · 0.85
logEventFunction · 0.85
logForDebuggingFunction · 0.85
checkStsCallerIdentityFunction · 0.85
refreshAwsAuthFunction · 0.85

Tested by

no test coverage detected