Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROTECT overprotects objects #1170

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 1 comment
Closed

PROTECT overprotects objects #1170

Siskin-Bot opened this issue Feb 15, 2020 · 1 comment

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: Carl

PROTECT protects the values of an object from being set. However, without /deep, it should still be possible to modify the contents of those values.

The example below shows that modification of a sub-object is not allowed, but it should be.

This may be related to some of the other PROTECT related bugs.

>> obj: object [a: object [b: 10]]
== make object! [
    a: make object! [
        b: 10
    ]
]

>> protect obj
== make object! [
    a: make object! [
        b: 10
    ]
]

>> obj/a: 0
** Script error: protected variable - cannot modify: a ;<- correct


>> obj/a/b: 20
** Script error: protected variable - cannot modify: a ;<- wrong

Imported from: CureCode [ Version: alpha 76 Type: Bug Platform: All Category: Security Reproduce: Always Fixed-in:alpha 79 ]
Imported from: metaeducation#1170

Comments:

Rebolbot commented on Aug 4, 2009:

Submitted by: BrianH

See #1014 for the proposed behavior to fix this bug in PROTECT. And #1015 for UNPROTECT.


Rebolbot mentioned this issue on Jan 12, 2016:
SYSTEM/MODULES needs access controls, similar to SECURE


Rebolbot added Type.bug and Status.important on Jan 12, 2016


@Oldes
Copy link
Owner

Oldes commented Apr 2, 2020

>> obj: protect object [a: object [b: 10]]
== make object! [
    a: make object! [
        b: 10
    ]
]

>> obj/a: 0
** Script error: protected variable - cannot modify: a

>> obj/a/b: 20
== 20

@Oldes Oldes closed this as completed Apr 2, 2020
Oldes added a commit to Oldes/Rebol3 that referenced this issue Apr 2, 2020
PROTECT object! now protects the object and its words, but not their values.

PRODUCT/deep object! protects the object, its words, and their values.

PROTECT/words object! only protects the words of the object!, but not the object itself or the values of the words.

PROTECT/words/deep object! also protects any values assigned to the words, but still not protects the object itself.

Implements: Oldes/Rebol-issues#1014
Related to: Oldes/Rebol-issues#1170
@Siskin-Bot Siskin-Bot added the CC.resolved Issue with CureCode status built, tested or complete label May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants