Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions .github/actions/install-bot-engine/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ runs:
if [ -s "$JFROG_NPMRC_FILE" ]; then
NPM_ARGS=(--userconfig "$JFROG_NPMRC_FILE")
fi
source "${{ github.action_path }}/redact-command-output.sh"
# pip reads PIP_INDEX_URL from the env setup-jfrog exported. REF mode
# resolves the published engine's deps unpinned + installs the SDK/CLI by
# version (a consumer can't see the engine's hash-locked requirements).
# SDK_VERSION/CLI_VERSION track the engine at ENGINE_REF.
python -m pip install --upgrade pip
pip install "databricks-bot-engine @ git+https://github.com/${ENGINE_REPO}@${ENGINE_REF}"
pip install "claude-agent-sdk==${SDK_VERSION}"
npm install "${NPM_ARGS[@]}" -g "@anthropic-ai/claude-code@${CLI_VERSION}"
run_with_redacted_url_queries python -m pip install --upgrade pip
run_with_redacted_url_queries pip install "databricks-bot-engine @ git+https://github.com/${ENGINE_REPO}@${ENGINE_REF}"
run_with_redacted_url_queries pip install "claude-agent-sdk==${SDK_VERSION}"
run_with_redacted_url_queries npm install "${NPM_ARGS[@]}" -g "@anthropic-ai/claude-code@${CLI_VERSION}"
echo "$(npm prefix -g)/bin" >> "$GITHUB_PATH"
16 changes: 16 additions & 0 deletions .github/actions/install-bot-engine/redact-command-output.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

run_with_redacted_url_queries() {
local previous_shell_options="$-"
local command_status

set +e
"$@" 2>&1 \
| sed -E 's#([Hh][Tt][Tt][Pp][Ss]?://[^?[:space:]]+)\?[^[:space:]]+#\1?[REDACTED]#g'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Low — The sed filter only redacts queries on URLs that start with http(s)://. urllib3 and pip error lines such as Max retries exceeded with url: /pkg.whl?X-Amz-Signature=... have no scheme, so signed queries can still reach the logs. Add a rule for url: /path?query and test it.

🔀 Found by GPT-6.1 Sol · confirmed by the judge

Comment thread
rahuls-db marked this conversation as resolved.
Resolved
command_status=${PIPESTATUS[0]}
if [[ "$previous_shell_options" == *e* ]]; then
set -e
fi

return "$command_status"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
source "$SCRIPT_DIR/redact-command-output.sh"

test_redacts_url_query_and_preserves_host_and_path() {
local output

output=$(run_with_redacted_url_queries bash -c \
'printf "%s\n" "Downloading https://packages.example.test/artifacts/pkg.whl?X-Amz-Algorithm=DUMMY&X-Amz-Credential=DUMMY"')

[[ "$output" == 'Downloading https://packages.example.test/artifacts/pkg.whl?[REDACTED]' ]]
}

test_preserves_command_exit_code() {
Comment thread
rahuls-db marked this conversation as resolved.
Resolved
local output
local status

set +e
output=$(run_with_redacted_url_queries bash -c \
'printf "%s\n" "Failed https://packages.example.test/pkg.tgz?X-Amz-Signature=DUMMY" >&2; exit 37')
status=$?
set -e

[[ "$status" -eq 37 ]]
[[ "$output" == 'Failed https://packages.example.test/pkg.tgz?[REDACTED]' ]]
}

test_redacts_url_query_and_preserves_host_and_path
test_preserves_command_exit_code
3 changes: 3 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Test install-log URL redaction
run: bash .github/actions/install-bot-engine/redact-command-output_test.sh

- uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
toolchain: stable
Expand Down
Loading