Re:JsonLogic – Build complex rules, serialize them as JSON
by josephearl on Tuesday October 25, 2016 @08:03AM
(#12787150)
Apple has restrictions on downloading executable code, which downloading a Lua script would likely fall afoul of.
It's also a potential security risk - the downloaded script could perform things other than logic and so would require sandboxing/whitelisting of commands.
Putting logic in JSON avoids both of these issues since the actual handling of the logic is performed by a client-side library.
Re:JsonLogic – Build complex rules, serialize them as JSON
by jfroma on Tuesday October 25, 2016 @08:26AM
(#12787275)
Serious question, whats the difference between executable lua and executable json regarding apple restrictions?
Re:JsonLogic – Build complex rules, serialize them as JSON
by michaelmior on Tuesday October 25, 2016 @09:56AM
(#12787986)
JSON is not executable. Although I suppose you could argue that embedding an interpreter for a DSL like this inside your app is violating the restriction.
Re:JsonLogic – Build complex rules, serialize them as JSON
by boomlinde on Tuesday October 25, 2016 @11:09AM
(#12788608)
Lua isn't executable either. The point at which it results in some corresponding machine instructions wouldn't be much different in this case.
Re:JsonLogic – Build complex rules, serialize them as JSON
by MichaelBurge on Tuesday October 25, 2016 @07:56PM
(#12792831)
ELF binaries aren't executable either: They require the kernel to interpret them, preparing virtual memory and granting it a pid. Alone, they're just sequences of bytes.
Re:JsonLogic – Build complex rules, serialize them as JSON
by boomlinde on Wednesday October 26, 2016 @02:13AM
(#12794274)
What's your point? That you are willing to extend this principle to ELF binaries doesn't really affect my argument.
My point is that for the purpose of letting some non-trusted instructions run safely in a program, encoding them as JSON or Lua will come with the same caveats. Ultimately, they are both interpreted and can be sandboxed thus. Neither contain any code that will be passed off as-is for the CPU to execute. In some cases, neither does an ELF blob.
Re:JsonLogic – Build complex rules, serialize them as JSON
by dirtyaura on Tuesday October 25, 2016 @09:53AM
(#12787953)
To my understanding those restrictions have been lifted years ago. They used them strategically to kill Flash from becoming an app development platform and still probably can use them to kill cross-platform programming kits. But having scripting code in the app is not a problem anymore - they even offer Javascript execution context library in iOS SDK that makes it easy to run Javascript without UI. https://developer.apple.com/reference/javascriptcore/jsconte...
Also when real programmers have to interact with those systems (and my practice shows, that business users don't want to program, they ask programmers to do it), it's so much pain to use those GUI languages or whatever and it's so easy just to write some code in sane language.