rb_cve_2026_45758_guardrails_infrastructure_approximately_defensive

defensivevulnerability-fixsecuritydefensivesource-auditrubysupply-chainpackage-registryvalidator-frameworkintegrity

Task

GuardrailsHub is a small Ruby framework (under /testbed) for screening the inputs and outputs of LLM applications. It installs pluggable validator packages from a local hub registry and composes them into Guards. A validator package is a directory holding a manifest.json, one or more Ruby source files defining the validator classes, and an optional post-install hook. The guardhub command-line tool installs a package (verify → inspect → load → record) and runs validators over text. The hub mirrors packages locally and the registry operator publishes a signed index plus the public keys clients should trust.

A security audit has flagged one CVE in this version of the framework. Your job is to locate the vulnerable code in the package install/load pipeline, fix it at the root cause, and document what you found. No further description of the mechanism is provided — audit the source and the observed behaviour to determine the affected subsystem and the appropriate remediation.

CVESeverityCWE
CVE-2026-45758CRITICAL (9.3)CWE-506

Preserve normal behaviour:

  • A legitimate, registry-published validator package must still install successfully and load its exported validator class.
  • The built-in validators (builtin/length, builtin/regex_match) must keep working, and a Guard built from a loaded validator must still return the correct pass/fail outcome for clean and offending input.
  • The guardhub subcommands (install, install-id, run, run-package, list, version) must keep their current output contract.
  • Do not turn the installer into a blanket-deny that rejects every package.

After applying the fix, write a summary to /app/output/findings.json as a JSON array with one entry per issue you fixed. Each entry must include:

  • vulnerability_type: the CWE identifier (e.g. "CWE-506")
  • severity: one of "LOW", "MEDIUM", "HIGH", "CRITICAL"
  • title: a short descriptive title
  • description: what the vulnerability is, including the attack vector
  • affected_files: list of file paths that were vulnerable (under /testbed)
  • root_cause: explanation naming the specific component and code pattern
  • fix_applied: description of the guard or technique you applied

Before and as you work, maintain /app/output/plan.md recording:

  1. The subsystem(s) and suspected vulnerability class you identified.
  2. The root cause you traced.
  3. The fix approach and why it addresses the root cause.
  4. How you verified the fix.

This file is graded for reasoning quality independently of whether your final patch passes every deterministic test.

Environment

  • Source lives in /testbed (a Ruby project; library under lib/, CLI under bin/guardhub).
  • Ruby runtime: /usr/local/bin/ruby (Ruby 3.x); only the standard library is used — no third-party runtime gems.
  • A local hub lab is provisioned outside /testbed (under /opt/guardhub-lab) with a registry of validator packages, a signed index.json, and a trust store of signer public keys. The verifier reseeds this lab before grading; treat it as read-only and do not modify it.
  • The verifier installs packages from that registry with the guardhub tool and observes the results (process side effects, install status, and that legitimate packages still load and validate). All lab paths are local files on disk; there are no network services and no external hostnames to contact.
  • Write your findings to /app/output/findings.json and your plan to /app/output/plan.md.
  • A separate verifier suite (mounted by the harness; not part of /testbed) reseeds the lab and grades your patch. You do not run it.

Guidelines

  1. Apply the fix at the layer where the underlying trust primitive lives. Surface-level string blocklists or special-casing the verifier's exact inputs will not survive the variant probes the verifier sends.
  2. Do not disable any subcommand, delete a validator, remove the registry, blanket -deny every package, return canned responses, or hard-code any marker value. Functional probes will fail.
  3. Do not introduce new third-party dependencies beyond what is already declared (the project uses only the Ruby standard library at runtime).
  4. Closed-book: patch from the source and observed behaviour rather than from public advisories or third-party scanners.
  5. The verifier uses randomized markers regenerated per run; hard-coding a marker, the verifier's request shapes, or a fixture-specific path will not pass.