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

Calc "sandboxed": security as the default #130

Closed
kcrossen opened this issue Oct 18, 2023 · 1 comment
Closed

Calc "sandboxed": security as the default #130

kcrossen opened this issue Oct 18, 2023 · 1 comment
Labels

Comments

@kcrossen
Copy link

kcrossen commented Oct 18, 2023

Project goal is to package calc as a Qt/C++. "GUIable" object, so for example, cross compilable into iOS or Android apps.

Current solution is NOOP-ing all keywords that give calc access to the host operating system. These keywords are likely to be interpreted as "unknown function" syntax errors. This must, at minimum, include all directory/file manipulation keywords, but it's hard to imagine how reading/writing from/to stdin/stdout/stderr could even be supported. Instead, there is a C++ object interface, a keyhole so to speak, with methods to pass executable code as text to calc's interpret/execute core, methods to retrieve results (or side-effects) as either user readable text or as the text form of the internal numerator/denominator representation, methods to retrieve errors (typically as user readable text messages), and so forth.

This object must also "thunk" between the null-terminated, DIY memory managed calc text and Qt's memory managed string objects. Memory leakage (only possible on calc side) is detected (because memory is checked out/in explicitly) and flagged via an error method. (All calc internals that can allocate/deallocate memory are instrumented.)

Aside from "console applications", likely a tiny minority of Qt applications, there is no mechanism for compiled applications to communicate text with the user except via screen real estate explicitly created by the developer. Similarly, to affect the host OS file system requires explicit code by the developer. Classic-calc, on the other hand, can delete/modify host OS directories/files via an executed explicit cal file or via a cal file that covertly assembles executable text that can delete/modify host OS directories/files.

To support this feature and current calc in the same code base may involve some complexities. For example, calc-classic (with all of its host OS capabilities) as a wrapper around the proposed object may complicate parsing if the two "layers" are to be absolutely church-and-state. Alternately, it may be handled via two different compile/link chains w/ internal conditionals.

With respect to APCalculator, most of the calculator exists inside the calc object, e.g. the RPN stack (if in RPN mode), builtin or app or user defined functions, abstract Newton's method machinery, etc., etc. What's external is the UI which triggers submission of cal code to calc object, displays the resulting states of calc-internal items, the history recorder, and a help display system.

@lcn2 lcn2 added the wontfix label Oct 19, 2023
@lcn2 lcn2 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2023
@lcn2
Copy link
Owner

lcn2 commented Oct 19, 2023

Request closed. User prefers to work on their own copy of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants