Advisory

GHSA-vxjg-hchx-cc4g

Also known as: CVE-2023-38695

Summary

@simonsmith/cypress-image-snapshothas fix for insecure snapshot file names

Details

Impact
It's possible for a user to pass a relative file path for the snapshot name and reach outside of the project directory into the machine running the test. Example:

  cy.get('h1').matchImageSnapshot('../../../ignore-relative-dirs')

The above will create an ignore-relative-dirs.png three levels up

Patches
Fixed in 8.0.2

Workarounds
Validate all the existing uses of matchImageSnapshot to ensure correct use of the filename argument. Example:

    // snapshot name will be the test title
    cy.matchImageSnapshot();

    // snapshot name will be the name passed in
    cy.matchImageSnapshot('login');

References
https://github.com/simonsmith/cypress-image-snapshot/issues/15

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2023-08-01 16:59 UTC
Modified
2026-09-10 03:49 UTC

Affected packages and fixes

@simonsmith/cypress-image-snapshot

npm · All systems

Affected

  • introduced 0, fixed 8.0.2 (semver)

Fixed versions

8.0.2

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences