On 05/02/2016 12:04 PM, Simo Sorce wrote:
On Mon, 2016-05-02 at 11:49 -0400, John Dennis wrote:
> I agree with Simo, mapping is best done by executable code.
>
> I've used and written a variety of mapping systems. Many try to offer a
> simple set of rules to evaluate, they are never sufficient for real
> world use cases. I truly believe to do mapping correctly you need the
> power of a full language. But why implement a new language to do mapping
> when you've got perfectly valid languages already? The only downside to
> allowing loadable Python code to execute is trusting the loaded code is
> not malicious because it will be difficult to restrict what it can
> perform. I don't mean to down play this concern but trusting admins is
> already presumed.
No loading/eval of python code from the admin API.
You develop your mapping module, and you install it on the server, then
you just enable/disable it.
I don't see the practical difference. You're allowing unknown code to
execute execute in a security sensitive context (necessitates admin or
root privilege in some form). That for good reason should give a lot of
people pause and is what I believe drives the unrelenting invention of
mapping rules (because evaluating a constrained set of rules greatly
limits unintended access and dangerous side effects).
> My suggestion for the API interface would be to pass a JSON
struct in
> and have it return a JSON struct which is the mapped result. You may
> also need to pass in some type of context information to help the mapper.
I think the current python dictionary is ok to represent the mapping,
why introduce JSON at this point ?
You're right, it's not really needed. I was thinking of other scenarios
that do not apply to Ipsilon.
--
John