fix(permissions): avoid false Local Network grants

This commit is contained in:
Brennan Benson
2026-08-05 19:06:29 -07:00
parent 09f4a9765a
commit a6897a7eac
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -168,7 +168,7 @@ describe('registerDeveloperPermissionHandlers', () => {
})
})
it('clears the local-network prompt fallback timer when UDP send settles first', async () => {
it('keeps the local-network status unknown when UDP send settles without an error', async () => {
registerDeveloperPermissionHandlers()
const result = getRequestHandler()({}, { id: 'local-network' })
@@ -179,7 +179,7 @@ describe('registerDeveloperPermissionHandlers', () => {
await expect(result).resolves.toEqual({
id: 'local-network',
status: 'granted',
status: 'unknown',
openedSystemSettings: false
})
expect(vi.getTimerCount()).toBe(0)
+2 -1
View File
@@ -140,7 +140,8 @@ function triggerLocalNetworkPrompt(): Promise<DeveloperPermissionStatus> {
}
function classify(error: Error | null | undefined): DeveloperPermissionStatus {
if (!error) {
return 'granted'
// A queued UDP datagram does not prove Local Network access was granted.
return 'unknown'
}
const code = (error as NodeJS.ErrnoException).code
return code && LOCAL_NETWORK_DENIAL_CODES.has(code) ? 'denied' : 'unknown'