Skip to content

Migrate CLI to cleo 2 (fixes CVE-2022-42966 exposure)#1

Merged
eaguad1337 merged 3 commits into
3.xfrom
fix/cleo-2
Jun 7, 2026
Merged

Migrate CLI to cleo 2 (fixes CVE-2022-42966 exposure)#1
eaguad1337 merged 3 commits into
3.xfrom
fix/cleo-2

Conversation

@eaguad1337

Copy link
Copy Markdown
Contributor

Migrates the ORM CLI from cleo 0.8.1 to cleo 2.1, unblocking the fix for CVE-2022-42966 (ReDoS in cleo ≤ 0.8) — the last remaining pip-audit finding across the masonitedev Python repos.

Approach

Commands keep declaring their signature in the historical docstring block format. The base Command now parses that format into a cleo 2 definition (cleo.helpers.argument/option), so none of the 13 command classes changed.

  • CanOverrideConfig + CanOverrideOptionsDefault folded into the base Command: the global --config/-C option lands on every command, and per-instance default overrides (MigrateCommand(directory=...), used by the framework's InternalORMProvider) keep working
  • cleo 0.8 semantics preserved for bare optional-value options (shell -c dev -s--show is truthy)
  • Entry/CommandTester imports updated to the cleo 2 paths
  • cleo>=2.1,<3, version → 3.1.0

Validation

  • 1029 passed locally (sqlite + grammar suites; the single failing postgres test needs the CI database service and fails identically on cleo 0.8)
  • masonite-orm list and per-command --help verified manually — names, descriptions, shortcuts and defaults all parse correctly
  • Lint (flake8 with the pyproject config) clean

Required by masonitedev/masonite#9 — the framework migration lands after this is released to PyPI.

Eduardo Aguad added 3 commits June 7, 2026 00:03
cleo 0.8.1 (2020) is vulnerable to CVE-2022-42966 (ReDoS) and three
majors behind. Commands keep declaring their signature in the docstring
block format: the base Command now parses it into a cleo 2 definition
(arguments/options helpers) instead of relying on cleo 0.8's removed
docstring parsing.

- CanOverrideConfig and CanOverrideOptionsDefault are folded into the
  base Command: the global --config/-C option is added to the
  definition, and option defaults can still be overridden per instance
  (SomeCommand(directory=...))
- cleo 0.8 semantics preserved for bare optional-value options
  (--show reads as truthy)
- Entry/CommandTester imports updated to cleo 2 paths
- cleo>=2.1,<3; version bumped to 3.1.0

Full suite: 1029 passed (the one failing postgres test requires the CI
database service and fails identically on cleo 0.8).
@eaguad1337 eaguad1337 merged commit 3fc168a into 3.x Jun 7, 2026
14 checks passed
@eaguad1337 eaguad1337 deleted the fix/cleo-2 branch June 7, 2026 04:16
eaguad1337 pushed a commit to masonitedev/masonite that referenced this pull request Jun 7, 2026
cleo 0.8.1 (2020) is vulnerable to CVE-2022-42966 (ReDoS) — the fix
lives in cleo 2 — and was the last remaining pip-audit finding.

Commands keep declaring their signature in the docstring block format:
the base masonite.commands.Command now parses it into a cleo 2
definition, so none of the 40+ command classes changed.

- cleo 0.8 semantics preserved for bare optional-value options
  (craft preset --list stays truthy)
- CommandCapsule uses command.name and cleo 2's Application.add;
  swap() updates the internal registry consistently
- TestCommand accumulates fetch_output()/fetch_error() since cleo 2
  drains the buffer on fetch (multiple assertOutputContains calls)
- Kernel/Entry/test fixtures updated to cleo 2 import paths
- requires masonite-framework-orm>=3.1 (its CLI migrated in
  masonitedev/orm#1) and drops the cleo 0.8 DeprecationWarning filter

Fixes #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant