# OneDrive plugin

The OneDrive plugin lets a Vaubaan Gateway mission use OneDrive without handing the agent a credential. OneDrive through Microsoft Graph: list folders, search and read text files, upload new files and create folders. No sharing, no deletion.

Version `0.1.0` · 4 permissions · 2 macro-actions · 5 tools · 0 gateways run this plugin (over the last 90 days).

## How OneDrive is modelled

1 plane, 4 things. The things that exist at the service and how they nest. Every permission is written over these; a resource of an account is one of them, named by its ref.

- **Account** — One account is one Microsoft account, personal or for work or school, signed in at Microsoft with nothing to create or paste.
  - Plane `drive` — The files and folders of one Microsoft account's OneDrive.
    - `drive` (1 *; the resource) — The resource an account exposes: its OneDrive. Its identifier is the ref (alice\~contoso.com); an address the slice grammar cannot carry is written \[\*\].
      - `folder` (1 *) — A folder, by its item id (\`root\` for the top of the drive; \[\*\] for an id the slice grammar cannot carry); without an identifier, a new one.
      - `file` (1 *) — A file, by its item id; a search, or an id the slice grammar cannot carry, is \[\*\]; without an identifier, a new one.
        - `content` (1) — Verb leaf: reading what a file holds, not only its name and type.

Marks: 1 exactly one, named; n a finite, known set; * an unknown number, possibly all.

- **Account**: One account is one Microsoft account, personal or for work or school, signed in at Microsoft with nothing to create or paste.
- **Resource**: One resource is its OneDrive. A mission reads what files are called and what they hold as two permissions, and creating folders and uploading files as two more; nothing is shared or deleted. An organisation's policy may ask an administrator to consent to the app first.
- **Environment**: No permission of this service depends on an environment: each is held once, whatever the resource. Known: none. Carried by: nothing in the model.

## What an agent does at OneDrive: 2 macro-actions

A mission is made of them: the person ticks the ones the task needs and sets each to a trust level.

1. **Read files** — List folders, search files and read them. Browsing the account's OneDrive: listing folders, searching by name and content, and reading text files. Nothing changes, but files hold what a person or a company keeps, and their text may have been written by others. Reading what a file holds is a permission apart from listing what files are called. (2 permissions)
2. **Add files** — Create folders and upload new files. Putting new files and folders in the account's OneDrive. Nothing existing is changed, shared or deleted. A new file is seen at once by everyone who can open its folder, and the agent cannot take it back, so uploading asks first unless the mission is trusted with it. (2 permissions)

## The map

4 permissions of 2 macro-actions, in the four rows of the tree. For the chosen trust level, each cell gives yes, ask me or no, and the quota a day.

Careful ×1: Mild actions run freely; sensitive or costly ones ask first; irreversible ones are left out. Trusting ×3: Up to sensitive actions run freely; costly and irreversible ones ask first. Limits ×3. Autonomous ×10: Everything but irreversible actions runs freely; those ask first. Limits ×10.

yes: runs freely; ask me: ask me first; no: not included. A permission sits in the first row its facts answer: irreversible; costly to undo or unbounded cost; secret or personal data, whole account or bulk, moderate cost, public; otherwise harmless.

### Cannot be repaired

Careful: no. Trusting, Autonomous: ask me.

None.

### Repairable, at a price

Careful, Trusting: ask me. Autonomous: runs freely.

- Add files: Upload a file `onedrive.file-upload`, costly to undo — A new file written by the agent, at once visible to everyone who can open its folder, which may be shared outside the company or by link. Its text is the agent's: whatever it read can leave this way. The agent cannot delete it afterwards, and a person who read it cannot unread it. Careful: ask me · 50 a day · Trusting: ask me · 150 a day · Autonomous: yes · 500 a day.

### Worth a look

Careful: ask me. Trusting, Autonomous: runs freely.

None.

### Harmless

Runs freely at every level.

- Read files: List folders and search files (names, types, dates, links) `onedrive.file-list` — What the account's files are called, where they sit, when they changed and who can follow their link: a listing says what a person works on, not what the files hold. Names are written by others, a path for prompt injection. Careful: yes · 1,000 a day · Trusting: yes · 3,000 a day · Autonomous: yes · 10,000 a day.
- Read files: Read what a file holds `onedrive.file-read` — The text of a file of the drive lands in the agent's context. Nothing is modified. Careful: yes · 300 a day · Trusting: yes · 900 a day · Autonomous: yes · 3,000 a day.
- Add files: Create a folder `onedrive.folder-create` — An empty folder, seen by whoever can open its parent. The agent cannot delete it; a person removes it in a click. Careful: yes · 30 a day · Trusting: yes · 90 a day · Autonomous: yes · 300 a day.

Careful: runs freely 3, ask me first 1.
Trusting: runs freely 3, ask me first 1.
Autonomous: runs freely 4, ask me first 0.

Limits are counted over a mission's period: a day unless its creator picks another, or the mission's whole life for a one-off. The figures here are per day.

## A few calls, classified by the plugin

6 declared calls, run through the plugin's own classifier when this page was built; here one per macro-action. [The 6 calls, as code](https://github.com/vaubaan/gateway/blob/main/plugins/onedrive/src/examples.ts).

- `onedrive__list_folder {}`
  - the plugin sees: `onedrive.drive[alice~contoso.example].folder[root].R`
  - the catalog answers: List folders and search files (names, types, dates, links) `onedrive.file-list`
  - a Careful mission: yes
- `onedrive__upload_file {"name":"notes.md","content":"# Notes\n","mimeType":"text/markdown","folderId":"01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD36K"}`
  - the plugin sees: `onedrive.drive[alice~contoso.example].file.W`
  - the catalog answers: Upload a file `onedrive.file-upload`
  - a Careful mission: ask me

## Anything else

A call no permission covers touches `onedrive.uncategorized-write` instead of slipping through. No macro-action holds it; a person ticks it knowingly.

| Permission | Risk | Careful ×1 | Trusting ×3 | Autonomous ×10 |
| --- | --- | --- | --- | --- |
| Uncategorized write `onedrive.uncategorized-write`: Catch-all for writes without a dedicated entry. A mission creator who includes it allows the writes this catalog has not reviewed. | Repairable, at a price (costly to undo) | ask me · 50 a day | ask me · 150 a day | yes · 500 a day |

Left out on purpose — tools of the service this plugin does not expose:

- `onedrive__share_file`: Sharing, a link included, gives people outside the mission a file at once and for as long as nobody revokes it; a person shares by hand.
- `onedrive__delete_file`: No deletion is offered, not even a move to the recycle bin: what an agent writes stays until a person removes it.
- `onedrive__update_permissions`: Changing who may open a file is the person's decision, never an agent's.

## Tools

5 tools. A tool's permissions depend on its arguments, so a mission is made of the macro-actions above, not of tools.

| Tool | What it does | Usually touches |
| --- | --- | --- |
| `onedrive__list_folder` | List a folder | `onedrive.file-list` |
| `onedrive__search_files` | Search files | `onedrive.file-list` |
| `onedrive__read_file` | Read a file | `onedrive.file-read` |
| `onedrive__upload_file` | Upload a file | `onedrive.file-upload` |
| `onedrive__create_folder` | Create a folder | `onedrive.folder-create` |

## Connecting an account

**3 of 3 · you sign in through an OAuth broker** — `oauth2 · broker · microsoft`

**Before anyone connects** (an administrator, once):

- The instance must be enrolled with an OAuth broker serving the service `microsoft`; an administrator sets it up once, for everyone on the instance. Until then OneDrive reads "not configured" on the connect screen.
- Two ways to get one: enrol with a broker someone else operates, or run the published broker image with your own client at the service.
- The gateway's pages tell whether the broker is attested.
- OAuth provider `microsoft`; scopes asked: `openid`, `email`, `profile`, `offline_access`, `User.Read`, `Files.ReadWrite`. [Your own OAuth broker](/docs/operations/oauth-broker)

OneDrive signs in through the client of an OAuth broker: nothing is created or pasted, the person signs in at OneDrive and allows the gateway.

Disconnecting: At account.microsoft.com (personal) or myapps.microsoft.com (work or school), open the apps you gave access to and remove the app this gateway signed you in with.

## Health

0 gateways run this plugin (over the last 90 days).

No version of this plugin has reported a call or a gateway yet.

A version is marked validated by the community with at least 200 reports and a success rate of at least 90 %, over the last 90 days; a gateway shows that mark on the accounts of this service. The figures are refreshed at most hourly ([what they mean](/plugins/health)). It is a community signal, not a security guarantee.

Calls are counted over the last 90 days from the instances that share plugin health. Gateways are counted over the same window among the instances that also share usage statistics, so they are a lower bound. The success rate leaves out calls refused for a rejected credential: a revoked token is the user's configuration, not the plugin.

## Links

- [Connect a OneDrive account](/plugins/onedrive#connect)
- [How OneDrive is modelled](https://github.com/vaubaan/gateway/blob/main/docs/handbook/services/onedrive.md)
- [The catalog, as code](https://github.com/vaubaan/gateway/blob/main/plugins/onedrive/src/risk-catalog.yaml)
- [The plugin source](https://github.com/vaubaan/gateway/tree/main/plugins/onedrive)
- The page: [/plugins/onedrive](/plugins/onedrive)
