Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change EPERM into EACCES for file access #911

Merged
merged 1 commit into from
Sep 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dmoj/cptbox/isolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,18 @@ def _file_access_check(
normalized,
real,
)
return file, ACCESS_EPERM
return file, ACCESS_EACCES

if not fs_jail.check(normalized):
return normalized, ACCESS_EPERM
return normalized, ACCESS_EACCES

if normalized != real:
proc_dir = f'/proc/{debugger.pid}'
if real.startswith(proc_dir):
real = os.path.join('/proc/self', os.path.relpath(real, proc_dir))

if not fs_jail.check(real):
return real, ACCESS_EPERM
return real, ACCESS_EACCES

return real, None

Expand Down