Skip to content

chore(deps): update dependency vcrpy to v8 [security] - #1013

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/pypi-vcrpy-vulnerability
Open

chore(deps): update dependency vcrpy to v8 [security]#1013
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/pypi-vcrpy-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
vcrpy ==7.0.0==8.2.1 age confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


VCR.py: Arbitrary code execution via unsafe YAML deserialization of cassette files

GHSA-rpj2-4hq8-938g

More information

Details

Summary

vcrpy deserializes YAML cassette files with PyYAML's object-constructing loader (yaml.CLoader / yaml.Loader) instead of the safe loader (yaml.CSafeLoader / yaml.SafeLoader). A cassette containing a !!python/object/apply: (or similar) tag therefore executes arbitrary Python code the moment the cassette is loaded — including through the normal VCR().use_cassette() path, before any HTTP interaction is replayed.

This is not limited to environments lacking the libYAML C extension. CLoader uses the C parser but PyYAML's full Python constructor, so Python
object tags execute under CLoader exactly as under the pure-Python Loader. Confirmed against vcrpy 8.1.1 + PyYAML 6.0.3 with CLoader active.

Affected component
  • vcr/serializers/yamlserializer.pydeserialize()yaml.load(cassette_string, Loader=Loader) where Loader is CLoader/Loader. Reached on every cassette load.
  • vcr/migration.py (~line 107) — yaml.load(preprocess_yaml(...), Loader=Loader). A second sink reached when the migration tool is run on a .yaml file. preprocess_yaml() only strips three known legacy tags, so other tags still execute.

Present in all releases inspected, 1.0.0 through 8.1.1.

Proof of concept
import vcr, requests

##### Attacker-supplied cassette. The payload sits in an ignored top-level key

##### so the rest of the cassette stays valid; it fires during load.
open("evil.yaml", "w").write("""interactions:
- request:
    body: null
    headers: {Accept: ['*/*']}
    method: GET
    uri: http://example.com/
  response:
    body: {string: ok}
    headers: {Content-Type: ['text/plain']}
    status: {code: 200, message: OK}
_x: !!python/object/apply:os.system ['touch /tmp/VCRPY_YAML_RCE']
version: 1
""")

with vcr.use_cassette("evil.yaml"):      # <-- /tmp/VCRPY_YAML_RCE created here
    requests.get("http://example.com/")

Loading the cassette creates /tmp/VCRPY_YAML_RCE, demonstrating arbitrary command execution. Any Python callable can be invoked this way.

Impact

Arbitrary code execution in the process that loads the cassette, with that process's full privileges. Realistic delivery paths:

  • A malicious cassette added in a pull request and loaded when CI runs the tests.
  • A poisoned shared test-fixture repository or cassette artifact store.
  • "Updated recorded HTTP fixtures" social-engineering.

Because cassettes are typically loaded by test suites in CI/CD and on developer machines, the exposed secrets are exactly the high-value ones in those environments: CI deployment credentials, cloud IAM roles, registry/publishing tokens, and source access.

Patch

Use the safe loader in vcr/serializers/yamlserializer.py:

try:
    from yaml import CDumper as Dumper
    from yaml import CSafeLoader as Loader
except ImportError:
    from yaml import Dumper
    from yaml import SafeLoader as Loader

def deserialize(cassette_string):
    return yaml.load(cassette_string, Loader=Loader)

Apply the same SafeLoader change in vcr/migration.py.

This is backwards compatible: vcrpy cassettes only contain standard YAML (scalars/lists/maps plus !!binary, all supported by SafeLoader/CSafeLoader), so existing cassettes load unchanged. vcrpy's serialize.deserialize() already catches yaml.constructor.ConstructorError, so a Python-tagged cassette now surfaces as the existing "old cassette format" ValueError instead of executing.

Recommended hardening: add a regression test that loads a cassette containing !!python/object/apply:os.system and asserts a ConstructorError/ValueError and that no side effect occurs.

Severity

  • CVSS Score: 7.8 / 10 (High)
  • Vector String: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

kevin1024/vcrpy (vcrpy)

v8.2.1

Compare Source

What's Changed

  • SECURITY: Cassettes are now loaded with a safe YAML loader, preventing arbitrary code execution when a cassette from an untrusted source is loaded. Previously a crafted cassette containing a Python object tag (e.g. !!python/object/apply:os.system) would execute code on load, including via the normal vcr.use_cassette() path. Existing cassettes (including file-upload/streaming bodies) continue to load. Advisory: GHSA-rpj2-4hq8-938g — thanks @​RamiAltai and @​EQSTLab for the reports.
  • Validate record_mode and raise a clear error on an invalid value (#​208)
  • Recommend pytest-recording over the unmaintained pytest-vcr in the docs (#​986)

Full Changelog: kevin1024/vcrpy@v8.2.0...v8.2.1

v8.2.0

Compare Source

What's Changed

Full Changelog: kevin1024/vcrpy@v8.1.1...v8.2.0

v8.1.1

Compare Source

What's Changed

  • Fix sync requests in async contexts for HTTPX (#​965) - thanks @​seowalex
  • CI: bump peter-evans/create-pull-request from 7 to 8 (#​969)

v8.1.0

Compare Source

New Features

  • Enable brotli decompression if available (via brotli, brotlipy or brotlicffi) (#​620) - thanks @​immerrr

Bug Fixes

Other Changes

Full Changelog: kevin1024/vcrpy@v8.0.0...v8.1.0

v8.0.0

Compare Source

Breaking Changes

New Features

Bug Fixes

  • Rewrite httpx support to patch httpcore instead of httpx (#​943) - thanks @​seowalex
    • Fixes httpx.ResponseNotRead exceptions (#​832, #​834)
    • Fixes KeyError: 'follow_redirects' (#​945)
    • Adds support for custom httpx transports
  • Fix HTTPS proxy handling - proxy address no longer ends up in cassette URIs (#​809, #​914) - thanks @​alga
  • Fix iscoroutinefunction deprecation warning on Python 3.14 - thanks @​kloczek

Other Changes

Full Changelog: kevin1024/vcrpy@v7.0.0...v8.0.0


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • "after 9am every weekday,before 5pm every weekday"

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the dependencies Pull requests that update a dependency file label Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Run report for ece5d1fd (ubuntu-latest, Linux, 0, 2, 1)

Total time: 59.5s | Comparison time: 6m 44s | Estimated savings: 5m 44s (85.3% faster)

Action Time Status Info
🟩 SyncWorkspace 8.8ms Passed
🟩 SyncProject(devcontainer) 0.7ms Passed
🟩 SyncProject(fleet-mcp) 0.4ms Passed
🟦 RunTask(talos-image:generate-sha) 1.4s Cached
🟩 RunTask(docker:buildx_run) 2.1s Passed
🟦 RunTask(devcontainers-cli:build) 2.4s Cached
🟦 RunTask(fleet-mcp:build) 1.6s Cached
🟦 RunTask(fleet-mcp:lint) 963ms Cached
🟦 RunTask(vendir:build) 37.3s Cached
🟦 RunTask(vendir:test) 283.9ms Cached
🟦 RunTask(talos-image:generate-profile) 326ms Cached
🟦 RunTask(devcontainer:build) 621.8ms Cached
🟦 RunTask(devcontainer:test) 161ms Cached
🟩 RunTask(devenv:apply) 22.2s Passed
Environment

OS: Linux
Matrix:

os = ubuntu-latest
name = Linux
index = 0
total = 2
job_number = 1

Variables:

MOON_TOOLCHAIN_FORCE_GLOBALS = true
Touched files
libs/fleet-mcp/pyproject.toml
libs/fleet-mcp/uv.lock

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Run report for ece5d1fd (ubuntu-latest, Linux, 1, 2, 2)

Total time: 45.7s | Comparison time: 5m | Estimated savings: 4m 14s (84.8% faster)

Action Time Status Info
🟩 SyncWorkspace 9.5ms Passed
🟩 SyncProject(fleet-mcp) 0.9ms Passed
🟩 SyncProject(devcontainer) 1.3ms Passed
🟩 SyncProject(escaperoom) 0.4ms Passed
🟦 RunTask(talos-image:generate-sha) 1.4s Cached
🟩 RunTask(docker:buildx_run) 1.5s Passed
🟦 RunTask(escaperoom:test) 335.4ms Cached
🟦 RunTask(devcontainers-cli:build) 2.9s Cached
🟦 RunTask(fleet-mcp:test) 1.6s Cached
🟦 RunTask(vendir:build) 25.7s Cached
🟦 RunTask(vendir:test) 213.6ms Cached
🟦 RunTask(talos-image:generate-profile) 348.5ms Cached
🟦 RunTask(devcontainer:build) 631.2ms Cached
🟩 RunTask(devenv:apply) 20s Passed
Environment

OS: Linux
Matrix:

os = ubuntu-latest
name = Linux
index = 1
total = 2
job_number = 2

Variables:

MOON_TOOLCHAIN_FORCE_GLOBALS = true
Touched files
libs/fleet-mcp/pyproject.toml
libs/fleet-mcp/uv.lock

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Run report for ece5d1fd (macos-latest, macOS, 0, 1, 1)

Total time: 6m 34s | Comparison time: 9m 1s | Estimated savings: 2m 27s (27.2% faster)

Action Time Status Info
🟩 SyncWorkspace 29.7ms Passed
🟩 SyncProject(vendir) 1.9ms Passed
🟩 SyncProject(devenv) 1.3ms Passed
🟦 RunTask(vendir:build) 26.7s Cached
🟩 RunTask(devenv:apply) 6m 7s Passed SLOW
🟦 RunTask(devenv:test) 312.3ms Cached
Environment

OS: macOS
Matrix:

os = macos-latest
name = macOS
index = 0
total = 1
job_number = 1

Variables:

MOON_TOOLCHAIN_FORCE_GLOBALS = true
Touched files
libs/fleet-mcp/pyproject.toml
libs/fleet-mcp/uv.lock

@renovate
renovate Bot force-pushed the renovate/pypi-vcrpy-vulnerability branch from 73f0115 to f5d68d8 Compare August 26, 2026 22:19
@renovate
renovate Bot force-pushed the renovate/pypi-vcrpy-vulnerability branch from f5d68d8 to ece5d1f Compare August 27, 2026 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants