Skip to content

fix(builtins): block unset of internal variables and readonly marker bypass#1013

Merged
chaliy merged 1 commit intomainfrom
fix/issue-1006-unset-readonly-bypass
Apr 2, 2026
Merged

fix(builtins): block unset of internal variables and readonly marker bypass#1013
chaliy merged 1 commit intomainfrom
fix/issue-1006-unset-readonly-bypass

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 2, 2026

Summary

  • Block unset _READONLY_* and other internal marker variables via is_internal_variable() check
  • Defense-in-depth: checks in both interpreter's execute_unset_builtin and Unset builtin struct

What & Why

unset _READONLY_FOO could directly remove the readonly marker, making FOO mutable again. This defeats readonly protection, which may be security-critical. Now the interpreter's unset handler checks is_internal_variable() before removing any variable, blocking manipulation of all internal markers.

Tests Added

  • unset_readonly_marker_blocked — verifies unset _READONLY_X doesn't defeat readonly
  • unset_normal_variable_works — verifies normal unset still works

Closes #1006

…bypass

Closes #1006 — unset could remove _READONLY_* marker variables directly,
defeating readonly protection. Now checks is_internal_variable() in the
interpreter's execute_unset_builtin to block removal of all internal
markers. Also adds defense-in-depth checks in the Unset builtin struct.
@chaliy chaliy merged commit d99f228 into main Apr 2, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-1006-unset-readonly-bypass branch April 2, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Readonly variable protection bypassed by directly unsetting _READONLY_* marker

1 participant