Skip to content

Commit

Permalink
refactor: updated permission flags and access types for pyapi only.
Browse files Browse the repository at this point in the history
  • Loading branch information
Almas-Ali committed Oct 27, 2024
1 parent bb93bd8 commit b8fbae7
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/builtin_funcs.py
Original file line number Diff line number Diff line change
@@ -428,7 +428,7 @@ def execute_type(self, exec_ctx: Context) -> RTResult[Value]:

@args(["code", "ns"])
def execute_pyapi(self, exec_ctx: Context) -> RTResult[Value]:
security.security_prompt("pyapi_requests")
security.security_prompt("pyapi_access")

res = RTResult[Value]()

6 changes: 3 additions & 3 deletions core/security.py
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@
from core.colortools import Log

# Define all types of security prompts
SecurityPromptType = Literal["pyapi_requests", "disk_access", "network_access"]
SecurityPromptType = Literal["pyapi_access", "disk_access", "network_access"]
type_messages: dict[str, str] = {
"pyapi_requests": "This program is attempting to use the Python API",
"pyapi_access": "This program is attempting to use the Python API",
"disk_access": "This program is attempting to access the disk",
"network_access": "This program is attempting to access the network"
}
@@ -15,7 +15,7 @@

# !!! Only used for tests !!!
def allow_all_permissions() -> None:
allowed["pyapi_requests"] = True
allowed["pyapi_access"] = True
allowed["disk_access"] = True
allowed["network_access"] = True

2 changes: 1 addition & 1 deletion radon.py
Original file line number Diff line number Diff line change
@@ -137,7 +137,7 @@ def main(argv: list[str]) -> None:
case "--allow-disk" | "-D":
base_core.security.allowed["disk_access"] = True
case "--allow-py" | "-P":
base_core.security.allowed["pyapi_requests"] = True
base_core.security.allowed["pyapi_access"] = True
case "--allow-network" | "-W":
base_core.security.allowed["network_access"] = True
case _:

0 comments on commit b8fbae7

Please sign in to comment.