[squeak-dev] Securing access to the .changes file

tim Rowledge tim at rowledge.org
Tue Apr 18 18:26:46 UTC 2017


> On 18-04-2017, at 9:02 AM, Hari <hari.balaraman at icloud.com> wrote:
> 
> Hi Vaidotas,
> My app downloads code updates from the server and files them in. Will this
> be possible with your suggestion?

This is a bit of a problem, or at least it was last time I checked. I was going to include a mechanism to allow updating Scratch, which obviously would involve installing code. With no changes file we run across an issue where the trailer bytes of the method want to know the file position of the changes file… which we have not got.

I’m pretty sure this used to work once upon a time but given how long we’ve been doing this stuff that could be a very long time ago. Right now what happens is that the Browser>defineMessageFrom:notifying: code leads us to Behavior>defaultMethodTrailerIfLogSource: which *would* handle the problem of a missing changes (or source) file if only the value of ‘logSource’ were appropriate. Ambling back up the stack a bit to ClassDescription>compile:classified:withStamp:notifying: shows us that a plausible culprit is #acceptsLoggingOfCompilation. This simply returns ‘true’ in most implementations, whereas I think it should probably be looking a bit more deeply.

One option might be to add a new method to the SourceFileArray classes to check if there is a [changes,source] file connected. Another might be to add a new subclass that simply knows there is no writeable file - which obviously would require a bit more deployment setup but might work out cleaner.

As a minimal fix I think we could solve this by
a) add #hasWriteableChanges to SourceFileArray, default returning false.
b) add ditto to each of the current subclasses, returning whether the file at 2 is not nil
c) extend at least ClassDescription>acceptsLoggingOfCompiliation to ^SourceFiles hasWriteableChanges, with the other implementors of #acceptsLoggingOfCompiliation being a bit less obvious to me.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
The generation of random numbers is too important to be left to chance.




More information about the Squeak-dev mailing list