Skip to content
Open
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
12 changes: 12 additions & 0 deletions .bash_exports
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ fi
if [ -f "$HOME/ppv/pillars/dotfiles/flywire-notes/bash-config.sh" ]; then
source "$HOME/ppv/pillars/dotfiles/flywire-notes/bash-config.sh"
fi

# Default Patchright backend for Playwright (global, non-intrusive)
# If a user-level module alias exists at ~/.config/node-module-alias/node_modules,
# add it to NODE_PATH so that require('playwright') resolves to Patchright.
# This avoids wrapper scripts and per-repo code changes.
export PATCHRIGHT_MODULE_ROOT="$HOME/.config/node-module-alias/node_modules"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using ${HOME} instead of $HOME for consistent shell parameter expansion and to prevent potential word splitting issues. Also, consider quoting the path to handle spaces in directory names.

if [ -d "$PATCHRIGHT_MODULE_ROOT" ]; then
Comment on lines +36 to +37
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 [Security Risk]: Modifying NODE_PATH globally to inject modules can pose security risks1. Consider using project-level configurations or npm's package aliasing instead. This approach could lead to unintended module resolution and potential supply chain attacks.

Footnotes

  1. CWE-426: Untrusted Search Path - https://cwe.mitre.org/data/definitions/426.html

case :$NODE_PATH: in
*:$PATCHRIGHT_MODULE_ROOT:*) ;;
*) export NODE_PATH="$PATCHRIGHT_MODULE_ROOT:${NODE_PATH}" ;;
Comment on lines +39 to +40
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider handling the case where NODE_PATH is unset. The current approach might result in a trailing colon when NODE_PATH is empty. A more robust approach would be to use parameter expansion with default values.

Suggested change
*:$PATCHRIGHT_MODULE_ROOT:*) ;;
*) export NODE_PATH="$PATCHRIGHT_MODULE_ROOT:${NODE_PATH}" ;;
*) export NODE_PATH="${PATCHRIGHT_MODULE_ROOT}${NODE_PATH:+:${NODE_PATH}}" ;;

esac
fi