Skip to content

v0.2.0 - Access

Latest

Choose a tag to compare

@Nikolay-Chillev Nikolay-Chillev released this 03 Nov 17:50
59646fc

Second milestone release: Access. It covers who gets into a workspace and what they may do there:

  • accounts and invitations, from the email to the app;
  • roles and permissions, over the API and in the UI;
  • isolation between customers' workspaces;
  • tokens, sessions and two-factor sign-in.

Environment

  • Twenty 2.52.0, up from 2.48.0, with Postgres, Redis and Mailpit, all still pinned by digest.
  • A second customer: the setup project also creates Other Workspace on http://other.localhost:3000, with its own admin and API key, for the isolation tests (ADR 0001).
  • Nightly run: every night the UI tests also run in Firefox and WebKit, and one Allure report, with history, holds the results of all three browsers.

Framework

  • UI components:
    • the sign-in, invitation and password reset pages, including the code step of two-factor sign-in;
    • the settings, with the members section, the devices on the profile and the two-factor setup;
    • the command menu.
  • Roles: RolesApi makes roles with object, field and other permissions, and API keys with a role. A test's roles and keys are removed after it.
  • Fixtures:
    • signInWithRole gives a new member a role and signs them in through the sign-in page;
    • newMember, guestPage and invitee give a test its own user, a browser without a session and someone to invite;
    • otherWorkspace gives the second customer's workspace;
    • apiFor() and graphqlFor() give the records API with any token.
  • Auth helpers:
    • tokens: sign in for a token pair, renew it, and tamper with a token;
    • two-factor sign-in, with one-time codes made as an authenticator app does (checked against the test values of RFC 6238).
  • Refusals: helpers check a refusal by its code, so the tests of the refusal status (finding #65) are the only ones that depend on it.

Tests: 181

181 tests run on every pull request, 67 more than in v0.1.0. 11 of them are expected failures that pin open findings.

Level Tests
API (REST and GraphQL, email through Mailpit) 119
UI (Chromium on every pull request; Firefox and WebKit every night) 40
Unit tests of the framework 18
Setup: two workspaces, users, API keys 4

What the Access milestone added:

  • Sign-in:
    • sign-in with a password, and a wrong password refused;
    • sign-up without an invitation refused;
    • signing out ends the session and its copies;
    • password reset from the email back into the app, with only the new password working, and a reset link that works once.
  • Invitations:
    • an invited person joins from the email as a Member;
    • an invitation can be resent and removed;
    • a member may not invite.
  • Roles and permissions, over the API:
    • a member works with records, but may not see or change roles and API keys, give themselves the Admin role or add a webhook;
    • roles that may only read an object, may not delete from it, or have no access to it, over REST and GraphQL and through a related record;
    • a hidden field is left out of reads and refused in filters and writes, and a read-only field is refused in writes;
    • the Views permission decides who changes shared views;
    • a revoked API key stops at once; a key cannot get a role meant only for users, nor make keys.
  • Permissions in the UI, in three browsers:
    • a member has only their own settings, even by address;
    • a role that may only read companies sees them, but is offered no way to add, change or delete one;
    • a hidden field is not in the table, its columns or its filters, and its value is not on the record page;
    • a role without the Views permission is not offered to change a shared view.
  • Isolation between workspaces:
    • another workspace's API key cannot read, change or delete this workspace's records by id, nor find, change or delete them through a filter, over REST and GraphQL;
    • this workspace's admin gets no token for the other workspace's address;
    • this workspace's browser session does not open the other workspace's records.
  • Tokens and sessions:
    • an access token with a changed signature, or changed to name another workspace, is refused;
    • an API key stops working once it expires;
    • renewal needs a valid refresh token;
    • logging out the other devices signs those browsers out;
    • a member taken out of the workspace loses access at once.
  • Two-factor sign-in:
    • turned on from the profile with a code from the app;
    • after that, a password alone or a wrong code is refused, and the right code lets the member in.

Findings

The milestone added five findings, all in Twenty itself:

  • Major:
    • a removed invitation still lets the person join while the invite link is on (#54), a risk rather than a plain defect;
    • the sign-in page sometimes stays on its loader for good (#57). The suite reloads the page once, and the report says when it did.
  • Minor:
    • a refusal for lack of permission is 400 over REST, not 403 (#65);
    • a field a role may not see is listed on the record page as an empty field (#68);
    • a two-factor code can be used to sign in more than once (#74).

Seven findings are now reported to Twenty, and three of them are already fixed there:

  • Fixed: the currency code (#30) and phone numbers (#32), in 2.54.0, and the reused two-factor code (#74), after it. Their expected failures will start to pass when the environment moves to those versions.
  • Fixes waiting for review: a fix by another contributor is open for #57, #65 and #68.
  • Open: #34 has no fix yet.

The full list, and what is still being investigated, is in docs/findings.md. For example: whether logging out a device should also revoke the tokens from the same sign-in.

Reports

Next

The Workspace milestone:

  • the kanban board with drag and drop;
  • search with Cmd+K;
  • notes and tasks in the editor, and files;
  • CSV import;
  • custom objects and fields;
  • real-time updates between two users;
  • webhooks;
  • a canary run against the latest Twenty.

Its security checks will cover:

  • markup in the editor and in files;
  • formulas in CSV exports;
  • webhooks sent to internal addresses;
  • security headers and CORS.