ffig
ffig copied to clipboard
Create Flask app with REST API
A simple Flask http://flask.pocoo.org app could receive TU text (all includes included) and a list of bindings to produce and respond with generated code.
request:
{
"translation_unit": "class A { int x_; public: int getX() const { return x_; } void setX(int x) { x_ = x; } };",
"bindings": ["ruby", "python"],
"module": "TestModule"
}
response:
{
"TestModule.py" : " ... ",
"TestModule.rb" : " ... ",
"TestModule_c.cpp" : " ... ",
"TestModule_c.h" : " ... "
}
I want to start a separate repo, which will build on top of your docker image. That way I can specify a release tag and not be affected by ongoing development.
Thoughts?
What are the pros and cons vs:
- a new repo?
- a fork of this repo?
- a branch?
I'd go for a branch by default.
Not a fork - if starting a new repo, might as well start from scratch.
Happy to start a branch, let's tidy up the API and docker base image first and then I will get started
Thinking about rendering just 1 page with flask and then sending JS post requests with the translation unit. The max size of a post request will limit how big a header file we can process and I will need to warn the users.
Also we can use client-side javascript to check headerfile for malicious code by keywords like cgroup. IIRC, cgroup is the kernel module that docker uses. I don’t know how exactly accessing cgroups inside a container can lead to privelige escalation, but it feels like a reasonable first attempt at security.