privacybydesign / irma-frontend-packages

Collection of frontend related packages, that together form a Javascript "client" to the IRMA server.
7 stars 4 forks source link

Feat: introduce pairing support for protecting against shoulder surfing #35

Closed ivard closed 3 years ago

ivard commented 3 years ago

Fixes #4

Release notes:

In this release, we introduce support for device pairing that can be enabled to prevent QR theft. When enabling this feature, an extra state is added between scanning a IRMA QR code and actually performing the session. In this state, a pairing code is visible in the IRMA app. The user should enter that pairing code in the frontend to continue.

For the following session types it is important that the right user scans the QR, since the session might contain sensitive information.

Furthermore, this release includes frontend support for chained sessions.

In order to use device pairing and chained sessions, your IRMA server should have version 0.8.0 or higher.

Global API changes

The changes below concern changes in behaviour of the exported methods of irma-core and irma-frontend.

Added

Changed

Changes in individual packages

The changes mentioned below are specific changes within individual packages. Changes in the API that concern the functioning of the irma-frontend-packages as a whole can be found in the global API changes section.

TODO: Checken of local links (zoals in 'global API changes section') werken als de daadwerkelijke release wordt aangemaakt op GitHub.

irma-core

These changes are relevant for developers of custom plugins.

Added

Changed

Deprecated

Removed

// Old if (this._stateMachine.isValidTransition('fail')) this._stateMachine.transition('fail'); // New this._stateMachine.selectTransition( ({validTransitions}) => validTransitions.includes('fail') ? { transition: 'fail' } : false );

// Old if (!this._stateMachine.isEndState()) this._stateMachine.transition('abort'); // New this._stateMachine.selectTransition( ({inEndState}) => inEndState ? false : { transition: 'abort' } );



#### Fixed
 - The order of state changes was not always correct when initiating a new transition from within `stateChange`.

### `irma-css`
#### Added
 - Styling for the new state `EnterPairingCode`.

#### Changed
 - Loading indicator has been restyled to prevent graphical artifacts in Google Chrome.
 - Buttons have rounded corners now.
 -  On all sides, the border of the body of an `irma-form` has rounded corners now.

### `irma-client`
#### Added
 - This plugin now initiates the `prepareQRCode` or the `prepareButton` transition within the `CheckingUserAgent` state. Checking the user agent was done by `irma-core` first, but has been delegated to this plugin now.

#### Changed
 - The plugin has been updated to deal with the updated `irma-core` state machine.

#### Fixed
- Bug that `succeed` transition (now `prepareResult` transition) could already be initiated in the `ShowingQRCode` and `ShowingIrmaButton` state.

### `irma-console`
#### Added
 - Support for entering pairing codes (the `EnterPairingCode` state)

#### Changed
 - The plugin has been updated to deal with the updated `irma-core` state machine.

#### Fixed
 - Plugin now triggers an error when the state gets changed to `ShowingIrmaButton`. This state should not happen when using `irma-console`, since this can only occur on mobile.

### `irma-web`
#### Added
 - Support for entering pairing codes (the `EnterPairingCode` state)

#### Changed
 - The plugin has been updated to deal with the updated `irma-core` state machine.
 - Being in the `Aborted` state is mentioned in HTML comments (as already was the case for all other states).
 - In the default locales for Dutch (`nl`), the line `Eén moment alsjeblieft` has been replaced by `Een moment alstublieft` and `Open IRMA app` is replaced by `Open IRMA-app`.

### `irma-popup`
On top of the changes mentioned below, the changes in `irma-web` also apply to this package.

#### Fixed
 - The pop-up could loose focus, making it possible to control the underlying web page using your keyboard.
 - The `close()` method of `irma-web` was not called when closing the pop-up.

### `irma-dummy`
#### Added
 - This plugin now initiates the `prepareQRCode` or the `prepareButton` transition within the `CheckingUserAgent` state. Checking the user agent was done by `irma-core` first, but has been delegated to this plugin now.
 - New options for testing the `pairing` and the `mobile` flow.
 - New option `prepare` within the `timing` options to customize the time that preparing the session and the result should take.

#### Changed
 - The plugin has been updated to deal with the updated `irma-core` state machine.
ivard commented 3 years ago

To help understanding the state machine, I made a quick and ugly state machine diagram of the new situation:

irma-core-state-machine (2)

(Edit: I added the pairingRejected transition, which I was forgotten)

leonbotros commented 3 years ago

I see I left some notes double. I thought github would see that... Anyway, I deleted the double comments..

leonbotros commented 3 years ago

So, I tested the following cases:

Since the frontend determines if pairing should happen, the case where an old frontend talks with newer servers should not be that interesting.

One little bug I found during testing in an application that re-uses the web-form of irma web for multiple sessions:

ivard commented 3 years ago

One little bug I found during testing in an application that re-uses the web-form of irma web for multiple sessions:

  • The text field listener is still registered to the completed session and it tries to transition from the success state once a code meant for the second session is entered.

I'll fix this bug.