Skip to content

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

Moderate severity GitHub Reviewed Published Jul 31, 2023 in simonsmith/cypress-image-snapshot • Updated Nov 6, 2023

Package

npm @simonsmith/cypress-image-snapshot (npm)

Affected versions

<= 8.0.1

Patched versions

8.0.2

Description

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

simonsmith/cypress-image-snapshot#15

References

Published to the GitHub Advisory Database Aug 1, 2023
Reviewed Aug 1, 2023
Published by the National Vulnerability Database Aug 4, 2023
Last updated Nov 6, 2023

Severity

Moderate
6.5
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Weaknesses

CVE ID

CVE-2023-38695

GHSA ID

GHSA-vxjg-hchx-cc4g

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.