Skip to content

describe understates the mutation scope of screenshot add and convert #49

Description

@altaywtf

describe declares:

  • commands.screenshot.add.mutates: .vref/manifest.json, .vref/screenshots/*.webp
  • commands.convert.mutates: .vref/manifest.json, .vref/screenshots/*

Both understate what the commands can touch. An entry's file is any safe manifest-relative path — safeManifestAssetPath rejects traversal, absolute paths, schemes and control characters, but requires no screenshots/ prefix — and the manifest directory itself is whatever --manifest points at.

Reproduced against 2.0.0:

vref screenshot add ./src.png --json '{"id":"logo",...,"file":"assets/logo.webp"}'
# -> writes .vref/assets/logo.webp, outside the declared scope

convert has the same property: it re-encodes to a sibling path of whatever the entry references, so a assets/logo.png entry produces assets/logo.webp.

Automation reading mutates to decide what a command may touch can therefore miss files these commands write or delete. #48 fixed the same defect for screenshot remove by declaring .vref/**; these two were left alone because they predate that PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions