rakomi 0.0.1 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +76 -14
- package/SECURITY.md +206 -0
- package/dist/browser.js +15 -0
- package/dist/clients.js +24 -0
- package/dist/commands/connect.js +99 -0
- package/dist/commands/login.js +70 -0
- package/dist/commands/logout.js +4 -0
- package/dist/commands/tenants.js +54 -0
- package/dist/commands/whoami.js +18 -0
- package/dist/connect-client.js +32 -0
- package/dist/env.js +23 -0
- package/dist/errors.js +33 -0
- package/dist/http.js +70 -0
- package/dist/index.js +198 -0
- package/dist/loopback-server.js +63 -0
- package/dist/mcp-config.js +76 -0
- package/dist/oauth-authcode.js +30 -0
- package/dist/oauth-device.js +57 -0
- package/dist/pkce.js +22 -0
- package/dist/session.js +320 -0
- package/dist/tenants-client.js +64 -0
- package/dist/usage.js +38 -0
- package/dist/userinfo-client.js +16 -0
- package/package.json +36 -18
- package/sbom.cdx.json +43 -0
- package/bin/rakomi.js +0 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CRE8EVE Sp. z o.o.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,24 +1,86 @@
|
|
|
1
1
|
# rakomi
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> the `rakomi` name on the public npm registry.
|
|
3
|
+
The [Rakomi](https://rakomi.com) CLI. EU-native authentication as a service.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
CLI will be installable globally:
|
|
5
|
+
## Getting started
|
|
8
6
|
|
|
9
|
-
```
|
|
10
|
-
|
|
7
|
+
```sh
|
|
8
|
+
npx rakomi login
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Signs you in with your browser (loopback OAuth + PKCE). Add `--no-browser` on a headless/SSH
|
|
12
|
+
session to get a short code to enter on another device instead.
|
|
14
13
|
|
|
15
|
-
##
|
|
14
|
+
## Connect an AI agent
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
```sh
|
|
17
|
+
npx rakomi connect
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Detects Claude Code and writes the `.mcp.json` entry for you, or prints Claude Desktop's
|
|
21
|
+
Custom-Connectors instructions when run with `--client claude-desktop`. Read access works
|
|
22
|
+
immediately once the client finishes its own sign-in; write access is a separate step your
|
|
23
|
+
tenant owner approves — see the [Connect an AI Agent guide](https://docs.rakomi.dev/guides/connect-an-ai-agent).
|
|
24
|
+
|
|
25
|
+
Pass `--cimd-url <url>` (find it in your MCP client's own connection diagnostics) and `rakomi`
|
|
26
|
+
confirms the connection for you instead of leaving you to check the dashboard; add `--write` to
|
|
27
|
+
also request owner-granted write access once it's found. `--status --cimd-url <url>` re-checks
|
|
28
|
+
later without rewriting `.mcp.json` — the resume path when you weren't ready to approve yet.
|
|
29
|
+
|
|
30
|
+
## Provision a tenant
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npx rakomi tenants create "Acme staging"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Creates a new tenant with you as the owner by default (`--owner me`) — no invitation round trip, and
|
|
37
|
+
the response includes a freshly minted API key (shown once — save it). Pass `--owner <email>` to hand
|
|
38
|
+
ownership to someone else instead; that requires a partner API credential (a `client_credentials`
|
|
39
|
+
token), sends a real invitation e-mail, and is refused under `--ci` — see
|
|
40
|
+
[Provision Tenants](https://docs.rakomi.dev/guides/provision-tenants) for both flows end to end.
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
| Command | Description |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `login` | sign in (browser by default; `--no-browser` for a device code) |
|
|
47
|
+
| `logout` | clear the local session |
|
|
48
|
+
| `whoami` | show the signed-in account |
|
|
49
|
+
| `connect` | connect Claude Code / Claude Desktop to your tenant (read access) |
|
|
50
|
+
| `tenants create <name>` | create a tenant (`--owner me\|<email>`, `--slug <slug>`) |
|
|
51
|
+
| `tenants list` | list tenants you provisioned |
|
|
52
|
+
|
|
53
|
+
## Global options
|
|
54
|
+
|
|
55
|
+
| Option | Meaning |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `--json` | machine-readable output |
|
|
58
|
+
| `--yes`, `--ci` | never prompt; fail fast on any step needing a human |
|
|
59
|
+
| `--dry-run` | print what would happen, make no writes or mutating calls |
|
|
60
|
+
| `--no-browser` | use the device-code flow instead of opening a browser |
|
|
61
|
+
| `--no-keychain` | store the session in a `0600` file instead of the OS keychain |
|
|
62
|
+
| `--client <name>` | `claude-code` or `claude-desktop` — required when more than one applies |
|
|
63
|
+
| `--undo` | restore the `.mcp.json` `connect` last backed up |
|
|
64
|
+
| `--cimd-url <url>` | (`connect`) the connecting client's own CIMD document URL — confirms/re-checks the connection |
|
|
65
|
+
| `--status` | (`connect`) re-check status only — needs `--cimd-url`, never rewrites `.mcp.json` |
|
|
66
|
+
| `-h`, `--help` | show help |
|
|
67
|
+
| `-V`, `--version` | print the version |
|
|
68
|
+
|
|
69
|
+
## Caveats
|
|
70
|
+
|
|
71
|
+
- **Your session lives in your OS keychain** — macOS Keychain, the Linux Secret Service (via
|
|
72
|
+
`secret-tool`), or a Data-Protection-API-encrypted file on Windows — whichever is available.
|
|
73
|
+
`rakomi whoami` names the exact backend in use. When none is available (or you pass
|
|
74
|
+
`--no-keychain`, or `CI` is set), the CLI falls back to a `0600` file under
|
|
75
|
+
`~/.config/rakomi/session.json` (or `RAKOMI_CONFIG_DIR` if set) and prints a one-line notice the
|
|
76
|
+
first time it does. An existing `0600` file from an older install is imported into the keychain
|
|
77
|
+
automatically, then removed. `rakomi logout` clears whichever backend is in use.
|
|
78
|
+
- **The access token is never printed, logged, or included in `--json` output.**
|
|
79
|
+
- **No telemetry.** The CLI collects nothing and phones home about nothing beyond the Rakomi API
|
|
80
|
+
calls a command actually needs to make.
|
|
81
|
+
- **`--owner <email>` sends a real invitation e-mail** — it always requires interactive
|
|
82
|
+
confirmation and is refused under `--ci`.
|
|
21
83
|
|
|
22
|
-
##
|
|
84
|
+
## License
|
|
23
85
|
|
|
24
|
-
CRE8EVE
|
|
86
|
+
[MIT](./LICENSE) © CRE8EVE Sp. z o.o.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
This policy covers the four JS-family SDK packages: `@rakomi/node`, `@rakomi/sdk-core`,
|
|
6
|
+
`@rakomi/react`, and `@rakomi/react-native`.
|
|
7
|
+
|
|
8
|
+
While these packages remain pre-1.0 (`0.x`), they carry **no stability or support guarantee**
|
|
9
|
+
(SemVer 2.0.0 §4); the latest `0.x` line receives security updates on a best-effort basis.
|
|
10
|
+
|
|
11
|
+
From version **1.0** onward, Rakomi maintains the current (N) and previous (N-1) MAJOR in parallel, with N-1 receiving
|
|
12
|
+
security-only fixes. The CRA support period for each MAJOR is determined in accordance with
|
|
13
|
+
**CRA Art. 13(8)** — at least five years, or the product's expected use time where shorter. The authoritative, machine-readable support windows are published at
|
|
14
|
+
[`https://api.rakomi.com/.well-known/sdk-support.json`](https://api.rakomi.com/.well-known/sdk-support.json)
|
|
15
|
+
and rendered for humans on the [SDK Support & Lifecycle page](https://rakomi.com/sdk-support). This
|
|
16
|
+
document points at that single source rather than re-typing dated rows.
|
|
17
|
+
|
|
18
|
+
Vulnerabilities in peer dependencies (e.g., React) are out of Rakomi's direct scope, but Rakomi will update minimum peer dependency versions when a peer dependency has a known critical CVE affecting SDK users.
|
|
19
|
+
|
|
20
|
+
## Reporting a Vulnerability
|
|
21
|
+
|
|
22
|
+
**Please do NOT open a public GitHub issue for security vulnerabilities.**
|
|
23
|
+
|
|
24
|
+
We support two reporting channels:
|
|
25
|
+
|
|
26
|
+
1. **Email:** security@rakomi.com (preferred for initial contact)
|
|
27
|
+
2. **GitHub Private Vulnerability Reporting:** [Submit via GitHub Security](https://github.com/rakomidev/rakomi-js/security/advisories/new) — each report automatically receives a GHSA tracking identifier (GHSA-xxxx-xxxx-xxxx).
|
|
28
|
+
|
|
29
|
+
For encrypted communication, a PGP public key is available at:
|
|
30
|
+
`https://rakomi.com/rakomi-security-pgp-key.asc`
|
|
31
|
+
|
|
32
|
+
Include the key fingerprint from this file (section 14) for out-of-band verification when sending encrypted reports.
|
|
33
|
+
|
|
34
|
+
## Response Targets
|
|
35
|
+
|
|
36
|
+
We strive to meet these response targets. Actual response times may vary based on issue complexity and team availability.
|
|
37
|
+
|
|
38
|
+
| Severity | First Response | Fix Target | Disclosure |
|
|
39
|
+
|----------|---------------|------------|------------|
|
|
40
|
+
| Critical (actively exploited) | without undue delay (target: 24h) | 72h patch/mitigation | Designated EU authority notified within 24h (CRA Art. 14) |
|
|
41
|
+
| High | without undue delay (target: 48h) | 14 days | Coordinated after fix |
|
|
42
|
+
| Medium | 5 business days | 90 days | Coordinated after fix |
|
|
43
|
+
| Low | 5 business days | Next release cycle | Changelog note |
|
|
44
|
+
|
|
45
|
+
Severity is assessed using industry-standard vulnerability scoring criteria.
|
|
46
|
+
|
|
47
|
+
Rakomi is maintained by a small team. During periods of reduced availability, the auto-reply from security@rakomi.com will confirm receipt and provide the PGP key. For actively exploited vulnerabilities, we will respond as quickly as humanly possible.
|
|
48
|
+
|
|
49
|
+
## Coordinated Vulnerability Disclosure (CVD) Policy
|
|
50
|
+
|
|
51
|
+
We follow a coordinated disclosure model with a **90-day embargo** period from the date of acknowledgment. During this time:
|
|
52
|
+
|
|
53
|
+
- Rakomi will work to develop and release a fix
|
|
54
|
+
- We will keep the reporter updated on progress at least every 7 business days for Critical/High severity issues
|
|
55
|
+
- We will notify the reporter when a fix is released
|
|
56
|
+
- After 90 days, we will publish a security advisory regardless of fix status
|
|
57
|
+
|
|
58
|
+
We may request an extension if the fix requires significant infrastructure changes, and we will coordinate with the reporter before any deadline extension.
|
|
59
|
+
|
|
60
|
+
## Safe Harbor
|
|
61
|
+
|
|
62
|
+
We will not pursue legal action against researchers who follow this disclosure policy and act in good faith. We consider security research conducted in accordance with this policy to be:
|
|
63
|
+
- Conducted lawfully and in good faith under applicable EU law
|
|
64
|
+
- Not subject to legal action by CRE8EVE Sp. z o.o.
|
|
65
|
+
|
|
66
|
+
Safe harbor **does not extend to**:
|
|
67
|
+
- Accessing or modifying other users' data
|
|
68
|
+
- Performing denial of service attacks
|
|
69
|
+
- Social engineering employees or users
|
|
70
|
+
- Exfiltrating data beyond what is necessary to demonstrate the vulnerability
|
|
71
|
+
- Any activity that violates applicable law
|
|
72
|
+
|
|
73
|
+
## Scope
|
|
74
|
+
|
|
75
|
+
**In scope:**
|
|
76
|
+
- `@rakomi/node`, `@rakomi/sdk-core`, `@rakomi/react`, and `@rakomi/react-native` SDK source code and published npm packages
|
|
77
|
+
- Security properties of API interactions initiated by the SDKs (request signing, token verification, credential handling)
|
|
78
|
+
- Authentication flow logic within the SDKs
|
|
79
|
+
|
|
80
|
+
**Out of scope:**
|
|
81
|
+
- Social engineering attacks against Rakomi employees or users
|
|
82
|
+
- Denial of service attacks
|
|
83
|
+
- Physical security
|
|
84
|
+
- Vulnerabilities in third-party services used by Rakomi's backend
|
|
85
|
+
- Vulnerabilities in peer dependencies (e.g., React) — reported to the relevant maintainer, but Rakomi will update minimum peer dependency versions when a peer dependency has a known critical CVE affecting SDK users
|
|
86
|
+
|
|
87
|
+
This policy applies to the official `@rakomi/node`, `@rakomi/sdk-core`, `@rakomi/react`, and `@rakomi/react-native` packages distributed via npmjs.com. Forks and derivatives are maintained by their respective authors. Customers in regulated sectors (healthcare, finance) may have additional notification obligations beyond this general policy — contact security@rakomi.com for sector-specific compliance documentation.
|
|
88
|
+
|
|
89
|
+
## EU Authority Reporting
|
|
90
|
+
|
|
91
|
+
It is our **policy** to report actively exploited vulnerabilities and severe security incidents
|
|
92
|
+
having an impact on the security of our products to the relevant EU authority in accordance with
|
|
93
|
+
**CRA Art. 14**, on the statutory timeline: an early warning, followed by a fuller notification, and
|
|
94
|
+
a final report.
|
|
95
|
+
|
|
96
|
+
We report to the national coordinator CSIRT designated for our Member State of main establishment
|
|
97
|
+
(Poland), which is our live reporting channel today; onboarding to the EU single reporting platform
|
|
98
|
+
is in progress, and that platform is the documented onward path as it becomes available to
|
|
99
|
+
manufacturers.
|
|
100
|
+
|
|
101
|
+
## Security Update Notifications
|
|
102
|
+
|
|
103
|
+
Consumers of Rakomi SDKs can receive security update notifications through:
|
|
104
|
+
- **GitHub Security Advisories** on this repository (subscribe via GitHub "Watch" → "Security alerts")
|
|
105
|
+
- **npm audit:** `npm audit` or `pnpm audit` will flag known vulnerabilities in installed versions
|
|
106
|
+
|
|
107
|
+
In accordance with CRA Art. 14(8), after becoming aware of an actively exploited vulnerability or a severe incident having an impact on the security of our products, we will inform impacted users (and, where appropriate, all users) — together with any available risk-mitigation or corrective measures — through the above channels.
|
|
108
|
+
|
|
109
|
+
## Manufacturer Identification
|
|
110
|
+
|
|
111
|
+
**Legal entity:** CRE8EVE Sp. z o.o.
|
|
112
|
+
**Registered address:** Tulipanowa 4, 72-003 Dobra, Poland (EU)
|
|
113
|
+
**Contact:** security@rakomi.com (role-based — no personal mailbox or phone is published)
|
|
114
|
+
**Products covered:** `@rakomi/node`, `@rakomi/sdk-core`, `@rakomi/react`, `@rakomi/react-native` (published on npmjs.com)
|
|
115
|
+
|
|
116
|
+
The manufacturer is itself EU-established (Poland), so no CRA Art. 18 Authorised Representative is required (Art. 18 applies to manufacturers established outside the Union). CRA conformity assessment (Art. 32): these are Class I important products (Annex III). The internal-control procedure (Annex VIII, Module A — manufacturer self-assessment, no notified-body involvement) is available for a Class I product **only where harmonised standards, common specifications, or a European cybersecurity certification scheme at assurance level at least 'substantial' are applied in full** (Art. 32(2)); otherwise a third-party route — EU-type examination plus conformity to type (modules B+C), or full quality assurance (module H) — is required. The applicable route will be confirmed against the harmonised standards in force at the CRA application date. The EU Declaration of Conformity and CE marking attach at the CRA application date (Dec 2027) and are not yet issued. See the full manufacturer record at https://docs.rakomi.dev/compliance/manufacturer/.
|
|
117
|
+
|
|
118
|
+
## Export Control / Cryptography Notice
|
|
119
|
+
|
|
120
|
+
The four `@rakomi/*` SDK packages incorporate and invoke cryptography — they verify asymmetric
|
|
121
|
+
digital signatures (JWT/token verification), compare key material in constant time, and rely on the
|
|
122
|
+
host platform's TLS for transport security. They are distributed as **publicly available, mass-market
|
|
123
|
+
software** with cryptographic functionality the end user cannot readily modify.
|
|
124
|
+
|
|
125
|
+
- **EU — Regulation (EU) 2021/821 (Dual-Use):** the SDKs qualify for the **mass-market** treatment
|
|
126
|
+
under the Cryptography Note (Note 3) to Category 5, Part 2 of Annex I — generally available to the
|
|
127
|
+
public, sold without restriction, and not designed for the user to alter the cryptographic
|
|
128
|
+
functionality. No export authorisation is required for their distribution within or from the EU, and —
|
|
129
|
+
unlike the US path — the EU decontrol is **self-executing**, with no notification or filing step.
|
|
130
|
+
- **US — Export Administration Regulations (EAR):** the cryptographic functionality is classifiable
|
|
131
|
+
under **ECCN 5D002**. As **publicly available** open-source software the source code is **not
|
|
132
|
+
subject to the EAR** (15 CFR §734.7(a)), and the corresponding object code is distributed under the
|
|
133
|
+
mass-market provisions. The one-time email notification of the public source-code URL to the U.S.
|
|
134
|
+
BIS and NSA is filed at first public release (15 CFR §742.15(b)).
|
|
135
|
+
|
|
136
|
+
This notice is provided for transparency and is **not legal advice**. Downstream redistributors are
|
|
137
|
+
responsible for their own export, import, and use obligations in their jurisdiction.
|
|
138
|
+
|
|
139
|
+
## Post-Market Surveillance
|
|
140
|
+
|
|
141
|
+
Rakomi monitors SDK health after release through:
|
|
142
|
+
- Automated dependency vulnerability scanning (npm audit, Dependabot)
|
|
143
|
+
- Runtime error patterns derived from API logs (SDK version reported in User-Agent header)
|
|
144
|
+
- Periodic security review of SDK code per the internal security review process
|
|
145
|
+
|
|
146
|
+
This constitutes the "effective and regular tests and reviews of the security of the product with digital elements" required under CRA Annex I, Part II, point (3). The coordinated-vulnerability-disclosure policy required under CRA Annex I, Part II, point (5) is set out in the "Coordinated Vulnerability Disclosure (CVD) Policy" section above.
|
|
147
|
+
|
|
148
|
+
## No Bounty Program
|
|
149
|
+
|
|
150
|
+
Rakomi does not currently operate a paid bug bounty program. We deeply appreciate responsible disclosure and will acknowledge researchers in security advisories (with their consent).
|
|
151
|
+
|
|
152
|
+
## Reference: security.txt
|
|
153
|
+
|
|
154
|
+
This policy is referenced in our machine-readable security contact file (RFC 9116):
|
|
155
|
+
`/.well-known/security.txt` — deployed at `https://rakomi.com/.well-known/security.txt`
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## What to Include in Your Report
|
|
160
|
+
|
|
161
|
+
*(ISO/IEC 29147:2018 §6.5)*
|
|
162
|
+
|
|
163
|
+
To help us triage efficiently, please include:
|
|
164
|
+
|
|
165
|
+
1. **Affected package** name and version (e.g., @rakomi/node 0.2.0)
|
|
166
|
+
2. **Reproduction steps** — a minimal, reproducible example
|
|
167
|
+
3. **Impact assessment** — what an attacker could achieve
|
|
168
|
+
4. **Proof of concept** — if available (do not use real user data)
|
|
169
|
+
5. **Reporter contact** — so we can keep you updated
|
|
170
|
+
|
|
171
|
+
Reports that do not include reproduction steps or fall outside the defined scope may be closed without a tracking ID.
|
|
172
|
+
|
|
173
|
+
## Report Tracking
|
|
174
|
+
|
|
175
|
+
*(ISO/IEC 29147:2018 §6.6)*
|
|
176
|
+
|
|
177
|
+
Each report receives a unique tracking identifier upon acknowledgment. For reports submitted via GitHub Private Vulnerability Reporting, the GHSA identifier (e.g., GHSA-xxxx-xxxx-xxxx) serves as the tracking ID. For email reports, we will direct you to also submit via GitHub PVR for formal tracking.
|
|
178
|
+
|
|
179
|
+
## Status Updates
|
|
180
|
+
|
|
181
|
+
*(ISO/IEC 29147:2018 §6.4)*
|
|
182
|
+
|
|
183
|
+
We provide status updates at least every **7 business days** for Critical/High severity issues, and upon resolution for Medium/Low severity issues.
|
|
184
|
+
|
|
185
|
+
## CVE Assignment
|
|
186
|
+
|
|
187
|
+
Confirmed vulnerabilities with sufficient impact will receive CVE identifiers via GitHub's CNA (CVE Numbering Authority) program.
|
|
188
|
+
|
|
189
|
+
## Reporter Data Privacy
|
|
190
|
+
|
|
191
|
+
*(GDPR Art. 6(1)(f) + Art. 13/14)*
|
|
192
|
+
|
|
193
|
+
Reporter personal data (name, email) is processed under GDPR Art. 6(1)(f) legitimate interest for vulnerability coordination. This data is:
|
|
194
|
+
- Retained for the duration of the vulnerability lifecycle plus 2 years
|
|
195
|
+
- Not shared with third parties except as required for CVE assignment or regulatory reporting (e.g., ENISA, national CSIRT)
|
|
196
|
+
- Accessible to the reporter upon request (GDPR Art. 15)
|
|
197
|
+
- Deletable upon request after vulnerability closure (GDPR Art. 17, where not overridden by regulatory retention obligations)
|
|
198
|
+
|
|
199
|
+
To exercise your GDPR rights, contact security@rakomi.com.
|
|
200
|
+
|
|
201
|
+
## PGP Key Fingerprint
|
|
202
|
+
|
|
203
|
+
The PGP public key for encrypted communication is available at:
|
|
204
|
+
`https://rakomi.com/rakomi-security-pgp-key.asc`
|
|
205
|
+
|
|
206
|
+
Verify the key fingerprint through an independent channel (e.g., LinkedIn, Twitter/X, or a direct phone call) before sending sensitive information.
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
export function systemBrowserOpener(platform = process.platform) {
|
|
3
|
+
return (url) => new Promise((resolve) => {
|
|
4
|
+
const done = () => resolve();
|
|
5
|
+
if (platform === 'darwin') {
|
|
6
|
+
execFile('open', [url], done);
|
|
7
|
+
}
|
|
8
|
+
else if (platform === 'win32') {
|
|
9
|
+
execFile('cmd', ['/c', 'start', '""', url], done);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
execFile('xdg-open', [url], done);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
package/dist/clients.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const KNOWN_CLIENTS = ['claude-code', 'claude-desktop'];
|
|
2
|
+
export function isKnownClient(value) {
|
|
3
|
+
return KNOWN_CLIENTS.includes(value);
|
|
4
|
+
}
|
|
5
|
+
export function clientDisplayName(client) {
|
|
6
|
+
return client === 'claude-code' ? 'Claude Code' : 'Claude Desktop';
|
|
7
|
+
}
|
|
8
|
+
export function resolveTargetClients(opts) {
|
|
9
|
+
if (opts.explicitClient) {
|
|
10
|
+
if (!isKnownClient(opts.explicitClient)) {
|
|
11
|
+
throw new AmbiguousClientError(`Unknown --client "${opts.explicitClient}". Known clients: ${KNOWN_CLIENTS.join(', ')}.`);
|
|
12
|
+
}
|
|
13
|
+
return [opts.explicitClient];
|
|
14
|
+
}
|
|
15
|
+
if (opts.claudeCodeDetected)
|
|
16
|
+
return ['claude-code'];
|
|
17
|
+
throw new AmbiguousClientError(`Could not detect an installed MCP client automatically. Pass --client <${KNOWN_CLIENTS.join('|')}>.`);
|
|
18
|
+
}
|
|
19
|
+
export class AmbiguousClientError extends Error {
|
|
20
|
+
constructor(message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'AmbiguousClientError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AmbiguousClientError, clientDisplayName, resolveTargetClients } from '../clients.js';
|
|
2
|
+
import { pollCimdMaterialization, requestWriteElevation } from '../connect-client.js';
|
|
3
|
+
import { DEFAULT_MCP_URL } from '../env.js';
|
|
4
|
+
import { InteractiveRequiredError, NotLoggedInError, UsageError } from '../errors.js';
|
|
5
|
+
import { mcpConfigPath, undoMcpConfigWrite, writeRakomiMcpServerEntry } from '../mcp-config.js';
|
|
6
|
+
const CLAUDE_DESKTOP_INSTRUCTIONS = [
|
|
7
|
+
'Claude Desktop connects to remote MCP servers through Connectors, configured from your Claude',
|
|
8
|
+
'account rather than a local file — there is nothing for `rakomi connect` to write.',
|
|
9
|
+
'',
|
|
10
|
+
'1. Open Settings -> Connectors in Claude Desktop and add a custom connector.',
|
|
11
|
+
`2. Enter Rakomi's MCP server URL: ${DEFAULT_MCP_URL}`,
|
|
12
|
+
'3. Click Connect. Claude Desktop opens your browser at accounts.rakomi.com — sign in and',
|
|
13
|
+
' approve the read-only consent screen.',
|
|
14
|
+
].join('\n');
|
|
15
|
+
export async function runConnect(deps) {
|
|
16
|
+
if (deps.undo) {
|
|
17
|
+
const restored = undoMcpConfigWrite(deps.cwd);
|
|
18
|
+
deps.stdout.write(restored
|
|
19
|
+
? `Restored ${mcpConfigPath(deps.cwd)} from the backup \`rakomi connect\` made.\n`
|
|
20
|
+
: `No \`rakomi connect\` backup found at ${mcpConfigPath(deps.cwd)}.rakomi-backup — nothing to undo.\n`);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const session = deps.session.read();
|
|
24
|
+
if (!session)
|
|
25
|
+
throw new NotLoggedInError();
|
|
26
|
+
if (deps.status) {
|
|
27
|
+
await reportStatus(deps, session.access_token);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let targets;
|
|
31
|
+
try {
|
|
32
|
+
targets = resolveTargetClients({ explicitClient: deps.explicitClient, claudeCodeDetected: deps.detectClaudeCode() });
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
if (e instanceof AmbiguousClientError)
|
|
36
|
+
throw new UsageError(e.message);
|
|
37
|
+
throw e;
|
|
38
|
+
}
|
|
39
|
+
for (const client of targets) {
|
|
40
|
+
if (client === 'claude-desktop') {
|
|
41
|
+
deps.stdout.write(`${clientDisplayName(client)}:\n${CLAUDE_DESKTOP_INSTRUCTIONS}\n`);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
await connectClaudeCode(deps, session.access_token);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function reportStatus(deps, accessToken) {
|
|
48
|
+
if (!deps.cimdUrl) {
|
|
49
|
+
throw new UsageError('`connect --status` needs `--cimd-url <url>` — the CIMD URL `connect` printed when it started waiting.');
|
|
50
|
+
}
|
|
51
|
+
const row = await pollCimdMaterialization(deps, { apiBaseUrl: deps.apiBaseUrl, accessToken, cimdUrl: deps.cimdUrl });
|
|
52
|
+
if (!row) {
|
|
53
|
+
deps.stdout.write('Not connected yet — finish sign-in in your MCP client, then run this command again.\n');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
deps.stdout.write(`Connected — access: ${row.agent_access.level}${row.agent_access.owner_granted ? ' (owner-granted)' : ''}.\n`);
|
|
57
|
+
if (deps.write && row.agent_access.level !== 'write') {
|
|
58
|
+
await requestWrite(deps, accessToken, row.id);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function connectClaudeCode(deps, accessToken) {
|
|
62
|
+
if (deps.dryRun) {
|
|
63
|
+
deps.stdout.write(`Would write ${mcpConfigPath(deps.cwd)} with mcpServers.rakomi -> ${deps.mcpUrl}. No file written (--dry-run).\n`);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const result = writeRakomiMcpServerEntry(deps.cwd, deps.mcpUrl);
|
|
67
|
+
if (result.wrote) {
|
|
68
|
+
deps.stdout.write(`Wrote ${mcpConfigPath(deps.cwd)}${result.backedUp ? ' (previous file backed up)' : ''}.\n${result.diff}\n`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
deps.stdout.write(`${result.diff}\n`);
|
|
72
|
+
}
|
|
73
|
+
deps.stdout.write('Now open Claude Code and run `claude mcp login rakomi` to finish sign-in in your browser.\n' +
|
|
74
|
+
'Once approved, Claude Code has READ access to your tenant immediately.\n');
|
|
75
|
+
if (!deps.cimdUrl) {
|
|
76
|
+
deps.stdout.write('\nOnce connected, Rakomi can confirm it and (with --write) request write access for you — pass ' +
|
|
77
|
+
'`--cimd-url <url>` (find it in your MCP client\'s own connection diagnostics) to use it, or ' +
|
|
78
|
+
'check the Agents page in the dashboard.\n');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const row = await pollCimdMaterialization(deps, { apiBaseUrl: deps.apiBaseUrl, accessToken, cimdUrl: deps.cimdUrl });
|
|
82
|
+
if (!row) {
|
|
83
|
+
deps.stdout.write(`\nNot connected yet. Ctrl+C is safe — resume any time with:\n` +
|
|
84
|
+
` rakomi connect --status --cimd-url ${deps.cimdUrl}\n`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
deps.stdout.write(`\nConnected — access: ${row.agent_access.level}.\n`);
|
|
88
|
+
if (deps.write) {
|
|
89
|
+
if (deps.ci) {
|
|
90
|
+
throw new InteractiveRequiredError('`connect --write` cannot run under --ci — write-access needs a human owner decision.');
|
|
91
|
+
}
|
|
92
|
+
await requestWrite(deps, accessToken, row.id);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async function requestWrite(deps, accessToken, oauthClientId) {
|
|
96
|
+
await requestWriteElevation(deps, { apiBaseUrl: deps.apiBaseUrl, accessToken, oauthClientId });
|
|
97
|
+
deps.stdout.write("Write-access request sent to your tenant's owner(s) — if that's you, you'll approve it yourself " +
|
|
98
|
+
'from the dashboard Agents page. Destructive actions will still ask a human every time.\n');
|
|
99
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { accountsBaseUrl, apiBaseUrl, clientId as resolveClientId, isCimdClientId } from '../env.js';
|
|
2
|
+
import { CliError, EXIT } from '../errors.js';
|
|
3
|
+
import { buildAuthorizeUrl, exchangeAuthorizationCode } from '../oauth-authcode.js';
|
|
4
|
+
import { loginWithDeviceGrant } from '../oauth-device.js';
|
|
5
|
+
import { generatePkcePair } from '../pkce.js';
|
|
6
|
+
export const LOGIN_SCOPE = 'openid profile email clients:read elevation:request';
|
|
7
|
+
const LOOPBACK_TIMEOUT_MS = 5 * 60_000;
|
|
8
|
+
export async function runLogin(deps) {
|
|
9
|
+
const apiUrl = apiBaseUrl(deps.env);
|
|
10
|
+
const cid = resolveClientId(deps.env);
|
|
11
|
+
if (deps.noBrowser && isCimdClientId(cid)) {
|
|
12
|
+
throw new CliError('rakomi login --no-browser needs a client registered for the device-code grant; the ' +
|
|
13
|
+
"default CIMD client_id does not support it. Pass --client <your-client-id> (create one " +
|
|
14
|
+
'in the dashboard) for headless/SSH sign-in, or omit --no-browser to sign in via loopback.', EXIT.FAIL);
|
|
15
|
+
}
|
|
16
|
+
const token = deps.noBrowser
|
|
17
|
+
? await runDeviceGrantLogin(deps, apiUrl, cid)
|
|
18
|
+
: await runLoopbackLogin(deps, apiUrl, cid);
|
|
19
|
+
const session = {
|
|
20
|
+
access_token: token.access_token,
|
|
21
|
+
refresh_token: token.refresh_token,
|
|
22
|
+
token_type: 'Bearer',
|
|
23
|
+
expires_at: deps.now() + token.expires_in * 1000,
|
|
24
|
+
api_base_url: apiUrl,
|
|
25
|
+
client_id: cid,
|
|
26
|
+
};
|
|
27
|
+
deps.session.write(session);
|
|
28
|
+
deps.stdout.write('Logged in to Rakomi.\n');
|
|
29
|
+
}
|
|
30
|
+
async function runLoopbackLogin(deps, apiUrl, cid) {
|
|
31
|
+
const listener = await deps.startLoopback();
|
|
32
|
+
try {
|
|
33
|
+
const pkce = generatePkcePair();
|
|
34
|
+
const authorizeUrl = buildAuthorizeUrl({
|
|
35
|
+
accountsBaseUrl: accountsBaseUrl(deps.env),
|
|
36
|
+
clientId: cid,
|
|
37
|
+
redirectUri: listener.redirectUri,
|
|
38
|
+
pkce,
|
|
39
|
+
scope: LOGIN_SCOPE,
|
|
40
|
+
});
|
|
41
|
+
deps.stdout.write(`Opening your browser to sign in:\n ${authorizeUrl}\n`);
|
|
42
|
+
await deps.openBrowser(authorizeUrl);
|
|
43
|
+
const callback = await listener.waitForCallback(LOOPBACK_TIMEOUT_MS);
|
|
44
|
+
if (callback.error) {
|
|
45
|
+
throw new CliError(`Sign-in failed: ${callback.errorDescription ?? callback.error}`, EXIT.FAIL);
|
|
46
|
+
}
|
|
47
|
+
if (!callback.code || callback.state !== pkce.state) {
|
|
48
|
+
throw new CliError('Sign-in callback was missing the authorization code or had a mismatched state.', EXIT.FAIL);
|
|
49
|
+
}
|
|
50
|
+
return exchangeAuthorizationCode(deps, {
|
|
51
|
+
apiBaseUrl: apiUrl,
|
|
52
|
+
clientId: cid,
|
|
53
|
+
redirectUri: listener.redirectUri,
|
|
54
|
+
code: callback.code,
|
|
55
|
+
codeVerifier: pkce.codeVerifier,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
listener.close();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function runDeviceGrantLogin(deps, apiUrl, cid) {
|
|
63
|
+
return loginWithDeviceGrant({
|
|
64
|
+
...deps,
|
|
65
|
+
onWaiting: (issued) => {
|
|
66
|
+
deps.stdout.write(`To sign in, open ${issued.verification_uri} and enter the code ${issued.user_code}\n` +
|
|
67
|
+
`(or open ${issued.verification_uri_complete} directly).\n`);
|
|
68
|
+
},
|
|
69
|
+
}, { apiBaseUrl: apiUrl, clientId: cid, scope: LOGIN_SCOPE });
|
|
70
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { InteractiveRequiredError, NotLoggedInError, UsageError } from '../errors.js';
|
|
2
|
+
import { createTenant, listTenants } from '../tenants-client.js';
|
|
3
|
+
export async function runTenantsCreate(deps, args) {
|
|
4
|
+
const session = deps.session.read();
|
|
5
|
+
if (!session)
|
|
6
|
+
throw new NotLoggedInError();
|
|
7
|
+
const ownerIsSelf = args.owner === 'me';
|
|
8
|
+
if (!ownerIsSelf && !args.owner.includes('@')) {
|
|
9
|
+
throw new UsageError(`--owner must be "me" or an e-mail address, got "${args.owner}"`);
|
|
10
|
+
}
|
|
11
|
+
if (!ownerIsSelf && deps.ci) {
|
|
12
|
+
throw new InteractiveRequiredError('`tenants create --owner <email>` (a third-party owner) requires interactive confirmation; use --owner me under --ci.');
|
|
13
|
+
}
|
|
14
|
+
if (deps.dryRun) {
|
|
15
|
+
deps.stdout.write(ownerIsSelf
|
|
16
|
+
? `Would create tenant "${args.name}"${args.slug ? ` (slug: ${args.slug})` : ''} with yourself as owner (self-owner — mints an API key). No request sent (--dry-run).\n`
|
|
17
|
+
: `Would create tenant "${args.name}"${args.slug ? ` (slug: ${args.slug})` : ''} with owner ${args.owner}. No request sent (--dry-run).\n`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const result = await createTenant(deps, {
|
|
21
|
+
apiBaseUrl: session.api_base_url,
|
|
22
|
+
accessToken: session.access_token,
|
|
23
|
+
name: args.name,
|
|
24
|
+
slug: args.slug,
|
|
25
|
+
ownerEmail: ownerIsSelf ? undefined : args.owner,
|
|
26
|
+
});
|
|
27
|
+
if (deps.json) {
|
|
28
|
+
deps.stdout.write(JSON.stringify(result) + '\n');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const lines = [`Created tenant "${result.tenant.slug}" (${result.tenant.id}) — status: ${result.tenant.status}`];
|
|
32
|
+
if (result.api_key) {
|
|
33
|
+
lines.push(`You are the owner. API key (shown ONLY this once — save it now): ${result.api_key.key}`);
|
|
34
|
+
}
|
|
35
|
+
else if (result.owner_invitation) {
|
|
36
|
+
lines.push(`An owner invitation was sent to ${args.owner} (expires ${result.owner_invitation.expires_at}).`);
|
|
37
|
+
}
|
|
38
|
+
deps.stdout.write(lines.join('\n') + '\n');
|
|
39
|
+
}
|
|
40
|
+
export async function runTenantsList(deps) {
|
|
41
|
+
const session = deps.session.read();
|
|
42
|
+
if (!session)
|
|
43
|
+
throw new NotLoggedInError();
|
|
44
|
+
const result = await listTenants(deps, { apiBaseUrl: session.api_base_url, accessToken: session.access_token, parent: 'me' });
|
|
45
|
+
if (deps.json) {
|
|
46
|
+
deps.stdout.write(JSON.stringify(result) + '\n');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (result.data.length === 0) {
|
|
50
|
+
deps.stdout.write('No provisioned tenants.\n');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
deps.stdout.write(result.data.map((t) => `${t.slug}\t${t.id}\t${t.status}`).join('\n') + '\n');
|
|
54
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NotLoggedInError } from '../errors.js';
|
|
2
|
+
import { fetchUserInfo } from '../userinfo-client.js';
|
|
3
|
+
export async function runWhoami(deps) {
|
|
4
|
+
const session = deps.session.read();
|
|
5
|
+
if (!session)
|
|
6
|
+
throw new NotLoggedInError();
|
|
7
|
+
const info = await fetchUserInfo(deps, { apiBaseUrl: session.api_base_url, accessToken: session.access_token });
|
|
8
|
+
if (deps.json) {
|
|
9
|
+
deps.stdout.write(JSON.stringify({ sub: info.sub, email: info.email, org_id: info.org_id, org_role: info.org_role, session_store: deps.session.describePath() }) + '\n');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const lines = [`Signed in as: ${info.email ?? info.sub}`];
|
|
13
|
+
if (info.org_id)
|
|
14
|
+
lines.push(`Organization: ${info.org_id}${info.org_role ? ` (${info.org_role})` : ''}`);
|
|
15
|
+
lines.push(`API: ${session.api_base_url}`);
|
|
16
|
+
lines.push(`Session stored in: ${deps.session.describePath()}`);
|
|
17
|
+
deps.stdout.write(lines.join('\n') + '\n');
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CliError, EXIT } from './errors.js';
|
|
2
|
+
import { describeError, request } from './http.js';
|
|
3
|
+
export async function pollCimdMaterialization(deps, opts) {
|
|
4
|
+
const url = new URL('/v1/oauth-clients', opts.apiBaseUrl);
|
|
5
|
+
url.searchParams.set('cimd_url', opts.cimdUrl);
|
|
6
|
+
const result = await request(deps, {
|
|
7
|
+
method: 'GET',
|
|
8
|
+
url: url.toString(),
|
|
9
|
+
headers: { authorization: `Bearer ${opts.accessToken}` },
|
|
10
|
+
});
|
|
11
|
+
if (result.status === 401) {
|
|
12
|
+
throw new CliError('Your session has expired. Run `rakomi login` again.', EXIT.NOT_LOGGED_IN);
|
|
13
|
+
}
|
|
14
|
+
if (result.status !== 200) {
|
|
15
|
+
throw new CliError(`Could not check connection status: ${describeError(result.body, result.status)}`, EXIT.FAIL);
|
|
16
|
+
}
|
|
17
|
+
return result.body.data[0] ?? null;
|
|
18
|
+
}
|
|
19
|
+
export async function requestWriteElevation(deps, opts) {
|
|
20
|
+
const result = await request(deps, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
url: `${opts.apiBaseUrl}/v1/oauth-clients/${encodeURIComponent(opts.oauthClientId)}/elevation-requests`,
|
|
23
|
+
headers: { authorization: `Bearer ${opts.accessToken}` },
|
|
24
|
+
body: { scopes: ['mcp:tools:write'] },
|
|
25
|
+
});
|
|
26
|
+
if (result.status === 401) {
|
|
27
|
+
throw new CliError('Your session has expired. Run `rakomi login` again.', EXIT.NOT_LOGGED_IN);
|
|
28
|
+
}
|
|
29
|
+
if (result.status !== 201 && result.status !== 200) {
|
|
30
|
+
throw new CliError(`Could not request write access: ${describeError(result.body, result.status)}`, EXIT.FAIL);
|
|
31
|
+
}
|
|
32
|
+
}
|