-
Notifications
You must be signed in to change notification settings - Fork 295
chore(seed): Adjust devbox and scripts to enable seed --local for all sdk generators #14709
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
Changes from all commits
c9286ce
79a109c
5eefb20
a4e09cc
d1f6e49
9f4a5ba
2d4642d
e268dd8
c35bba1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| # Use 3.9 because some of our internal SDKs are on extremely old generator | ||
| # Use 3.10 because some of our internal SDKs are on extremely old generator | ||
| # versions that don't support 3.8 | ||
| export PYENV_ROOT="$HOME/.pyenv" | ||
| [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" | ||
| eval "$(pyenv init -)" | ||
| pyenv shell 3.9 | ||
| pyenv shell 3.10 | ||
| pip install poetry | ||
| poetry env use 3.9 | ||
| poetry env use 3.10 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -328,6 +328,23 @@ def copy_to_project(self, *, project: Project) -> None: | |||||||||||||||||||||||
| else: | ||||||||||||||||||||||||
| project.add_dependency(PYDANTIC_DEPENDENCY) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @staticmethod | ||||||||||||||||||||||||
| def _resolve_core_utilities_path(relative_filepath: str) -> str: | ||||||||||||||||||||||||
| """Resolve the core utilities source directory. | ||||||||||||||||||||||||
| Supports FERN_CORE_UTILITIES_PATH env var with colon-separated paths | ||||||||||||||||||||||||
| for local execution where sdk/ and shared/ are separate directories. | ||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||
| env_paths = os.environ.get("FERN_CORE_UTILITIES_PATH") | ||||||||||||||||||||||||
| if env_paths is not None: | ||||||||||||||||||||||||
| for source in env_paths.split(":"): | ||||||||||||||||||||||||
| if os.path.exists(os.path.join(source, relative_filepath)): | ||||||||||||||||||||||||
| return source | ||||||||||||||||||||||||
| return env_paths.split(":")[0] | ||||||||||||||||||||||||
|
Comment on lines
+338
to
+343
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fallback returns first path even when file doesn't exist in any path. If Should raise an error or return a default when no valid path is found: if env_paths is not None:
for source in env_paths.split(":"):
if os.path.exists(os.path.join(source, relative_filepath)):
return source
# File not found in any provided path - fall through to default behaviorRemove line 343 to fall through to the default logic instead of blindly returning an invalid path.
Suggested change
Spotted by Graphite |
||||||||||||||||||||||||
| if "PYTEST_CURRENT_TEST" in os.environ: | ||||||||||||||||||||||||
| return os.path.join(os.path.dirname(__file__), "../../../../../core_utilities/sdk") | ||||||||||||||||||||||||
| return "/assets/core_utilities" | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def _copy_file_to_project( | ||||||||||||||||||||||||
| self, | ||||||||||||||||||||||||
| *, | ||||||||||||||||||||||||
|
|
@@ -337,11 +354,7 @@ def _copy_file_to_project( | |||||||||||||||||||||||
| exports: Set[str], | ||||||||||||||||||||||||
| string_replacements: Optional[dict[str, str]] = None, | ||||||||||||||||||||||||
| ) -> None: | ||||||||||||||||||||||||
| source = ( | ||||||||||||||||||||||||
| os.path.join(os.path.dirname(__file__), "../../../../../core_utilities/sdk") | ||||||||||||||||||||||||
| if "PYTEST_CURRENT_TEST" in os.environ | ||||||||||||||||||||||||
| else "/assets/core_utilities" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| source = self._resolve_core_utilities_path(relative_filepath_on_disk) | ||||||||||||||||||||||||
| SourceFileFactory.add_source_file_from_disk( | ||||||||||||||||||||||||
| project=project, | ||||||||||||||||||||||||
| path_on_disk=os.path.join(source, relative_filepath_on_disk), | ||||||||||||||||||||||||
|
|
@@ -352,11 +365,7 @@ def _copy_file_to_project( | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def _copy_http_sse_folder_to_project(self, *, project: Project) -> None: | ||||||||||||||||||||||||
| """Copy the http_sse folder using the same approach as individual file copying""" | ||||||||||||||||||||||||
| source = ( | ||||||||||||||||||||||||
| os.path.join(os.path.dirname(__file__), "../../../../../core_utilities/sdk") | ||||||||||||||||||||||||
| if "PYTEST_CURRENT_TEST" in os.environ | ||||||||||||||||||||||||
| else "/assets/core_utilities" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| source = self._resolve_core_utilities_path("http_sse") | ||||||||||||||||||||||||
| folder_path_on_disk = os.path.join(source, "http_sse") | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Define exports for each file | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two PHP PHAR executables are downloaded via
curl -sSL … | chmod +xwith no integrity check (no--sha256or signature verification). Thelatest-2.xURL path for composer is mutable — it resolves to whatever the server currently serves. If eithergetcomposer.orgorcs.symfony.comis compromised, or if DNS/routing is hijacked, a malicious PHP executable will be silently installed and placed on$PATHof every developer who initialises this devbox, giving the attacker arbitrary code execution on their machine. The once-written guard ([ ! -f … ]) prevents re-download but provides no tamper detection after the fact.Prompt To Fix With AI
Severity: medium | Confidence: 80%