PikoAi 0.1.11__py3-none-any.whl → 0.1.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Env/shell.py CHANGED
@@ -78,15 +78,26 @@ class ShellExecutor(BaseEnv):
78
78
  'output': 'Blocked potentially harmful command.',
79
79
  'error': f'Command matches forbidden pattern: {pattern}'
80
80
  }
81
- # Check for sensitive directory access
81
+ # Improved check for sensitive directory access
82
82
  for sensitive_dir in sensitive_dirs:
83
- # Only block if the command is trying to directly access or operate on the sensitive dir
84
- if re.search(rf'\b{sensitive_dir}\b', code_or_command, re.IGNORECASE):
85
- return {
86
- 'success': False,
87
- 'output': f'Blocked access to sensitive directory: {sensitive_dir}',
88
- 'error': f'Attempted access to sensitive directory: {sensitive_dir}'
89
- }
83
+ # Only block if the command is trying to directly operate on the sensitive dir itself (not subpaths)
84
+ # For '/', block only if the command is exactly '/' or has a space and then '/'
85
+ if sensitive_dir == '/':
86
+ if re.search(r'(\s|^)/($|\s)', code_or_command):
87
+ return {
88
+ 'success': False,
89
+ 'output': f'Blocked access to sensitive directory: {sensitive_dir}',
90
+ 'error': f'Attempted access to sensitive directory: {sensitive_dir}'
91
+ }
92
+ else:
93
+ # Block if the command is operating on the directory itself, not a subpath (e.g., 'ls /root' but not 'ls /root/somefile')
94
+ pattern = rf'(\s|^)({re.escape(sensitive_dir)})(\s|$)'
95
+ if re.search(pattern, code_or_command, re.IGNORECASE):
96
+ return {
97
+ 'success': False,
98
+ 'output': f'Blocked access to sensitive directory: {sensitive_dir}',
99
+ 'error': f'Attempted access to sensitive directory: {sensitive_dir}'
100
+ }
90
101
 
91
102
  # Execute the command in a subprocess
92
103
  self.process = subprocess.Popen(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PikoAi
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: An AI-powered task automation tool
5
5
  Home-page: https://github.com/nihaaaar22/OS-Assistant
6
6
  Author: Nihar S
@@ -10,7 +10,7 @@ Env/base_executor.py,sha256=awTwJ44CKWV4JO2KUHfHDX0p1Ujw55hlaL5oNYTEW9M,893
10
10
  Env/env.py,sha256=I3lOoyBJR5QNq3tWk_HVH6ncRx1vnilRYmj7b7h4jic,114
11
11
  Env/js_executor.py,sha256=tEAg5ho8Pa8LzxUbS1Idau8XuJWZZqPiNlvFPDwGkgc,2690
12
12
  Env/python_executor.py,sha256=1PIWL3Q8cgkQ4tvarf3d75dUTZoMF_dx_HoDho_zPEQ,4811
13
- Env/shell.py,sha256=hquziVipyJcEabu3LbAnuACtGGZ0YIr6IaSlp6ZWMJc,7287
13
+ Env/shell.py,sha256=kcWwaJwA2rbKqViAkRPTHaCKIGht9Yhjf2p4S57dHTs,8060
14
14
  Env/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  Env/tests/test_python_executor.py,sha256=5kfs0cOf-RgWTOers_1wB0yvYSF-HrHPsraJ-PxgR50,3156
16
16
  Env/tests/test_shell_executor.py,sha256=-RcCdSUMoRAXHISIh0IR5MCutco80fX2S3sQBcinc_Q,1034
@@ -27,9 +27,9 @@ Utils/executor_utils.py,sha256=WwK3TKgw_hG_crg7ijRaqfidYnnNXYbbs37vKZRYK-0,491
27
27
  Utils/ter_interface.py,sha256=Zay9mwyAyKYTNQAKOWXHAa3upo9TWprSf26STiHXk0g,6255
28
28
  llm_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
29
  llm_interface/llm.py,sha256=tI_KDOW14QLWowA7bB3GPe2qjlk0sjS5fBavs9XD1fo,5185
30
- pikoai-0.1.11.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
31
- pikoai-0.1.11.dist-info/METADATA,sha256=uM1TnOErAJmJgeepRI0N9bQZQGZdTVvllSvjKljaK60,2962
32
- pikoai-0.1.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
- pikoai-0.1.11.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
34
- pikoai-0.1.11.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
35
- pikoai-0.1.11.dist-info/RECORD,,
30
+ pikoai-0.1.12.dist-info/licenses/LICENSE,sha256=cELUVOboOAderKFp8bdtcM5VyJi61YH1oDbRhOuoQZw,1067
31
+ pikoai-0.1.12.dist-info/METADATA,sha256=4wGQkBNIjYCR9di2BrQ4Jwj1k8lQogqnE8JPmua-uCo,2962
32
+ pikoai-0.1.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
33
+ pikoai-0.1.12.dist-info/entry_points.txt,sha256=xjZnheDymNDnQ0o84R0jZKEITrhNbzQWN-AhqfA_d6s,50
34
+ pikoai-0.1.12.dist-info/top_level.txt,sha256=hWzBNE7UQsuNcENIOksGcJED08k3ZGRRn2X5jnStICU,53
35
+ pikoai-0.1.12.dist-info/RECORD,,