fix: address RUSH-594 P0 audit issues - #27
Conversation
| BRANCH="${LINEAR_CLI_BRANCH:-main}" | ||
| URL="https://raw.githubusercontent.com/${REPO}/${BRANCH}/linear" | ||
| VERSION="${LINEAR_CLI_VERSION:-v0.13.0}" | ||
| EXPECTED_SHA256="${LINEAR_CLI_SHA256:-d62ee380d5565e483f0750ded837b5d453fcc380ffab14fe1d34249d2079a1c2}" |
There was a problem hiding this comment.
P0 blocking: the checksum-pinned install path still ships the pre-fix, vulnerable script.
EXPECTED_SHA256 here is d62ee380d5565e483f0750ded837b5d453fcc380ffab14fe1d34249d2079a1c2. I fetched the actual linear blob at the v0.13.0 tag (ref=fd1adff48bc1a8c1feccd05389736c73406dc7d3, which is this PR's own base commit) and its SHA-256 is exactly that hash — confirmed with shasum -a 256 linear_v0130.py → d62ee380d5565e483f0750ded837b5d453fcc380ffab14fe1d34249d2079a1c2.
That v0.13.0-tagged file still has the pre-fix code this PR is supposed to remove:
- 6 unsafe f-string-interpolated GraphQL query blocks (
grep -n 'f"""' linear_v0130.py→ lines 380, 390, 689, 871, 1409, 1724, vs. only 1 (safe, non-user-data) f-string left atlinear:886in this PR's HEAD). - No
CONFIG_DIR_MODE/write_config_fileat all (grep -n 'CONFIG_DIR_MODE\|write_config_file' linear_v0130.py→ no matches).
Since __version__ is not bumped in this PR (linear still declares __version__ = "0.13.0" at HEAD) and no new tag is cut here, curl ... install.sh | sh (default LINEAR_CLI_VERSION=v0.13.0) will keep downloading and correctly verifying the checksum of the unfixed script after this PR merges. The PR body's own "Isolated installer run" verification (linear-cli 0.13.0, same SHA) is actually evidence of this: it can't distinguish fixed vs. unfixed since the version string and checksum are identical either way.
This needs a new tag (e.g. v0.14.0) cut from this PR's HEAD, with VERSION/EXPECTED_SHA256 here (and the README links) repointed to it — otherwise this P0 fix never reaches anyone who installs via the documented path.
|
|
||
| ```bash | ||
| curl -sSL https://raw.githubusercontent.com/phnx-labs/linear-cli/main/install.sh | bash | ||
| curl -fL -o /usr/local/bin/linear https://raw.githubusercontent.com/phnx-labs/linear-cli/v0.13.0/linear |
There was a problem hiding this comment.
Same root cause as the install.sh:8 comment: this manual-install curl pulls linear from the v0.13.0 git tag, which is this PR's own base commit (fd1adff4) — i.e. the pre-fix script, still containing the f-string-interpolated GraphQL filters (team_id, identifier lookups) this PR is meant to close. Until a new tag is cut from this PR's HEAD and this URL (and the install.sh one two lines below) is repointed to it, following this README instruction after merge still installs the vulnerable binary.
| @@ -63,19 +65,29 @@ def load_config() -> dict: | |||
| return json.loads(CONFIG_PATH.read_text()) | |||
There was a problem hiding this comment.
Non-blocking, but worth tracking: permission hardening only applies on write. load_config() reads CONFIG_PATH as-is (return json.loads(CONFIG_PATH.read_text())) with no chmod — so an existing user upgrading from a pre-fix install, whose ~/.linear-cli/config.json already exists with loose (e.g. default-umask 0644) permissions and a plaintext API key, stays that way until the next save_config() call (e.g. after setup/update), not immediately on upgrade.
Also, the legacy-migration branch a few lines below (write_config_file(cfg) at what is now linear:69) writes the new ~/.linear-cli/config.json with correct 0600/0700 perms, but never touches or removes the old ~/.agents/linear.json it just read from — that file keeps holding the same plaintext API key at its original (unhardened) permissions indefinitely.
Suggest a one-time perms fix-up (chmod on existing CONFIG_PATH/parent at the top of load_config) and cleaning up (or at least chmod-ing) the legacy file post-migration, so the P0 fix actually protects users who are upgrading, not just fresh installs.
|
Git-review routine — changes requested (blocking). The security fixes in this diff are genuine (GraphQL filter injection closed, config now 0700/0600), but the delivery ships the OLD vulnerable script:
To ship the fix: bump the version, cut+push a new tag on the fixed commit, recompute the installer checksum, and point README/install.sh at the new tag. Not merged. |
|
Superseded by #32 (merged). PR #32 lands the remaining RUSH-2285 / RUSH-594 security P0s on current main at 0.16.1:
This PR (#27) was conflicted and still pinned pre-fix v0.13.0 plus broader README/GraphQL scope. Closing as superseded; security half is on |
|
Closing as superseded by merged #32 (RUSH-2285). |
Summary
Key Evidence
~/.linear-cliwith0700andconfig.jsonwith0600:linear:74,linear:75,linear:78,linear:83.IssueFilterthrough variables instead of interpolated query text:linear:876,linear:886,linear:893, with callers building dict filters atlinear:1202andlinear:1347.$filtervariables:linear:705,linear:711,linear:1422,linear:1442.v0.13.0and verifies SHA-256 before moving into place:install.sh:7,install.sh:8,install.sh:27,install.sh:47.README.md:5,README.md:6,README.md:24,README.md:31.Verification
python3 -m unittest -v-> 27 tests passed.python3 -m py_compile linear test_linear.py && ./linear --version && sh -n install.sh && git diff --check->linear-cli 0.13.0, no errors.HOME=/tmp/linear-install-home-U3WcTL sh install.sh; installed/tmp/linear-install-home-U3WcTL/.local/bin/linear,linear-cli 0.13.0, SHA-256d62ee380d5565e483f0750ded837b5d453fcc380ffab14fe1d34249d2079a1c2.Linear: RUSH-594