Discuss Scratch

gtoal
Scratcher
1000+ posts

Making data inaccessible... can it be done?

I want to see if it is possible to put data in cloud vars in a way that someone running the program cannot read the contents of the cloud variables, even if they go into the project viewer. I've made a rough draft but it's not robust… https://scratch.mit.edu/projects/60007512/ I've already found at least one way I can get at the data, although I've minimized the window of opportunity to some extent.

Can anyone see any ways to make the idea more robust? Feel free to remix my prototype and let us see if we can break it.

This only has to be good enough to stop ordinary users from accessing private data. Fetching the data via the api or the cloud logs is an advanced skill and I'm not bothered about the people who can do that. This is only to stop things like gamers looking at the solutions to puzzle problems in an adventure game or a crossword puzzle - a relatively low level of secrecy…

If anyone has a really robust way to detect that the project viewer (editor) is open, that would help this a lot!

G
Superdoggy
Scratcher
1000+ posts

Making data inaccessible... can it be done?

Continuously poll a cloud variable per-user, change it every frame. If it doesn't change, user is inside the editor. Encrypt all data with a key, and throw away the key when the user sees inside. This works for all Scratchers.

Meanwhile, for New Scratchers, there will be the immediate problem of the cloud data behaving like normal variables. So as a fallback for new Scratchers, make a large rectangle that extends from the right side of the project player and covers just enough area that anybody in fullscreen with their mouse to the right of the player (or at mousex = 240) will always overlap it. If the mouse pointer is not touching the rectangle and the mousex reporter = 240 at any time, the user is inside the editor.

Last edited by Superdoggy (May 2, 2015 00:07:28)









































gtoal
Scratcher
1000+ posts

Making data inaccessible... can it be done?

Superdoggy wrote:

Continuously poll a cloud variable per-user, change it every frame. If it doesn't change, user is inside the editor.

doesn't that rely on there being 2 or more users running the code at all times?

Superdoggy wrote:

Encrypt all data with a key, and throw away the key when the user sees inside. This works for all Scratchers.

But if I throw away the key from the cloud, no-one else will ever be able to run the code…

Superdoggy wrote:

Meanwhile, for New Scratchers, there will be the immediate problem of the cloud data behaving like normal variables. So as a fallback for new Scratchers, make a large rectangle that extends from the right side of the project player and covers just enough area that anybody in fullscreen with their mouse to the right of the player (or at mousex = 240) will always overlap it. If the mouse pointer is not touching the rectangle and the mousex reporter = 240 at any time, the user is inside the editor.

that sounds like a hack worth trying… I've been looking for a reliable way to detect the mouse being in the editor. I experimented with ‘distance to mouse’ at one point but it was a dead-end…

Thanks for the suggestions.
gtoal
Scratcher
1000+ posts

Making data inaccessible... can it be done?

gtoal wrote:

Superdoggy wrote:

Meanwhile, for New Scratchers, there will be the immediate problem of the cloud data behaving like normal variables. So as a fallback for new Scratchers, make a large rectangle that extends from the right side of the project player and covers just enough area that anybody in fullscreen with their mouse to the right of the player (or at mousex = 240) will always overlap it. If the mouse pointer is not touching the rectangle and the mousex reporter = 240 at any time, the user is inside the editor.

that sounds like a hack worth trying… I've been looking for a reliable way to detect the mouse being in the editor. I experimented with ‘distance to mouse’ at one point but it was a dead-end…

OK, I see what this is doing! The <touching mouse> test actually extends past the arena. Nice hack. Not 100% sure how best to take advantage of it, but it's a good hint in the right direction! Thanks…
MegaApuTurkUltra
Scratcher
1000+ posts

Making data inaccessible... can it be done?

gtoal wrote:

gtoal wrote:

Superdoggy wrote:

Meanwhile, for New Scratchers, there will be the immediate problem of the cloud data behaving like normal variables. So as a fallback for new Scratchers, make a large rectangle that extends from the right side of the project player and covers just enough area that anybody in fullscreen with their mouse to the right of the player (or at mousex = 240) will always overlap it. If the mouse pointer is not touching the rectangle and the mousex reporter = 240 at any time, the user is inside the editor.

that sounds like a hack worth trying… I've been looking for a reliable way to detect the mouse being in the editor. I experimented with ‘distance to mouse’ at one point but it was a dead-end…

