MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / runAwsAuthRefresh

Function runAwsAuthRefresh

src/utils/auth.ts:662–694  ·  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

660 * Streams output in real-time for user visibility
661 */
662async function runAwsAuthRefresh(): Promise<boolean> {
663 const awsAuthRefresh = getConfiguredAwsAuthRefresh()
664
665 if (!awsAuthRefresh) {
666 return false // Not configured, treat as success
667 }
668
669 // SECURITY: Check if awsAuthRefresh is from project settings
670 if (isAwsAuthRefreshFromProjectSettings()) {
671 // Check if trust has been established for this project
672 const hasTrust = checkHasTrustDialogAccepted()
673 if (!hasTrust && !getIsNonInteractiveSession()) {
674 const error = new Error(
675 `Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`,
676 )
677 logAntError('awsAuthRefresh invoked before trust check', error)
678 logEvent('tengu_awsAuthRefresh_missing_trust', {})
679 return false
680 }
681 }
682
683 try {
684 logForDebugging('Fetching AWS caller identity for AWS auth refresh command')
685 await checkStsCallerIdentity()
686 logForDebugging(
687 'Fetched AWS caller identity, skipping AWS auth refresh command',
688 )
689 return false
690 } catch {
691 // only actually do the refresh if caller-identity calls
692 return refreshAwsAuth(awsAuthRefresh)
693 }
694}
695
696// Timeout for AWS auth refresh command (3 minutes).
697// 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