BioLock / source · biolock.dev / commits / d7e3ac21
Accept built-in readers that report hybrid+internal (real iPhones, Macs, Chrome); still refuse hybrid alone and plug-in keys new
written by Moontrace · d7e3ac21a818479a9f26db56f97698af79ae3835 · parent d1679746
2 files changed
src/server.js changed
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Built-in readers only: refuse security keys and phone-to-computer (QR) sign-ins. |
| 155 | - const OUTSIDE = ['usb', 'nfc', 'ble', 'hybrid', 'smart-card']; | |
| 156 | 155 | function builtInOnly(credential) { |
| 157 | 156 | if (credential.authenticatorAttachment && credential.authenticatorAttachment !== 'platform') throw new Error('only this device\'s own fingerprint or face reader is allowed'); |
| 157 | + // Built-in readers whose keys the device's own manager can also offer nearby report | |
| 158 | + // ["hybrid", "internal"] (real iPhones, Macs and Chrome do). Accept that; refuse anything | |
| 159 | + // without "internal", and anything that names a plug-in or tap key. | |
| 158 | 160 | const t = (credential.response && credential.response.transports) || []; |
| 159 | - if (t.some((x) => OUTSIDE.includes(x))) throw new Error('only this device\'s own fingerprint or face reader is allowed'); | |
| 161 | + if (t.length && (!t.includes('internal') || t.some((x) => x !== 'internal' && x !== 'hybrid'))) throw new Error('only this device\'s own fingerprint or face reader is allowed'); | |
| 160 | 162 | } |
| 161 | 163 | |
| 162 | 164 | function checkClientData(cdjBytes, type, expectedChallenge, origins) { |
test/server.test.js changed
| 104 | 104 | const c = await k.create(ro); c.response.transports = [t]; |
| 105 | 105 | await assert.rejects(S.verifyRegistration({ credential: c, expectedChallenge: ro.challenge, expectedOrigin: ORIGIN, rpId: RP }), /own fingerprint/); |
| 106 | 106 | } |
| 107 | + const both = await k.create(ro); both.response.transports = ['hybrid', 'internal']; | |
| 108 | + assert.ok(await S.verifyRegistration({ credential: both, expectedChallenge: ro.challenge, expectedOrigin: ORIGIN, rpId: RP })); | |
| 109 | + const usbToo = await k.create(ro); usbToo.response.transports = ['internal', 'usb']; | |
| 110 | + await assert.rejects(S.verifyRegistration({ credential: usbToo, expectedChallenge: ro.challenge, expectedOrigin: ORIGIN, rpId: RP }), /own fingerprint/); | |
| 107 | 111 | const c = await k.create(ro); c.authenticatorAttachment = 'cross-platform'; |
| 108 | 112 | await assert.rejects(S.verifyRegistration({ credential: c, expectedChallenge: ro.challenge, expectedOrigin: ORIGIN, rpId: RP }), /own fingerprint/); |
| 109 | 113 | const stored = await S.verifyRegistration({ credential: await k.create(ro), expectedChallenge: ro.challenge, expectedOrigin: ORIGIN, rpId: RP }); |