fix(scan): scope --reach-ecosystems to reachability-supported ecosystems#1420
Merged
Conversation
The --reach-ecosystems flag validated values against the full purl-type list (ALL_ECOSYSTEMS), so ecosystems the reachability engine cannot analyze (e.g. conda) passed CLI validation and only failed partway through the scan with an opaque engine-level error. Validate against the set Coana's --purl-types gate accepts (cargo, composer, gem, golang, maven, npm, nuget, pypi) via a shared parseReachEcosystems() helper shared by scan create and scan reach, so invalid values now fail fast at the CLI with a clear message. The supported set is also surfaced in --help and generated from a single constant to avoid drift.
Martin Torp (mtorp)
force-pushed
the
martin/reach-ecosystems-bug
branch
from
July 23, 2026 09:48
894a447 to
8578ffc
Compare
Martin Torp (mtorp)
marked this pull request as ready for review
July 23, 2026 09:49
Martin Torp (mtorp)
enabled auto-merge (squash)
July 23, 2026 09:49
Simon (simonhj)
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
socket scan create --reach --reach-ecosystems <values>(andsocket scan reach) validated the--reach-ecosystemsvalues against the full purl-type list (ALL_ECOSYSTEMS, 32 entries), which is far broader than what the Coana reachability engine accepts. As a result, ecosystems the engine cannot analyze — e.g.conda— passed CLI validation and only failed partway through the scan with an opaque engine-level error:The CLI's validation list and the engine's accepted list disagreed, so bad input surfaced late and confusingly instead of failing fast at the CLI.
Fix
Scope
--reach-ecosystemsvalidation to the set the Coana engine's--purl-typesgate actually accepts, and share it between both commands:REACHABILITY_SUPPORTED_ECOSYSTEMSconstant +getReachabilityEcosystemChoices()insrc/utils/ecosystem.mts:cargo, composer, gem, golang, maven, npm, nuget, pypi.parseReachEcosystems()validator (throwsInputError) replaces the two duplicated inline validation loops incmd-scan-create.mtsandcmd-scan-reach.mts.ALL_ECOSYSTEMS/getEcosystemChoicesForMeow()are left untouched — thefixcommand still validates its--ecosystemsagainst the full purl-type list.--reach-ecosystemshelp text now lists the supported ecosystems, generated from the constant so it cannot drift.Why this set
The set was verified against the bundled
@coana-tech/cli15.8.8 source. Its--purl-typesvalidation gate (getAdvisoryEcosystemFromPurlType) accepts exactly these 8 purl types, and each one maps to a dedicated reachability analyzer that ships in the engine:So all 8 are genuinely reachability-supported: validating against them means the CLI accepts everything the engine can analyze and fails fast on everything else.
Release
This PR bumps the patch version
1.1.143 → 1.1.144and adds the dated1.1.144CHANGELOG entry, so merging it stages a new patch release. The actual npm publish is the manualPublish to npm registryworkflow (.github/workflows/provenance.yml,workflow_dispatch), which publishes thepackage.jsonversion at HEAD and tagsv1.1.144.Testing
pnpm check(lint + tsc) passes.cmd-scan-create.test.mtsandcmd-scan-reach.test.mtspass, including a new regression test asserting a valid-but-unsupported purl type (conda) is rejected.--reach-ecosystems maven,pypi,condanow errors immediately at the CLI;maven,pypiandcargo,gempass validation.Out of scope / follow-ups
npm, maven, pypi, golang, composer, nuget) and omitscargo/gem, even though the engine ships Rust and Ruby reachability analyzers and its--purl-typesgate accepts them. That misleading message is a Coana-engine issue, tracked separately under REA.mainline (monorepopackages/cli/src/...layout) has the identical CLI bug and needs a parallel port.Note
Low Risk
CLI input validation only; narrows accepted values and fails fast with clearer errors, with no changes to scan execution or auth paths beyond earlier rejection of bad flags.
Overview
--reach-ecosystemsonsocket scan create(with--reach) andsocket scan reachno longer validates against the full purl-type list. It now checks only the eight ecosystems the Coana reachability engine accepts (cargo,composer,gem,golang,maven,npm,nuget,pypi), so values likecondafail immediately with a clear error instead of dying mid-scan.Shared
REACHABILITY_SUPPORTED_ECOSYSTEMS,parseReachEcosystems(), and help text driven bygetReachabilityEcosystemChoices()replace duplicated inline loops in both scan commands.socket fix --ecosystemsstill uses the fullALL_ECOSYSTEMSlist.Patch release 1.1.144 with a CHANGELOG entry; regression test covers rejecting
condaonscan reach.Reviewed by Cursor Bugbot for commit 8578ffc. Configure here.