Group Abstract Group Abstract

Message Boards Message Boards

How can I prevent other users from seeing my Input Cells?

Posted 3 months ago
POSTED BY: Yeonjoon Park
4 Replies
Posted 3 months ago

I would store the sensitive code in a separate file. The file should be saved using Encode and you can evaluate it in your notebook using Get without revealing the contents of the file.

Without a separate file, maybe something related could be done by putting the output of Encode into the initialization of the Manipulate. For example suppose that you have this secret 123 constant, you could:

WithCleanup[
 input = CreateFile[];
 output = CreateFile[]
 ,
 Export[input, "x=123", "Text"];
 Encode[input, output];
 Import[output, "Text"]
 ,
 DeleteFile[{input, output}]]

(* "(*!1N!*)mcm\nXw\\kJhKx !" *)

and then put that into the initialization of the manipulate:

Manipulate[ f[x], 
 Initialization -> Get[StringToStream["(*!1N!*)mcm\nXw\\kJhKx !"]]]
POSTED BY: Gustavo Delfino
Posted 3 months ago

I was thinking along these lines as well, but I'm not sure it's sufficient. Any symbols defined as a consequence of the Get would be available for inspection. So, one would need to be extremely careful about how one can make data useful (i.e. impact the current calculation) while also making the details of the the data and the calculation opaque. Maybe I'm misunderstanding your suggestion, but the actual value 123 could very well be exposed somewhere along the line if a user really wanted to go looking.

I'm wondering if the only real way to do this is to push any computation dependent upon the magic numbers over into some API. All the user gets back is the result of the computation, but the actual steps of the computation (including obviously the dependency on the magic value) are all hidden behind the API.

POSTED BY: Eric Rimbey
Posted 3 months ago

How are you distributing your stuff? Like, are you sending the notebook itself?

POSTED BY: Eric Rimbey

I am not expert in security, so I only give my 2 cents about Manipulate. I suppose that you use SaveDefinitions -> True to make it work without reevaluating. But then your definitions get stored in the Manipulate cell and become visible with ShowExpression. So, even deleting all input would not be enough.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard