Data Hub

Security and permissions

Roles and what each can do, personal-access-token scopes, how authentication works, and good token hygiene.

ForAdministrators and developers

This page explains who can do what in Data Hub: the two roles, the scopes that limit what each token can do, and how to handle tokens safely. To create or revoke a token, see Issue and revoke tokens.

Authentication

The API accepts three kinds of credentials:

  • Session cookies: the web app uses these after someone signs in with Google through Better Auth. Scopes apply only to tokens, so a signed-in session passes every scope check.
  • Bearer tokens: personal access tokens (dhub_…) that the watcher, the Lambda, and scripts send as Authorization: Bearer dhub_your_token_here. A token acts as itself, under its own name; see How tokens act.
  • OAuth access tokens: Data Hub gives these to MCP clients after you sign in and approve a consent screen. See MCP access.

Data Hub stores only a SHA-256 hash of each token. It shows the token itself once, when it’s created.

Who can sign in

Any Google account that finishes signing in becomes a member of your deployment. Data Hub doesn’t check anything itself: it has no invitations, no email allowlist, and no email-domain check. The first successful sign-in creates the member record.

You limit who can sign in on the Google side instead, in the OAuth client your team creates when it deploys Data Hub. A consent screen set to Internal accepts only accounts in your Google Workspace organization. A consent screen set to External accepts any Google account, including personal ones. Engineers make that choice when they create the OAuth client.

Data Hub accepts 10 Google sign-in attempts per minute from one IP address and rejects the rest.

Every new member starts with the member role, never admin. Choose the first admins explains how the first admins get the role.

Session lifetime

Signing in stores a session in the database and sets a signed cookie. The session expires 7 days after its last refresh. The web app refreshes it at most once a day, so a session in daily use doesn’t expire on its own.

The cookie also holds a signed copy of the session for 5 minutes, so most page loads don’t need the database. Requests read the copy instead of the database row. A change made directly in the database, such as deleting a session, takes effect when the copy expires, not on the next request.

Removing someone’s access on the Google side, for example by removing them from your Workspace organization, blocks their next sign-in. Any session they already have open keeps working until it expires. To cut them off sooner, delete that user’s rows from the session table. Signing out from the sidebar ends the session immediately.

Roles

Data Hub has two roles: member and admin.

A member can:

  • sign in to the web app
  • view instruments, runs, files, and the token list
  • claim runs
  • comment, and edit or delete their own comments
  • create, edit, delete, and restore lab notebooks, and add runs to them or remove runs from them
  • delete and restore runs
  • send feedback and see the reports they sent

Members can’t create or revoke tokens, confirm or update instruments, or manage other users.

An admin can do everything a member can, and also:

  • confirm and update instruments
  • change watcher configs
  • create and revoke tokens
  • promote and demote other users
  • delete any run comment
  • review every feedback report
  • manage Settings → Integrations
  • set watcher release versions

The first admin comes from the ADMIN_EMAILS environment variable, a comma-separated list that ignores case. Data Hub promotes the people on that list every time they sign in. After that, any admin can promote others from Settings → Members. Admins can’t demote themselves, which keeps the last admin from removing their own role.

Admin-gated operations

