Code Monkey home page Code Monkey logo

xdg-credentials-portal's Introduction

xdg-credentials-portal

This is a standalone service which aims to offer FIDO2 platform functionality (FIDO U2F, and WebAuthn) on Linux, over a D-Bus Portal interface.

The project is composed of multiple crates:

  • libwebauthn: Linux native implementation of FIDO2 and FIDO U2F Platform APIs.
    • Fully written in Rust.
    • No longer relies on Mozilla's authenticator-rs.
    • Supporting multiple transports (currently USB HID and BLE). The library is designed to have pluggable transport implementations, making it easy to add transport backends (planned: NFC, caBLEv2).
  • xdg-credentials-portal: API proposal and reference implementation for a service which will expose FIDO2 and FIDO U2F Platform APIs via a D-Bus interface, for desktop applications to use - including conteinerized apps such as Flatpaks.

libwebauthn

Platform functionality

  • FIDO U2F
    • ๐ŸŸข Registration (U2F_REGISTER)
    • ๐ŸŸข Authentication (U2F_AUTHENTICATE)
    • ๐ŸŸข Version (U2F_VERSION)
  • FIDO2
    • ๐ŸŸข Create credential
    • ๐ŸŸข Verify assertion
    • ๐ŸŸข Biometric user verification
    • ๐ŸŸข Discoverable credentials (resident keys)
  • FIDO2 to FIDO U2F downgrade
    • ๐ŸŸข Basic functionality
    • ๐ŸŸข Support for excludeList and pre-flight requests
  • PIN/UV Protocols
    • ๐ŸŸข PIN/UV Auth Protocol One
    • ๐ŸŸข PIN/UV Auth Protocol Two
  • PIN/UV Operations
    • ๐ŸŸข GetPinToken
    • ๐ŸŸข GetPinUvAuthTokenUsingPinWithPermissions
    • ๐ŸŸข GetPinUvAuthTokenUsingUvWithPermissions
  • Passkey Authentication
    • ๐ŸŸข Discoverable credentials (resident keys)
    • ๐Ÿ”ด Cloud-Assisted BLE (caBLE) transport (#31 blocked: spec not yet published)

Transports

USB (HID) Bluetooth Low Energy (BLE) NFC TPM 2.0 (Platform)
FIDO U2F ๐ŸŸข Supported (via hidapi) ๐ŸŸข Supported (via bluez) ๐ŸŸ  Planned (#5) ๐ŸŸ  Planned (#4)
WebAuthn (FIDO2) ๐ŸŸข Supported (via hidapi) ๐ŸŸข Supported (via bluez) ๐ŸŸ  Planned (#5) ๐ŸŸ  Planned (#4)

xdg-credential-platform

This is a very early stage idea, no proposed spec exists yet.

Here is an high-level architecture diagram of the proposed service and how it will interact with its clients:

High-Level Architecture

Footnotes:

  • *: Better alternatives for UI should be considered, e.g. native UI implementations via xdg-credentials-portal-{gnome, kde}.
  • ฮ”: See Roadmap section below

Motivation

Other platforms

Here is a list of related APIs available on other platforms, which offer similar functionality:

Further references:

Contributing

If you'd like to contribute but you don't know where to start, take a look at available tasks in the Issues tab.

Alternatively, any investigation or expertise on the following would be very helpful. Please reach out!

  • Platform Authenticator support. Similarly to Android devices, and Windows Hello. In order to implement this (and request FIDO2 certification), support for the following is needed:

    • Trusted Platform Modules (TPMs)
    • User-verification devices (e.g. fingerprint readers)
  • Unprivileged access. FIDO2 credentials are scoped to an origin (e.g. https://example.org). The proposed API allows applications to specify any origin (as needed by browsers). Hence, it requires an additional user confirmation step for security purposes. This extra step may not be needed if the request sender could be verified, as the legitimate owner of the specified origin.

  • PAM, and passwordless login (long-term goal). A PAM module would allow using FIDO2 for user login purposes, e.g. using the platform authenticator (similar to Windows Hello).

  • D-Bus Portal API design

  • Proposal and contribution processes (Flatpak, GNOME, etc.)

  • UI/UX

xdg-credentials-portal's People

Contributors

alfioemanuelefresta avatar dependabot[bot] avatar iinuwa avatar tgagneret-embedded avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xdg-credentials-portal's Issues

Hypersecu Hyperfido Pro Mini Pro Mini does not work

$ cargo run --example u2f_hid
    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
     Running `target/debug/examples/u2f_hid`
Found 1 devices.
Winking device: HS HyperFIDO (r13057)
Registration request sent (timeout: 10s).
Error: Ctap(InvalidLength)

This key works fine in Firefox and on Android.

FIDO2 over BLE

Hi,

Is it possible to have an example code for webauthn/FIDO2 over BLE ?

Thanks

FIDO2 over caBLE

Blocked:

  • caBLE spec has not yet been released publicly.
    • If you're reading this and have access to a draft, please consider sharing a copy, figuring it out from the Chromium source is not that fun :)

Includes:

  • Implement Cloud-Assisted Bluetooth Low Energy (caBLE) transport
  • New crate for caBLE device management
  • Trait for caBLE device pairing information storage

relationship to authenticator-rs?

I'm confused what this project's relationship is, if any, with authenticator-rs. If I understand correctly, this project started by using authenticator-rs, but reimplemented USB HID support without it, and now this project also supports BLE? It seems that authenticator-rs development has stalled for a while and it only supports USB HID on Linux.

IIUC, this project aims to be a Linux-specific abstraction over the various hardware protocols for FIDO passkeys whereas authenticator-rs aims to be a cross-platform abstraction over different OS APIs? In that case, would it make sense for authenticator-rs to replace its Linux backend to use this project? Also, I think it would be helpful to rename libwebauthn to something platform-specific like webauthn-linux.

FIDO U2F: Register 'exclude_credentials'

CTAP1 does not support 'exclude credentials' in its register operation (like CTAP2). However, this functionality can be be implemented by exploiting the key enumeration functionality of the protocol. Before the register operation, for each key in the exclude list, the client sends a 'check only' signature request. If any of the keys exist, the register operation is aborted, with a compatible error.

This feature is needed to support CTAP2 request downgrading.

FIDO2: Near-Field Communication (NFC) support

Required hardware (hw wishlist):

  • FIDO U2F/WebAuthn NFC device
  • USB NFC reader

Requires:

  • #3 CTAP2 implementation
  • #10 CTAP2 to CTAP1 (U2F) downgrade support

Includes:

  • Looking into libnfc and neard
  • Protocol negotiation via NFC
  • Framing for CTAP1
  • Framing for CTAP2

Integration / collaboration opportunities - Kanidm's Webauthn library

Hi,

I've been working on Kanidm's Webauthn Authenticator library, which has a lot of overlap with the work you're doing with libwebauthn; some of which is probably interesting to you.

Kanidm's library has a low level interface (for passing CTAP messages) and high level interface (for platform level stuff). The high level interface (which has a lot of overlap with your "future plans") currently has a SoftToken, and bindings for Mozilla's authenticator-rs (which I'm planning to replace) and Windows' WebAuthn API. There's someone currently writing bindings for macOS' Passkey API; and a future xdg-credential-platform would be an ideal target for that.

On the low-level side (which is where most of the libwebauthn overlap is), I'm currently building up a more complete implementation to allow us to replace Mozilla's authenticator-rs library. At the moment that targets FIDO 2.0/2.1 via NFC (via PC/SC) and USB HID (via hidapi) transports, with a view to eventually supporting BLE (and probably caBLE) in a similar (cross-platform) way.

Kanidm's WebAuthn (not just authenticators) library also has a bunch of compatibility tests, because it seems many things are broken in fun and exciting ways (authenticators, browsers, clients, platforms...) or just not implemented at all; and the specifications often leave a lot to be desired (or are plain wrong).

The goal with all that is to be able to provide a portable WebAuthn implementation that can be used anywhere, not just in browsers or on websites.

We normally lurk on https://gitter.im/kanidm/community if you want to say hi. ๐Ÿ˜„

How do I run the reference portal?

The README has a demo showing off the reference portal implementation.

How can this demo be run? cargo reports not finding any binary targets in the workspace:

$ cargo run --all-features
error: a bin target must be available for `cargo run`

FIDO 2.1: Credential blobs and large blob keys

PIN provider interface

Allow caller to provide their own PinProvider to WebAuthn calls.

PinProviders should be told about attempt number, remaining attempts. Crucially, PinProviders should be able to cancel operations.

Create a StaticPinProvider implementation for testing. Also create a PromptPinProvider for use in examples. Make these convenience implementations safe by not providing PINs if attempts remaining is low.

In the future it may make sense to refactor this as a provider for all UV interactions, where PINs are only specific methods. I've not looked into bio auth enough yet.

Refactoring: Use let-else for errors

Currently a lot of errors are handled in a manner similar to:

let dev = device.open_device(&hidapi)
                .or(Err(Error::Transport(TransportError::ConnectionFailed)))?;

These errors are tricky to track down. Now that we're using the tracing crate fully, it would be best to rewrite these using let-else syntax, ie.:

let Ok(dev) = device.open_device(&hidapi) else {
    error!(?hidapi, "Failed to open device");
    return Err(Error::Transport(TransportError::ConnectionFailed));
}

If the error is relevant to the message, first consider if the method being called should be instrumented to automatically log errors in their context:

use tracing::instrument;

#[instrument(skipall, err)]
pub fn open_device(&self, dev: &HidDevice) {
    ...

If this is not possible, we can instead use match statements at the point of invocation:

let dev = match device.open_device(&hidapi) {
    Ok(dev) => dev,
    Err(err) => {
        error!({ %err, ?hidapi }, "Failed to open device");
        return Err(Error::Transport(TransportError::ConnectionFailed));
    }
};

GNOME shell integration

Tracking reaching out to GNOME engs, and integration work.

I haven't reached out to anyone in the GNOME community yet. If you're reading this and you'd like to help, please reach out!

xdg-credentials-portal crate?

Thanks for working on this project!

The README.md says there are two crates, a libwebauthn crate and an xdg-credentials-portal crate, but I only see the libwebauthn crate? There's a ui.rs in the libwebauthn crate which uses the dbus crate. Is there a reason you used the bindings to the libdbus C library instead of zbus? Also, it would be great to expose both the portal-side D-Bus API and the application-side API as separate crates, or maybe behind different Cargo features.

Separate library and D-Bus interface

Based on the docs, this project would appear to contain both a "low level" webauthn library and the "credential platform", i.e. the UI and service executable. however, it looks like it's not possible to build/use the webauthn library standalone.

The main point of this project is off course the service executable, offering "platform auth", but using it as a library might be a nice to have as well. For this, it would be great if the dbus and UI dependencies could be separated out. This could offer the ability to use the library to build cross-platform apps with the FIDO2 built in, without needing platform specific things like D-Bus, UI stuff and Bluez.

My current use-case is testing support for authenticator hardware in Windows. While D-Bus is available on Windows, building and running the full service executable on Windows is probably challenging and beyond the scope of what I'm trying to do.

My end goal is supporting something like xdg-credentials-portal in the Webauthn client library I'm working on.

To be clear, I think where possible platform auth should be used, but a low level library would facilitate testing.

Provide installation package

Please consider providing a package and installation instructions.

Publishing a release on crates.io may be a good start to enable easier testing and feedback.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.