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
14 changes: 14 additions & 0 deletions common_env
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,20 @@ if exists zoxide && exists shell_name ; then
unset ZO_SHELL
fi


###
### kiro
###
# kiro: load shell integration when running inside kiro terminal
# Centralized here so both bash and zsh get the same behavior.
if [[ "$TERM_PROGRAM" == "kiro" ]] && exists kiro && exists shell_name ; then
# allow opt-out via env var: KIRO_DISABLE_SHELL_INTEGRATION=1
if [ -z "${KIRO_DISABLE_SHELL_INTEGRATION:-}" ] ; then
kiro_path="$(kiro --locate-shell-integration-path "$(shell_name)")"
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The command substitution for kiro --locate-shell-integration-path should handle potential errors. If the command fails, kiro_path will be empty but the error isn't captured. Consider adding error handling or checking the exit status.

Copilot uses AI. Check for mistakes.
[[ -n "$kiro_path" && -f "$kiro_path" ]] && . "$kiro_path"
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

Sourcing a file without validating its contents or permissions could be a security risk. Consider adding additional checks to ensure the file is safe to source, such as verifying it's owned by the current user or checking permissions.

Suggested change
[[ -n "$kiro_path" && -f "$kiro_path" ]] && . "$kiro_path"
if [[ -n "$kiro_path" && -f "$kiro_path" ]]; then
# Check that the file is owned by the current user and not world-writable
kiro_owner=$(stat -c %U "$kiro_path" 2>/dev/null)
if [[ "$kiro_owner" == "$USER" ]] && [[ ! -w "$kiro_path" || $(stat -c %a "$kiro_path" 2>/dev/null) -lt 666 ]]; then
. "$kiro_path"
fi
fi

Copilot uses AI. Check for mistakes.
fi
fi

###
### ssh-agent
###
Expand Down