OK, I see what this is doing! The <touching mouse> test actually extends past the arena. Nice hack. Not 100% sure how best to take advantage of it, but it's a good hint in the right direction! Thanks…
Whoa. If you can get a size-hacked sprite off screen in the direction of the code area, and <touching mouse> works, that could be big…

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
FalconGunner99
Scratcher
1000+ posts

Making data inaccessible... can it be done?

Couldn't it all be circumvented by remixing and removing the protections? If players are gonna cheat, they'll cheat. It seems that the best way to go is with simple obfuscation, to discourage cheating, but for the most part, I personally feel it's better to use light prevention, but let the players do what they want.

I still find the art of obfuscation interesting tho, so I'll go ahead and lurk the thread…


; Oh this? This is just my semicolon. I got it a long time ago, it's quite innocuous. Don't worry about it.

















You —> http://i.imgur.com/iVHfwLc.gifv




















gtoal
Scratcher
1000+ posts

Making data inaccessible... can it be done?

FalconGunner99 wrote:

Couldn't it all be circumvented by remixing and removing the protections? If players are gonna cheat, they'll cheat. It seems that the best way to go is with simple obfuscation, to discourage cheating, but for the most part, I personally feel it's better to use light prevention, but let the players do what they want.

I don't have any delusions that something like this will stand up to an intelligent hacker, I just don't want it to be so easy that everyone can circumvent it in seconds. However the original idea relied on the fact that remixing a cloud-based project makes it a different project and therefore it no longer has access to the cloud variables belonging to that project.

I mistakenly also thought this was the case if you made any changes to the source at all, but it turns out that what happens is you can still read the cloud data, you just can't write to it. So what started out as a simple way to make data secure has turned into something far more complex and to be honest, probably not worth the effort. But at least MATU got a new toy out of the deal :-)

G

Last edited by gtoal (May 3, 2015 09:28:17)

NickyNouse
Scratcher
1000+ posts

Making data inaccessible... can it be done?

Hmmm… you could make sure the cloud variable is only the correct value long enough for the user to retrieve it. You constantly run the project from a server like so:
when gf clicked
set [☁ var v] to [scrambled]
set [local-key v] to []
if <(username) = [gtoal]> then
ask [key?] and wait
set [local-key v] to (answer)
forever
wait until <(☁ var) = [request]>
set [☁ var v] to (local-key)
end
else
set [☁ var v] to [request]
wait until <not<(☁ var) = [request]>>
set [local-key v] to (☁ var)
set [☁ var v] to [scrambled]
code using (local-key) ::grey
end
(I've always wanted to write something like that but never had the resources or a good excuse)

Last edited by NickyNouse (May 3, 2015 10:01:28)

gtoal
Scratcher
1000+ posts

Making data inaccessible... can it be done?

NickyNouse wrote:

Hmmm… you could make sure the cloud variable is only the correct value long enough for the user to retrieve it. You constantly run the project from a server

Aye, there's the rub…
NickyNouse
Scratcher
1000+ posts

Making data inaccessible... can it be done?

gtoal wrote:

NickyNouse wrote:

Hmmm… you could make sure the cloud variable is only the correct value long enough for the user to retrieve it. You constantly run the project from a server

Aye, there's the rub…
Just brainstorming here
gtoal
Scratcher
1000+ posts

Making data inaccessible... can it be done?

NickyNouse wrote:

gtoal wrote:

NickyNouse wrote:

Hmmm… you could make sure the cloud variable is only the correct value long enough for the user to retrieve it. You constantly run the project from a server

Aye, there's the rub…
Just brainstorming here

Not that I wouldn't mind having some code that ran a project reliably 100% of the time from a server, including logging in automatically, and making sure that the cloud vars were alive (eg by using two communicating processes with different usernames) etc.

Don't suppose you have anything like that which runs on unix do you? :-)

G
NickyNouse
Scratcher
1000+ posts

Making data inaccessible... can it be done?

gtoal wrote:

NickyNouse wrote:

gtoal wrote:

NickyNouse wrote:

Hmmm… you could make sure the cloud variable is only the correct value long enough for the user to retrieve it. You constantly run the project from a server

Aye, there's the rub…
Just brainstorming here

Not that I wouldn't mind having some code that ran a project reliably 100% of the time from a server, including logging in automatically, and making sure that the cloud vars were alive (eg by using two communicating processes with different usernames) etc.

Don't suppose you have anything like that which runs on unix do you? :-)

G
Nah, that was all theoretical. Doesn't sound that hard to put together though (not that I'm offering)

