Potential fix for code scanning alert no. 2: Incomplete URL substring sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Manan
2025-12-22 22:35:30 -08:00
committed by GitHub
parent 4be60d6218
commit e7ff1ca502

View File

@@ -169,11 +169,12 @@ export function WalletTab() {
*/ */
useEffect(() => { useEffect(() => {
// Check if we're in a Farcaster client environment // Check if we're in a Farcaster client environment
const isInFarcasterClient = typeof window !== 'undefined' && const isInFarcasterClient = typeof window !== 'undefined' && (() => {
(window.location.href.includes('warpcast.com') || const hostname = window.location.hostname.toLowerCase();
window.location.href.includes('farcaster') || const isWarpcastHost = hostname === 'warpcast.com' || hostname.endsWith('.warpcast.com');
window.ethereum?.isFarcaster || const isFarcasterHost = hostname === 'farcaster.com' || hostname.endsWith('.farcaster.com');
context?.client); return isWarpcastHost || isFarcasterHost || window.ethereum?.isFarcaster || context?.client;
})();
if (context?.user?.fid && !isConnected && connectors.length > 0 && isInFarcasterClient) { if (context?.user?.fid && !isConnected && connectors.length > 0 && isInFarcasterClient) {
console.log("Attempting auto-connection with Farcaster context..."); console.log("Attempting auto-connection with Farcaster context...");