amd-gaia 0.15.1__py3-none-any.whl → 0.15.2__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.
gaia/security.py CHANGED
@@ -109,14 +109,34 @@ class PathValidator:
109
109
  # Resolve path using os.path.realpath to follow symlinks
110
110
  # This prevents TOCTOU attacks by resolving at check time
111
111
  real_path = Path(os.path.realpath(path)).resolve()
112
+ real_path_str = str(real_path)
113
+
114
+ # macOS /var symlink handling: normalize by removing /private prefix
115
+ def normalize_macos(p: str) -> str:
116
+ if p.startswith("/private/"):
117
+ return p[len("/private") :]
118
+ return p
119
+
120
+ norm_real_path = normalize_macos(real_path_str)
112
121
 
113
122
  # Check if real path is within any allowed directory
114
- for allowed_path in self.allowed_paths:
123
+ for allowed_path in list(self.allowed_paths):
115
124
  try:
116
- # is_relative_to requires Python 3.9+, use alternative for compatibility
117
- real_path.relative_to(allowed_path)
125
+ # Ensure allowed_path is also resolved to handle symlinks correctly
126
+ # IMPORTANT: Use str(allowed_path) as allowed_path might already be a Path object
127
+ allowed_path_str_raw = str(allowed_path)
128
+ res_allowed = Path(os.path.realpath(allowed_path_str_raw)).resolve()
129
+ allowed_path_str = str(res_allowed)
130
+ norm_allowed_path = normalize_macos(allowed_path_str)
131
+
132
+ # Robust check using string prefix on normalized paths
133
+ if norm_real_path.startswith(norm_allowed_path):
134
+ return True
135
+
136
+ # Fallback to relative_to for safety
137
+ real_path.relative_to(res_allowed)
118
138
  return True
119
- except ValueError:
139
+ except (ValueError, RuntimeError):
120
140
  continue
121
141
 
122
142
  # If we get here, path is not allowed. Prompt user?
gaia/talk/app.py CHANGED
@@ -126,8 +126,7 @@ def print_integration_examples():
126
126
  print("INTEGRATION EXAMPLES")
127
127
  print("=" * 60)
128
128
 
129
- print(
130
- """
129
+ print("""
131
130
  Basic Integration:
132
131
  ```python
133
132
  from gaia.talk.sdk import TalkSDK, TalkConfig
@@ -174,8 +173,7 @@ from gaia.talk.sdk import quick_chat
174
173
  response = await quick_chat("Hello!")
175
174
  print(response)
176
175
  ```
177
- """
178
- )
176
+ """)
179
177
 
180
178
 
181
179
  async def main():
gaia/version.py CHANGED
@@ -6,10 +6,10 @@ import os
6
6
  import subprocess
7
7
  from importlib.metadata import version as get_package_version_metadata
8
8
 
9
- __version__ = "0.15.1"
9
+ __version__ = "0.15.2"
10
10
 
11
11
  # Lemonade version used across CI and installer
12
- LEMONADE_VERSION = "9.1.0"
12
+ LEMONADE_VERSION = "9.1.4"
13
13
 
14
14
 
15
15
  def get_package_version() -> str: