Codejail cannot run without a user set

未关闭
#162 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
50/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
security

调研方向

从 jail_code.py 开始,检查在 subprocess.Popen 运行命令之前命令列表是如何组装的,尤其是在未配置 user 时。将 user 选项取消设置后重现 jailed execution,然后确定预期的解决方案是修正命令构造,还是将 user 设为必填项。选定的行为能够一致地工作,并且由相关的现有测试覆盖时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

If codejail is not configured with a user to run commands as, jailed code execution will fail. Effectively, this makes the user config option mandatory rather than optional.

This probably hasn't come up much because most users would configure it with a user. One possibility is to just make the option mandatory.

Details:

jail_code.py builds up a list to pass to subprocess.Popen. This is run as a command with arguments, rather than a shell command string. However, one of the arguments is 'TMPDIR=tmp', a construction to set an environment variable for a process in Bash. TMPDIR=tmp python ... works fine in Bash, but subprocess.Popen(['TMPDIR=tmp', 'python', ...]) does not work because TMPDIR=tmp is not a valid executable.

The reason it works with a user configured is that the command array will then first be prefixed with ['sudo', '-u', user]. The sudo command interprets the remainder of its arguments as a shell string rather than a command and arguments.

主要语言
Python
星标
477
派生
83
平均合并
1 天 8 小时
30 天内合并 PR
6

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

openedx/codejail 的其他 Issue

查看 openedx/codejail 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。