Skip to content

sensing_of property reporter does not validate literal object or property names #342

Description

@aspizu

Repro

tmp=$(mktemp -d /tmp/goboscript-property.XXXXXX)
printf 'costumes "blank.svg";\n' > "$tmp/stage.gs"
printf 'costumes "blank.svg";\nonflag { say "Stage"."not a property"; say "missing"."x position"; }\n' > "$tmp/main.gs"
touch "$tmp/blank.svg"
cargo run --quiet -- build "$tmp"
python3 - <<'PY' "$tmp/$(basename "$tmp").sb3"
import json, sys, zipfile
with zipfile.ZipFile(sys.argv[1]) as z:
    project = json.loads(z.read('project.json'))
for target in project['targets']:
    if not target['isStage']:
        for block in target['blocks'].values():
            print(block)
PY

Actual

Build exits 0 and emits invalid-looking sensing_of menus without validation:

{'opcode': 'sensing_of', ..., 'fields': {'PROPERTY': ['not a property', None]}}
{'opcode': 'sensing_of_object_menu', ..., 'fields': {'OBJECT': ['missing', None]}}

Expected

Literal sensing_of property names should be validated against Scratch's allowed property list, and literal object names should be validated against _stage_ or known sprite names.

Notes

This is the reporter equivalent of the literal menu validation gaps for key/backdrop/sound/sprite-target blocks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions