r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3]

BrianH
10-Apr-2011
[7858x2]
The security issue is to not have a file that is done automatically 
be writeable using the same permissions that the scripts are run 
under. It's a way to prevent worms.
The real distinction is between serialized constructors: #[map! [a 
1]]

and programmatic constructors that you have to DO: make map! [a 1]
Ladislav
10-Apr-2011
[7860x2]
The security issue is to not have a file that is done automatically 
be writeable using the same permissions that the scripts are run 
under.

- I do not have any problem to agree with that. But, in my opinion, 
this does not require to ban files, that are done automatically. 
Rather, we should make it possible to define special rights for such 
files.
real distinction is between serialized constructors: #[map! [a 1]]...

 - in my opinion, these are not "constructors" for REBOL programmers, 
 since they cannot define them
BrianH
10-Apr-2011
[7862x2]
Not at the OS level. We can only define permissions within REBOL 
itself, not permissions when it isn't running. And REBOL doesn't 
have any facility for user-specific permissions.
Ladislav, REBOL programmers can't define constructors, but they are 
still constructors. We can't define MAKE behavior either (until we 
get user-defined types).
Ladislav
10-Apr-2011
[7864]
as said, for me the formulation: "...a file that is done automatically 
be writeable using the same permissions that the scripts are run 
under..." is substantial, and it can be done, as far as I know.
BrianH
10-Apr-2011
[7865]
Technically, the #[map! []] syntax is not a constructor itself, it 
merely calls a constructor :)
Andreas
10-Apr-2011
[7866]
The security issue is to not have a file that is done automatically 
be writeable using the same permissions that the scripts are run 
under.

sorry, i don't get that. could you try reformulate the problem?
Ladislav
10-Apr-2011
[7867x2]
REBOL programmers can't define constructors, but they are still constructors
 - technically not, since they are not definable
The definability is a property that is used to explain what a constructor 
is.
BrianH
10-Apr-2011
[7869]
Being defineable doesn't make it a constructor. Constructing something 
does.
Ladislav
10-Apr-2011
[7870x2]
OK, my opinion:


The user does neither "see" nor is able to define any constructors. 
What you are referring to are some syntactic constructs, that are 
not constructors at all.
The difference between #[map! [...]] and a constructor is roughly 
the same as the difference between a constructor, and a list of arguments 
given to the constructor, when a constructor is called - it is a 
totally different thing.
BrianH
10-Apr-2011
[7872]
I am talking about the code that is called when those syntactic constructs 
are loaded, which is type-specific and constructs a value of that 
type. REBOL types have 3 builtin constructors (#[type ...], MAKE 
and TO). The user can't create new constructors because the user 
can't create new types.
Ladislav
10-Apr-2011
[7873]
For me, it is just a mess, the "serialized constructors" don't exist 
at all.
BrianH
10-Apr-2011
[7874]
And #1857 indicates that the #[type ...] constructors are seperate 
code from TRANSCODE, and called by it.
Ladislav
10-Apr-2011
[7875]
...and it surely does not make sense to call #[map! [...]] a "serialized 
constructor" - it is just a syntactic "construct" used as data by 
something.
BrianH
10-Apr-2011
[7876]
Quoting myself from above: "Technically, the #[map! []] syntax is 
not a constructor itself, it merely calls a constructor :)"
Ladislav
10-Apr-2011
[7877x2]
It clearly does not correspond to the definition of the "constructor"
That is why I am not a fan of using such a terminological mess
BrianH
10-Apr-2011
[7879x2]
But using them counts (indirectly) as using constructors.
I agree that it is a terminological mess, which is why I was careful 
with my phrasing.
Ladislav
10-Apr-2011
[7881]
I do not know whether I should repeat my opinion or not, but, here 
goes:

#[map! [...]]


and similar syntaxes are not "constructors" in the standard sense 
of the word. That is why I do not like seeing such phrases in documentation 
or elsewhere.
BrianH
10-Apr-2011
[7882x2]
I agree that it is a terminological mess
Andreas, in the OSes with which I am familiar, you can't set a file 
to read-only and then count on that file staying read-only unless 
the user is asked for permission to change that setting. In REBOL 
you can. The security of a DOable %user.r depends on it not being 
writeable between when REBOL shuts down and when it starts up again. 
So that means using OS permissions to guard it, and those are based 
on user capabilities, not enough protection. The situation is different 
with %rebol.r since we only load it from the same location as the 
R3 executable, and that location can be protected with user permissions; 
this is why we can still DO %rebol.r in R3.
Andreas
10-Apr-2011
[7884]
The security of a DOable %user.r depends on it not being writeable 
between when REBOL shuts down and when it starts up again.

Why?
Ladislav
10-Apr-2011
[7885]
I do not agree with "The security of a DOable %user.r depends on 
it not being writeable between when REBOL shuts down and when it 
starts up again."
BrianH
10-Apr-2011
[7886]
Because you can have a worm spread using a combination of REBOL and 
code that is not written in REBOL but writes %user.r to do its propagation.
Ladislav
10-Apr-2011
[7887]
you can have a worm spread using a combination of REBOL and code 
that is not written in REBOL but writes %user.r to do its propagation

- yes, you can, but when you run a worm like that, then you are insecure 
anyway, since the worm could overwrite even your rebol.exe file.
Andreas
10-Apr-2011
[7888]
Sure, and such a worm could spread much more easily by writing my 
.bashrc to do the propagation.
BrianH
10-Apr-2011
[7889x2]
And I don't really trust .bashrc for that reason, though there might 
be some OS protection for that file of which I'm not aware.
Ladislav, you can put the rebol.exe file in a place that only admins 
can write to; %rebol.r too. You can't do the same with %user.r.
Andreas
10-Apr-2011
[7891]
Depends on where you put %user.r and your OS capabilities, I guess.
BrianH
10-Apr-2011
[7892]
Until %user.r is validated, you can't trust it. We can compare against 
checksums for other scripts, but there's no safe place to store a 
checksum for %user.r where it can be updated by the user script, 
because we don't have a "trusted code" concept in R3.
Andreas
10-Apr-2011
[7893x3]
Just store %user.r read-only and owned by an admin group and be done 
with it.
(And still assuming you have eliminated all other similar security 
leaks from your regular OS usage.)
But thanks for the reformulated explanation. I now understand your 
concerns.
BrianH
10-Apr-2011
[7896x2]
Andreas, by %user.r, I mean a file that would be loaded from the 
user's home directory or some subdirectory of it (.rebol, %appdata%\REBOL, 
whatever), and which could be manually writeable by the user when 
REBOL isn't running (or else its syntax wouldn't need to be human-readable 
and writeable). If you decide to skip any of those constraints, you 
can secure it despite the limited security models of most the OSes 
we support.
Those are the standard constraints of a preferences file, but there 
are some programs that make exceptions.
Andreas
10-Apr-2011
[7898]
Agreed on all points. But if you don't make the file writable without 
having to elevate your permissions first, does that not solve your 
immediate security concern?
BrianH
10-Apr-2011
[7899x2]
Not all platforms supported by R3 have permissions elevation. We 
support Windows all the way back to 2000, and permissions elevation 
wasn't introduced until Vista. Plus, that wouldn't work for multiuser 
systems where the user doesn't have the admin password (possible 
because they're the target market of these restrictions).
Must run now, I'm late already :(
Andreas
10-Apr-2011
[7901x3]
So that's a "yes, that would solve the security issue", I gather.
With a "but (some) OSes can't do this" constraint.
See you later.
BrianH
10-Apr-2011
[7904]
With a "some OSes won't allow users to edit or save their own preferences, 
so preferences are half broken on those OSes" constraint, that would 
solve the issue.
Ladislav
10-Apr-2011
[7905x2]
I am still having issues with what is considered "secure" here. As 
far as REBOL goes, for me, it is not unsecure, if it relies on the 
user environment being secure. (How can any program be secure, if 
it runs in an insecure environment?) Thus, the only concern I do 
have as far as REBOL goes is my wish for the REBOL interpreter to 
not overwrite the %user.r file unless specifically allowed to do 
that.
Any additional security is just an illusion for me.
Gregg
10-Apr-2011
[7907]
I agree.