Skip to content

fix(deps): override vulnerable ansi-regex - #38

Merged
AlexStocks merged 5 commits into
mainfrom
codex/issue-10-x-image
Aug 29, 2026
Merged

fix(deps): override vulnerable ansi-regex#38
AlexStocks merged 5 commits into
mainfrom
codex/issue-10-x-image

Conversation

@AlexStocks

@AlexStocks AlexStocks commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a package-root pnpm override that resolves every current ansi-regex
    request in the OpenClaw memory plugin to the patched 5.0.1 release
  • regenerate the lockfile with pnpm 10.34.5, remove ansi-regex@5.0.0, and
    preserve the Apache-2.0 header
  • record reusable dependency-remediation and native-test synchronization rules
    in AGENTS.md
  • replace the SeekDB cancellation fixture's timing-dependent native sleep with
    an explicit entry/release barrier after exact-head linux-arm64 CI exposed the
    sleep race; production SeekDB behavior is unchanged

Closes #11.

Security rationale

The vulnerable runtime path was:

openclaw -> qrcode -> yargs -> cliui@6.0.0 -> strip-ansi@6.0.0 -> ansi-regex@5.0.0

GitHub Advisory GHSA-93q8-gq69-wqmw / CVE-2021-3807 marks
ansi-regex >=5.0.0,<5.0.1 as vulnerable and 5.0.1 as the first patched
5.x release. The root manifest override is compatible with the current graph
and avoids upgrading OpenClaw or unrelated transitive dependencies.

CI follow-up

The first refreshed exact-head run failed only in
Full build tags (linux-arm64). The failure came from
TestOpenClosesNativeInstanceWhenCancellationRepeatsDuringHandshake: its C
fixture wrote an entry marker and then called nanosleep once, assuming the
call would last 100 ms. POSIX permits nanosleep to return early when a signal
interrupts it, so the native call could finish before the Go test issued
cancellation.

The fixture now blocks on an explicit release marker. The Go side observes
entry, cancels the context, and then releases the native call. This preserves
the same public Open error and native-close assertions without relying on
scheduler timing or a longer timeout.

Behavior and compatibility

  • no application API, protocol, persistence, generated contract, or host
    version change
  • no production SeekDB implementation change
  • the OpenClaw plugin keeps its existing dependency ranges and resolves the
    vulnerable transitive edge to ansi-regex@5.0.1

Validation

Security and package checks:

  • current main: pnpm audit --json reports one HIGH advisory on
    ansi-regex@5.0.0
  • final candidate: pnpm 10.34.5 frozen install succeeds, pnpm why ansi-regex
    reports only 5.0.1, and pnpm audit --json reports zero vulnerabilities
  • Node 24.15.0: typecheck, 16/16 Vitest tests, and build pass with no generated
    dist difference
  • license-eye: 959 files checked, 0 invalid

SeekDB cancellation checks:

  • WSL Go 1.27 targeted test: 200 repeated runs pass
  • race-enabled targeted test: 50 repeated runs pass
  • full internal/sqlstore/seekdb package passes
  • a disposable mutant with both post-native cancellation checks removed fails
    with open error = <nil>, want context cancellation

GitHub exact-head evidence for b34d189bb8de8fa9cd7465e3ed66c8c39403c0f9:

  • 4/4 workflow runs completed successfully: Main, E2E harness, CodeQL, and
    License Check
  • 27/27 check runs completed successfully, including linux-arm64 Full build
    tags, race/fuzz/module integrity, both acceptance backends, coverage, and
    all Linux/macOS standard/full matrices
  • PR merge state is CLEAN and MERGEABLE; the GitHub merge-ref tree matches
    the reviewed Head tree

AI usage

Implemented and reviewed with Codex assistance. The advisory range, dependency
graph, Base/Head audit result, POSIX interruption behavior, deterministic test
mutation, final diff, comments, merge ref, and exact-head CI were verified
against current sources and reproducible commands.

AlexStocks and others added 5 commits August 28, 2026 18:45
Preserve current main's Modern Go, CI, security, and learned-rule updates while retaining the ansi-regex override and dependency-vulnerability prevention rule.

Constraint: Keep the PR-specific diff relative to main limited to AGENTS.md and the two OpenClaw dependency files.

Rejected: Rebase or force-push the shared PR branch.

Confidence: The staged tree differs from origin/main in exactly three intended files and has no unmerged entries or diff-check errors.

Scope-risk: The merge carries current main unchanged; conflict resolution appends one learned prevention rule.

Tested: git diff --cached --check; exact three-file diff versus origin/main; merge-candidate frozen install, audit, typecheck, 16 tests under Node 24.15.0, build, and license check.

Not-tested: Exact-head GitHub CI will run after push.

Co-authored-by: OmX <omx@oh-my-codex.dev>
Replace the fixture's fixed native sleep with an explicit entry-and-release barrier so cancellation is guaranteed to happen before the synchronous open call returns.

Constraint: Preserve the production SeekDB cancellation and cleanup behavior; change only the native test fixture and its learned prevention rule.

Rejected: Retrying nanosleep after EINTR or increasing the delay because both remain timing-dependent and architecture-sensitive.

Confidence: The exact linux-arm64 CI failure is explained by POSIX nanosleep interruption, while the barrier preserves the same public error and native-close assertions.

Scope-risk: Test-only synchronization plus one AGENTS.md rule; no runtime code or dependency graph changes.

Tested: WSL Go 1.27 targeted count 200; race targeted count 50; full seekdb package; license-eye 959 files with zero invalid; git diff checks.

Not-tested: linux-arm64 exact-head CI will verify the affected architecture after push.

Co-authored-by: OmX <omx@oh-my-codex.dev>
Derive the per-attempt cancellable context from t.Context so fatal paths remain bound to the test lifecycle before cleanup releases the native barrier.

Constraint: Keep the explicit per-attempt cancel behavior and production Close call unchanged.

Rejected: A background parent because it leaves an in-flight native call detached from test termination.

Confidence: This follows the repository-resolved Go 1.27 testing_t_context guideline and preserves the same cancellation assertion.

Scope-risk: One test-only context parent change.

Tested: WSL targeted count 50; race targeted count 10; git diff check.

Not-tested: Exact-head linux-arm64 CI will run after push.

Co-authored-by: OmX <omx@oh-my-codex.dev>
@AlexStocks
AlexStocks merged commit fb0a573 into main Aug 29, 2026
27 checks passed
@AlexStocks
AlexStocks deleted the codex/issue-10-x-image branch August 29, 2026 06:47
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.

Possible fix(deps): ansi-regex 5.0.0 → 6.0.1, 5.0.1, 4.1.1, 3.0.1 (CVE-2021-3807) in pnpm-lock.yaml

1 participant