openedx / openedx/codejail

Proxy doesn't work, while executing jail_code there is no output displayed

Open
#109 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
479
Forks
84
Avg merge
16h 34m
Merged PRs (30d)
2

Description

Hello,
I would like to execute this python code (containing a print statement and a sleep call for 1 second for each iteration of the range(5)).

The idea was to test and see if PROXY is working as desired. I was excepting to see while executing jail_code.jail_code(...) in the stdout of my terminal progressively displayed the numbers second by second:

1
2
3
4
full-output
- 0
- 1
- 2
- 3
- 4

but didn't happened..
First one should be the output printed by the proxy, and the second one is when I iterate on the result object stdout.

from codejail import jail_code
jail_code.set_limit("REALTIME", 20)
jail_code.set_limit("CPU", 100)
jail_code.set_limit("FSIZE", 10000)
jail_code.set_limit("PROXY", 1)

code = """
import time
for i in range(5):
    print(i)
    time.sleep(1)
"""

res = jail_code.jail_code(
    "python",
    code
)
print("full-output")
for line in res.stdout.decode('utf-8').split('\n'):
    print("-", line)

The issue here is that during this execution of jail_code.jail_code(...) the PROXY didn't seems to print anything in the output is that normal, I'm missing something ?
Thanks in advance.
PS: I have CODEJAIL_TEST_USER/ENV and CODEJAIL_PROXY configured in my ENV.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided Python snippet with the configured CODEJAIL_TEST_USER/ENV and CODEJAIL_PROXY settings, then trace jail_code.jail_code(...) and the proxy's stdout handling. Determine whether progressive output is expected or whether only res.stdout is supported; done means the behavior is clarified and, if it is a bug, covered by a suitable regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.