Some actions that change data need the admin role, as well as a scope or instead of one:

  • PATCH /api/v1/instruments/:id: a signed-in person must be an admin. Tokens still need only instruments:write, so the watcher and the Lambda aren’t affected.
  • POST /api/v1/tokens and DELETE /api/v1/tokens/:id: admins only, from a signed-in session. Tokens can’t manage other tokens.
  • GET /api/v1/users and PATCH /api/v1/users/:userId: admins only, from a signed-in session. Settings → Members uses these routes.
  • /api/v1/settings/integrations/*: admins only, from a signed-in session. Settings → Integrations uses these routes.
  • POST /api/v1/watchers/:watcherId/config-revisions: a signed-in person must be an admin. A token must list watchers:admin explicitly, so older * and watchers:write tokens get 403. The MCP update_watcher_config tool is admin-only.
  • DELETE on a run comment: admins can delete any comment. Everyone else, tokens included, can delete only their own.
  • GET /api/v1/feedback: admins get every report, and members get only the reports they sent.

Remote watcher config

An admin, or a token that lists watchers:admin explicitly, can change a watcher’s watch folder to any folder the watcher’s account can read on the instrument PC. The watcher then uploads matching files from that folder. Grant admin and watchers:admin only to people and automation you trust with that access.

Data Hub records every change and who made it, in the History on the watcher’s Settings tab. Data Hub can’t change the watcher’s environment, API URL, token, or instrument ID.

How tokens act

A personal access token acts as itself, not as the admin who created it. Data Hub records everything a token does under the token’s name. The web app shows that name with a key icon on:

  • comments
  • deleted runs
  • retired instruments
  • removed watchers
  • notifications sent through the API

A revoked token keeps its record, so its name stays visible and is marked (revoked).

Claiming runs, sending feedback, and reviewing feedback need a signed-in person, because a token isn’t a person. Tokens can’t do them, whatever their scopes. AI assistants can, because they sign in as the person who approved them; see MCP access.

The routes that the watcher and the Lambda call work the other way round. They accept only tokens and return 401 Unauthorized to a browser session, so a signed-in member can’t act as a watcher. These routes cover:

  • watcher registration and heartbeats
  • upload links
  • file updates
  • run creation and updates
  • instrument creation

A token that registered a watcher can change runs and files only on instruments whose current watcher it registered. On any other instrument, it gets 403 Forbidden when it tries to:

  • change runs, uploads, files, comments, lab notebook memberships, or download archives
  • send a notification about a run

That token also can’t rename, retype, retire, or confirm any instrument, or remove or reconfigure any watcher, its own included, because the watcher itself never does those things. A few more rules apply:

  • A token whose watchers were all deregistered can’t change any instrument’s runs or files until it registers a watcher again.
  • The Lambda’s token registered no watcher, so it works on every instrument.
  • These limits cover changes only. Reads follow the token’s scopes, and the Watcher preset has no scope that reads runs or files.
  • Once an older token has registered a watcher, its * or coarse :write scope doesn’t let it read runs or files either; see Tokens with older scopes.

Tokens keep working when the admin who created them leaves. Revoke a departing person’s tokens yourself; see When someone leaves.

Token scopes

Every personal access token has a list of permission scopes. Data Hub rejects a token request with 403 FORBIDDEN when the token doesn’t have the scope the route needs. Give each token only the scopes it needs.

ScopeGrants
instruments:readRead instruments, the status on the web app’s home page, and each instrument’s watcher state and file patterns. Where the watcher runs (hostname, operating system, version, watch folder, and other instruments on the same computer) needs watchers:read too
instruments:writeCreate instruments and edit their configuration
runs:readRead and search runs, their files, comments, attributions, and lab notebooks
runs:createCreate run records
runs:updateUpdate run metadata
runs:deleteSoft delete and restore runs
runs:reprocessRun the processing workflow for a run again
runs:uploadRequest pre-signed S3 URLs to upload files to a run
runs:commentPost run comments as this token, and edit or delete the ones it posted
lab-notebooks:writeCreate, edit, delete, and restore lab notebooks, and add runs to them or remove runs from them. Tokens made before this scope was renamed from runs:link keep it
files:readRead file metadata and download files and run archives
files:createRegister file records against a run. Each record must point at its own file in that run’s folder in S3
files:updateUpdate file metadata and upload state
files:deleteDelete and restore files in a run
files:reprocessRun the processing workflow for a file again
watchers:readRead watcher status, heartbeats, and upload queues, and where each instrument’s watcher runs (hostname, operating system, version, watch folder)
watchers:reportRegister, send heartbeats and events, and push watcher config
watchers:adminDelete watchers and change their config, including which folder on the instrument PC they upload from. Changing config needs this scope listed explicitly; older * and watchers:write tokens can’t
archive-jobs:readRead run-archive job status
archive-jobs:writeUpdate run-archive job status (Lambda callback)
notifications:createSend notifications to people, optionally about a run
*Matches every scope, or only the Watcher preset’s scopes on a token that has registered a watcher. Kept only for older tokens; rejected on new tokens

Two presets select the scopes a common client needs:

  • Watcher: instruments:read, instruments:write, watchers:read, watchers:report, runs:create, runs:update, runs:upload, and files:update
  • Lambda: instruments:read, runs:read, runs:create, runs:update, files:create, files:update, and archive-jobs:write

A read-only analysis token needs the :read scopes for the data you want to query.

Tokens with older scopes

New tokens must list specific scopes. POST /api/v1/tokens rejects the wildcard * and the older coarse scopes runs:write, files:write, and watchers:write.

Tokens that already have those scopes keep working until you replace them, with one exception. On a token that has registered a watcher, deregistered watchers included, they count only for what a watcher needs:

  • * gives the Watcher preset’s scopes
  • runs:write gives runs:create, runs:update, and runs:upload
  • files:write gives files:update
  • watchers:write gives watchers:report

Scopes the token lists itself still count.

The runs:attribute and feedback:admin scopes no longer exist, because claiming runs and reviewing feedback need a signed-in person. Data Hub removed them from existing tokens on October 6, 2026.

Integration secrets

Data Hub encrypts the Linear and Slack secrets that admins save under Settings → Integrations, using the key in the INTEGRATION_SECRETS_KEY environment variable. The app never shows a secret again after it’s saved. See Set up integrations.

MCP access

The MCP server at /mcp/v1 accepts OAuth access tokens, not personal access tokens. To connect, you sign in to Data Hub and approve a consent screen that names the AI client and the access it wants. The client then receives an access token that works only for that deployment’s MCP endpoint.

Data Hub rejects a token issued to a client with no person behind it, so every MCP action is recorded against a person. MCP uses two scopes of its own, instead of the token scopes above:

  • read: needed to connect, and covers every read-only tool, resource, and prompt
  • write: also needed by any tool that changes data, such as claiming a run or deleting one

A grant belongs to one client and one person, and it has that person’s own permissions. Clients register themselves when they connect. Registering creates an OAuth client record but grants nothing on its own. Google sign-in still decides who gets through, and the consent screen still decides what they hand over.

The web app has no screen for reviewing or revoking MCP grants yet. Removing someone from your Google Workspace organization blocks new grants. To cut off a client that already has a token, delete the matching rows from the oauthAccessToken and oauthRefreshToken tables.

To set up a client, see MCP overview.

Token hygiene

Name each token clearly, set expirations, and give each token only the scopes it needs. Revoke a token as soon as you stop using it or it may have been exposed. The full checklist is in Token hygiene.

Pages that load without signing in

Some web pages load without a session, so that apps that show link previews can read the page’s metadata, such as its title. These are the home page, instrument pages, run pages, and settings pages. Without a session, the page shows a sign-in prompt instead of real data.

Three separate safeguards keep the app out of search engines:

  • robots metadata
  • robots.txt
  • an X-Robots-Tag header

Every /api/v1/* route always needs a session cookie or a bearer token.

On this page