Last edited by NickyNouse (May 3, 2015 10:25:40)

MathWizz
Scratcher
100+ posts

Making data inaccessible... can it be done?

gtoal wrote:

Don't suppose you have anything like that which runs on unix do you? :-)
*wink wink*

running Chromium 42.0.2311.90 with Flash Player 15.0.0.189 on Arch Linux 3.19.5-1-ck
MathWizzJsScratch && sb.js & Amber (coming soon! maybe)
gtoal
Scratcher
1000+ posts

Making data inaccessible... can it be done?

MathWizz wrote:

gtoal wrote:

Don't suppose you have anything like that which runs on unix do you? :-)
*link link*

It looks good, but do you have to have a browser up all the time to run this? My unix is command-line only :-/ I'm not that familiar with Javascript, having written only one program in it so far. Several years ago.

I guess I could learn a bit more javascript, to take advantage of your library, but wouldn't an api like this be much more useful in a real language like C where you can do some serious computation to feed back into Scratch apps..? (such as for example a backend Scrabble engine feeding into a GUI written in Scratch)

G
bobbybee
Scratcher
1000+ posts

Making data inaccessible... can it be done?

gtoal wrote:

MathWizz wrote:

gtoal wrote:

Don't suppose you have anything like that which runs on unix do you? :-)
*link link*

It looks good, but do you have to have a browser up all the time to run this? My unix is command-line only :-/ I'm not that familiar with Javascript, having written only one program in it so far. Several years ago.

I guess I could learn a bit more javascript, to take advantage of your library, but wouldn't an api like this be much more useful in a real language like C where you can do some serious computation to feed back into Scratch apps..? (such as for example a backend Scrabble engine feeding into a GUI written in Scratch)

G

This isn't browser JavaScript; it's actually for node.js, colloquially known as server-side JavaScript. node.js has full access to I/O, is command line based, has FFI access, etc

“Ooo, can I call you Señorita Bee?” ~Chibi-Matoran
ChocolatePi
Scratcher
1000+ posts

Making data inaccessible... can it be done?

gtoal wrote:

MathWizz wrote:

gtoal wrote:

Don't suppose you have anything like that which runs on unix do you? :-)
*link link*

It looks good, but do you have to have a browser up all the time to run this? My unix is command-line only :-/ I'm not that familiar with Javascript, having written only one program in it so far. Several years ago.

I guess I could learn a bit more javascript, to take advantage of your library, but wouldn't an api like this be much more useful in a real language like C where you can do some serious computation to feed back into Scratch apps..? (such as for example a backend Scrabble engine feeding into a GUI written in Scratch)

G
I think that library is server-side. You just need to install node.js through some package manager. It runs javascript locally.
MathWizz
Scratcher
100+ posts

Making data inaccessible... can it be done?

Yeah, it is an npm module that you can install and use with node.js, a server side JavaScript implementation.

running Chromium 42.0.2311.90 with Flash Player 15.0.0.189 on Arch Linux 3.19.5-1-ck
MathWizzJsScratch && sb.js & Amber (coming soon! maybe)
Homhomhomdance
Scratcher
54 posts

Making data inaccessible... can it be done?

when green flag clicked
set [CLOUDVAR v] to [0 ]
delete (all v) of [ no1 v]
delete (all v) of [ no2 v]
add [CLOUDVAR] to [ no1 v]
forever
replace item (1 v) of [ no2 v] with [(no1 :: list) ]
replace item (1 v) of [ no1 v] with [(no1 :: list)]
set [CLOUDVAR v] to [(no1 :: list) ]
if not<<(username) = [gtoal ]>> then
if <not <<<(CLOUDVAR) = [(item (1 v) of [no1 v]) ]> or <[(CLOUDVAR)] = [(item (1 v) of [no2 v] ]>>> then
set [ v] to [0 ]
switch backdrop to [you cheated v]
end
end
[quote]maybe, im not good at coding(:P[/quote]
end

Last edited by Homhomhomdance (Sept. 15, 2015 06:55:11)

Powered by DjangoBB