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

Function checkDomainBlocklist

source code/tools/WebFetchTool/utils.ts:178–205  ·  view source on GitHub ↗
(
  domain: string,
)

Source from the content-addressed store, hash-verified

176 | { status: 'check_failed'; error: Error }
177
178export async function checkDomainBlocklist(
179 domain: string,
180): Promise<DomainCheckResult> {
181 if (DOMAIN_CHECK_CACHE.has(domain)) {
182 return { status: 'allowed' }
183 }
184 try {
185 const response = await axios.get(
186 `https://api.anthropic.com/api/web/domain_info?domain=${encodeURIComponent(domain)}`,
187 { timeout: DOMAIN_CHECK_TIMEOUT_MS },
188 )
189 if (response.status === 200) {
190 if (response.data.can_fetch === true) {
191 DOMAIN_CHECK_CACHE.set(domain, true)
192 return { status: 'allowed' }
193 }
194 return { status: 'blocked' }
195 }
196 // Non-200 status but didn't throw
197 return {
198 status: 'check_failed',
199 error: new Error(`Domain check returned status ${response.status}`),
200 }
201 } catch (e) {
202 logError(e)
203 return { status: 'check_failed', error: e as Error }
204 }
205}
206
207/**
208 * Check if a redirect is safe to follow

Callers 1

getURLMarkdownContentFunction · 0.85

Calls 4

setMethod · 0.80
logErrorFunction · 0.50
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected