Skip to content

Commit 88ecf1b

Browse files
committed
fix: sync deno permissions across config files
- Add public.linear.app to --allow-net in deno.json and dist-workspace.toml - Add uploads.linear.app to dist-workspace.toml (was missing) - Add XDG_CONFIG_HOME, HOME, APPDATA to dist-workspace.toml --allow-env - Add --allow-sys=hostname to dist-workspace.toml - Add permissions section to CLAUDE.md - Add docs/deno-permissions.md documenting all permission locations
1 parent 5bbbbc5 commit 88ecf1b

File tree

4 files changed

+101
-5
lines changed

4 files changed

+101
-5
lines changed

CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
- import: use dynamic import only when necessary, the static form is preferable
1010
- avoid the typescript `any` type - prefer strict typing, if you can't find a good way to fix a type issue (particularly with graphql data or documents) explain the problem instead of working around it
1111

12+
## permissions
13+
14+
- deno permissions (--allow-env, --allow-net, etc.) are configured in multiple files that must stay in sync
15+
- see [docs/deno-permissions.md](docs/deno-permissions.md) for the full list of files to update when adding new permissions
16+
- key files: `deno.json` (tasks), `dist-workspace.toml` (release builds), test files
17+
1218
## tests
1319

1420
- tests on commands should mirror the directory structure of the src, e.g.

deno.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"exports": "./src/main.ts",
66
"license": "MIT",
77
"tasks": {
8-
"dev": "deno task codegen && deno run '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app --allow-sys=hostname --quiet src/main.ts ",
9-
"install": "deno task codegen && deno install -c ./deno.json '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app --allow-sys=hostname --quiet -g -f -n linear ./src/main.ts",
8+
"dev": "deno task codegen && deno run '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app,public.linear.app --allow-sys=hostname --quiet src/main.ts ",
9+
"install": "deno task codegen && deno install -c ./deno.json '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app,public.linear.app --allow-sys=hostname --quiet -g -f -n linear ./src/main.ts",
1010
"uninstall": "deno uninstall -g linear",
1111
"sync-schema": "deno task dev schema -o graphql/schema.graphql",
1212
"codegen": "deno run --allow-all npm:@graphql-codegen/cli/graphql-codegen-esm",
1313
"check": "deno check src/main.ts",
14-
"test": "deno test '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,SNAPSHOT_TEST_NAME,CLIFFY_SNAPSHOT_FAKE_TIME,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA,PATH,SystemRoot' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app --allow-sys=hostname --quiet",
15-
"snapshot": "deno test '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,SNAPSHOT_TEST_NAME,CLIFFY_SNAPSHOT_FAKE_TIME,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA,PATH,SystemRoot' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app --allow-sys=hostname -- --update",
14+
"test": "deno test '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,SNAPSHOT_TEST_NAME,CLIFFY_SNAPSHOT_FAKE_TIME,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA,PATH,SystemRoot' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app,public.linear.app --allow-sys=hostname --quiet",
15+
"snapshot": "deno test '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,SNAPSHOT_TEST_NAME,CLIFFY_SNAPSHOT_FAKE_TIME,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA,PATH,SystemRoot' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app,public.linear.app --allow-sys=hostname -- --update",
1616
"lefthook-install": "deno run --allow-run --allow-read --allow-write --allow-env npm:lefthook install",
1717
"validate": "deno task check && deno fmt && deno lint",
1818
"generate-skill-docs": "deno run --allow-run --allow-read --allow-write skills/linear-cli/scripts/generate-docs.ts"

dist-workspace.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ binaries = ["linear"]
1313
build-command = [
1414
"sh",
1515
"-c",
16-
"deno compile --target=$CARGO_DIST_TARGET -o linear '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,NO_COLOR,TMPDIR,TMP,TEMP' --allow-read --allow-write --allow-run --allow-net=api.linear.app --quiet src/main.ts",
16+
"deno compile --target=$CARGO_DIST_TARGET -o linear '--allow-env=GITHUB_*,GH_*,LINEAR_*,NODE_ENV,EDITOR,PAGER,NO_COLOR,TMPDIR,TMP,TEMP,XDG_CONFIG_HOME,HOME,APPDATA' --allow-read --allow-write --allow-run --allow-net=api.linear.app,uploads.linear.app,public.linear.app --allow-sys=hostname --quiet src/main.ts",
1717
]
1818

1919
# Config for 'dist'

docs/deno-permissions.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Deno Permissions Configuration
2+
3+
This document tracks all locations where Deno permission flags are configured. When adding new permissions (e.g., new network hosts, environment variables), **all files must be updated** to stay in sync.
4+
5+
## Permission Types
6+
7+
| Permission | Purpose |
8+
| --------------- | ------------------------------------------------------------- |
9+
| `--allow-env` | Environment variable access (API keys, config, editor, pager) |
10+
| `--allow-net` | Network access to Linear API and file storage |
11+
| `--allow-read` | File system read access |
12+
| `--allow-write` | File system write access |
13+
| `--allow-run` | Execute subprocesses (git, jj, editor, pager) |
14+
| `--allow-sys` | System info access (hostname) |
15+
16+
## Network Hosts
17+
18+
The following hosts must be allowed for full functionality:
19+
20+
- `api.linear.app` - GraphQL API
21+
- `uploads.linear.app` - Private file uploads/downloads
22+
- `public.linear.app` - Public image downloads
23+
24+
## Files to Update
25+
26+
### Primary Configuration
27+
28+
These files define permissions for production use:
29+
30+
| File | Lines | Purpose |
31+
| --------------------- | ---------- | ------------------------------------------ |
32+
| `deno.json` | 8-9, 14-15 | `dev`, `install`, `test`, `snapshot` tasks |
33+
| `dist-workspace.toml` | 16 | Binary compilation for releases |
34+
35+
### Test Configuration
36+
37+
Test files define their own `denoArgs` arrays. Most use a shared helper:
38+
39+
| File | Lines | Notes |
40+
| -------------------------------------------- | ----- | ----------------------------------------------- |
41+
| `test/utils/test-helpers.ts` | 5-9 | Shared `commonDenoArgs` used by milestone tests |
42+
| `test/commands/issue/issue-view.test.ts` | 10-14 | Local `denoArgs` |
43+
| `test/commands/issue/issue-describe.test.ts` | 7-11 | Local `denoArgs` |
44+
| `test/commands/issue/issue-commits.test.ts` | 6-10 | Local `denoArgs` |
45+
| `test/commands/team/team-list.test.ts` | 8-12 | Local `denoArgs` |
46+
| `test/commands/project/project-view.test.ts` | 7-11 | Local `denoArgs` |
47+
48+
Note: Test files often use broader permissions (e.g., `--allow-net` without host restrictions) since they run against mock servers.
49+
50+
## Environment Variables
51+
52+
### Runtime Variables
53+
54+
Used by the CLI during normal operation:
55+
56+
```
57+
GITHUB_*, GH_* - GitHub integration
58+
LINEAR_* - Linear API key and config
59+
NODE_ENV - Environment detection
60+
EDITOR - Text editor for descriptions
61+
PAGER - Pager for long output
62+
NO_COLOR - Disable color output
63+
TMPDIR, TMP, TEMP - Temp directory for downloads
64+
XDG_CONFIG_HOME - Config file location (Linux)
65+
HOME - Home directory
66+
APPDATA - Config file location (Windows)
67+
```
68+
69+
### Test-Only Variables
70+
71+
Additional variables needed for tests:
72+
73+
```
74+
SNAPSHOT_TEST_NAME - Cliffy snapshot testing
75+
CLIFFY_SNAPSHOT_FAKE_TIME - Time mocking in tests
76+
PATH - Process execution
77+
SystemRoot - Windows compatibility
78+
MOCK_GIT_BRANCH_COMMAND - Git mocking in tests
79+
TEST_CURRENT_TIME - Time mocking
80+
```
81+
82+
## Checklist for Adding Permissions
83+
84+
When adding a new permission:
85+
86+
1. [ ] Update `deno.json` tasks: `dev`, `install`, `test`, `snapshot`
87+
2. [ ] Update `dist-workspace.toml` build command
88+
3. [ ] Update `test/utils/test-helpers.ts` if tests need it
89+
4. [ ] Update individual test files if they have local `denoArgs`
90+
5. [ ] Document the new permission in this file

0 commit comments

Comments
 (0)