Giter Club home page Giter Club logo

coconut-interpreter's People

Contributors

brittanywang avatar jcruz avatar mjenrungrot avatar nkadonaga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jcruz nkadonaga

coconut-interpreter's Issues

Collect user testing feedback

A catch-all place for feedback collected during a user testing session, which can later be broken into separate issues.

Bugs

Minify breaks when trying to view Python (known bug) REMOVED

  • Reviewer: Prof. Kate, James R., Yucheng W.
    • Steps to reproduce the problem: Use minify and then click Python checkbox, output breaks (known bug)

Python 2 doesn't work (known bug) FIXED

  • Reviewer: Collin V., Jamie K.
    • Steps to reproduce the problem: Select different target under compilation parameters

Suggestions

App

  • Reviewer: Prof. Kate

    • Help the tutorial team to be able to add a "run" button next to a block of code so that the output will appear directly under it.
      • Talk to tutorial team for API functions
    • Information icon/pop-up to tell first-time users what the options mean RESOLVED
    • Add label for "Coconut Compilation Parameters" RESOLVED
    • Show line numbers in the editor and compiled Python (add an option?) RESOLVED
    • Include a way to save the file RESOLVED
    • Stress-testing? (What happens when we have a timeout?)
      • Timeout error is not informative
  • Reviewer: Collin V., Jamie K.

    • Explain what no_tco is REMOVED
  • Reviewer: James R., Yucheng W.

    • What is the difference between "Keep line numbers" and "Keep lines"? REMOVED
    • (repeat) Explain what no_tco is
    • (repeat) Show line numbers in the editor and compiled Python
    • Different font size RESOLVED
  • Reviewer: Chen P., Nelll W.

    • Theme color options (e.g. purple) WON'T DO
    • (repeat) Bigger font size
    • (repeat) Show line numbers in the editor and compiled Python
  • Reviewer: Evan H.

    • Can't tell difference between traceback and not traceback RESOLVED
    • Help tutorial team RESOLVED

README

  • Reviewer: Luis H.

    • "Add a video...? Just kidding."
  • Reviewer: Nelll W.

    • Looks outdated, since the highlighted traceback now shows in the Python
  • Reviewer: Collin V., Jamie K.

    • Looks good.

Purge old frontend

  • Delete index route in app/app.py
  • Delete app/static
  • Delete app/templates
  • Delete test_page_loads in tests/test_interpreter.py

Choose Coconut version

'provide an option to choose what Coconut version to use (or even "coconut-develop")'

Plans:

  • N/A

Monorepo

I've been thinking about this and I think it might make sense to finally make a monorepo as we finish the project.

Pros

  • Unified repository (all code, issues, & PRs in one place)
  • Reduction of three organization repos to one repo
  • Deploy frontend without the need of two different remotes

Cons

  • Lose commit history of frontend (not a big deal)

Changes needed

Allow compilation parameters

'provide a way to change the compilation parameters (e.g. compile to Python 3 instead of universal Python as if you had passed "--target 3")'

Plans:

  • write/test backend
  • implement frontend (@jcruz)
    • ideas: a gear? hover over run button for options?
  • merge backend PR #51

Highlight tracebacks in red

Status: GREEN

Task:

  • Let's highlight all errors in red.

Plans:

  • Parse traceback in backend and send object with line number, error message to client

Measure run-time for each components.

Needed for Phase 2 presentations.

Progress: Green

Plans:

  • Measure the run-time for all coconut code from the tutorial website and put it in the table.
  • Measure the run-time on Heroku; try with small code and big code from the tutorial.
  • Measure the run-time on AWS; same as above.

Guard os module

  • Protect the os module in Python.
  • Allow only standard libraries.

Explicit README.md instructions

  • Add git clone as initial step
  • Explicitly say install Node separately from Yarn
  • Add make sure running Python 3?
  • Add note under Python packages: installed with pip
  • Fix requirements.txt (Werkzeug to version 0.12)

Execution interrupt (ctrl-C)

'provide a way to interrupt execution (as if you pressed Ctrl-C)'

Plans

  • Figure out how map the process to the client so we can cancel an ongoing process.

Test if the coconut compiled file has the SEPARATOR string.

The compiled file is required to have the following string only once and somewhere. Otherwise, it creates the following error.

# Compiled Coconut: -----------------------------------------------------------\n\n

Causes an error in this case.
image

Improve Security

Status: Yellow

Plans:

  • Get AWS Credit.
  • Change CircleCI to deploy to AWS instead of Heroku.
  • Research AWS Lambda
  • (If using Docker)
    • Setup docker image.
    • Have a single user's requests direct to the same container and have a different container for each user.

References:

Research on security

Major security concerns for online compilers/interpreters are malicious codes submitted from users. In the current system, the code is evaluated on the server-side. From the server perspective, the server may happen to run the potentially malicious code. Some potential problems may arise, at least but not limited to:

  • DDoS attack to exhaust the server's resources.
  • Manipulate file structures using os module

There are two main ways of addressing this security concern: running code on client-side and on server-side.

  1. Client-side
    In short, we can execute everything client-side using JavaScript, and possibly use tools like Brython that essentially converts Python script to JavaScript and in order for it to be executed on the client-side.

Keypoints

  • Not work with some of the libraries.
  • Depend on specific versions of library.
  • Tend to be 3 to 5 times slower.
  1. Server-side
    2.1 Use Sandbox
    General ideas are to use the concept of sandboxing that lets the potentially malicious code in that sandbox. See more discussion here. In Python, we have some discussions here.
    2.2 Use RestrictedPython
    RestrictedPython 4.0b2 is a defined subset of the Python language which allows to provide a program input into a trusted environment.

Keypoints

  • Faster
  • Not depend on specific versions of library.

Thoughts on this issue are very appreciated.

Running error coconut's code return the entire stack of tracebacks

Need to return only traceback related to coconut's code.

Traceback (most recent call last):
  File "/home/circleci/project/tests/test_interpreter.py", line 88, in test_error
    assert ERR_OUTPUT in response.data
AssertionError

Stdout:
Finish compilation [5f1d2705-d2b3-4f34-84ee-b5bc1efaac56] to [5f1d2705-d2b3-4f34-84ee-b5bc1efaac56.py]
Error in running Coconut's code
Delete temp files 5f1d2705-d2b3-4f34-84ee-b5bc1efaac56 and 5f1d2705-d2b3-4f34-84ee-b5bc1efaac56.py
Output is
b'Traceback (most recent call last):\n  File "5f1d2705-d2b3-4f34-84ee-b5bc1efaac56.py", line 638, in <module>\n    1 + "a"\nTypeError: unsupported operand type(s) for +: \'int\' and \'str\'\n'
		

Improve README.md

  • Installation instructions
  • How to run
  • Update features (i.e. Python switch, updated error messages, etc.)

Coconut-specific syntax highlighting

'nicely highlight Coconut-specific syntax (e.g. "match" or "case")'

Status: GREEN

Plans:

  • List all the keywords to be highlighted (Ref here)
  • Separate keywords into different groups because we plan to highlight them differently, I think.
  • Extend the syntax formatting based on here on some small expressions + Test
  • Populate and extend the syntax highlighting for all keywords.

Guard for DDoS.

Prevent programs from taking arbitrarily large CPU or memory to compile.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.