Skip to content

Commit 56a1ebb

Browse files
authored
Merge branch 'latest' into dependabot/github_actions/dot-github/workflows/actions/download-artifact-5
2 parents d41a07f + c0a792f commit 56a1ebb

10 files changed

Lines changed: 72 additions & 45 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828
with:
2929
fetch-depth: 0
3030

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout repository
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v5
1515

1616
- name: Install ShellCheck
1717
run: sudo apt-get install -y shellcheck
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v5
3030

3131
- name: Install hadolint
3232
run: |
@@ -45,7 +45,7 @@ jobs:
4545

4646
steps:
4747
- name: Checkout repository
48-
uses: actions/checkout@v4
48+
uses: actions/checkout@v5
4949

5050
- name: Install yamllint
5151
run: |

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: Checkout code
32-
uses: actions/checkout@v4
32+
uses: actions/checkout@v5
3333
with:
3434
fetch-depth: 0
3535

@@ -39,7 +39,7 @@ jobs:
3939
driver: docker-container
4040

4141
- name: Install GitVersion
42-
uses: gittools/actions/gitversion/setup@v4.0.1
42+
uses: gittools/actions/gitversion/setup@v4.1.0
4343
with:
4444
versionSpec: "6.1.0"
4545

@@ -131,7 +131,7 @@ jobs:
131131

132132
steps:
133133
- name: Checkout code
134-
uses: actions/checkout@v4
134+
uses: actions/checkout@v5
135135
with:
136136
fetch-depth: 0
137137

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ dist/
2424

2525
# Ignore Prettier configuration overrides for development
2626
.prettierignore
27+
28+
# Configuration files
29+
.config

Dockerfile

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@ ENV DEBIAN_FRONTEND=noninteractive \
2020
WORKER_BIN_DIR=/usr/local/worker/bin \
2121
WORKER_ETC_DIR=/usr/local/worker/etc \
2222
# Add worker bin to PATH
23-
PATH=/usr/local/worker/bin:${PATH} \
24-
# Cloud SDK configurations
25-
CLOUDSDK_CONFIG=/usr/local/configs/gcloud \
26-
AWS_CONFIG_FILE=/usr/local/configs/aws \
27-
AZURE_CONFIG_DIR=/usr/local/configs/azure
23+
PATH=/usr/local/worker/bin:${PATH}
2824

2925
# Set the shell with pipefail option
3026
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
3127

3228
# Set user to root for installation
3329
USER root
3430

31+
# Set config paths
32+
ENV AWS_CONFIG_FILE=${HOME}/.config/aws
33+
ENV AZURE_CONFIG_DIR=${HOME}/.config/azure
34+
ENV CLOUDSDK_CONFIG=${HOME}/.config/gcloud
35+
3536
# Install necessary packages
3637
# hadolint ignore=DL3015
3738
RUN apt-get update && \
@@ -49,8 +50,8 @@ RUN apt-get update && \
4950
unzip=6.0-28ubuntu6 \
5051
nano=8.3-1 \
5152
vim=2:9.1.0967-1ubuntu4 \
52-
python3.13=3.13.3-1ubuntu0.2 \
53-
python3.13-venv=3.13.3-1ubuntu0.2 \
53+
python3.13=3.13.3-1ubuntu0.3 \
54+
python3.13-venv=3.13.3-1ubuntu0.3 \
5455
python3-pip=25.0+dfsg-1ubuntu0.1 \
5556
supervisor=4.2.5-3 && \
5657
# Install Azure CLI in venv with optimizations for scanning
@@ -75,12 +76,11 @@ RUN echo $TZ > /etc/timezone && \
7576
# Install yq (architecture-aware)
7677
RUN ARCH=$(uname -m) && \
7778
if [ "$ARCH" = "x86_64" ]; then ARCH="amd64"; elif [ "$ARCH" = "aarch64" ]; then ARCH="arm64"; fi && \
78-
curl -sL https://github.com/mikefarah/yq/releases/download/v4.47.1/yq_linux_${ARCH}.tar.gz | tar xz && \
79+
curl -sL https://github.com/mikefarah/yq/releases/download/v4.47.2/yq_linux_${ARCH}.tar.gz | tar xz && \
7980
mv yq_linux_${ARCH} /usr/bin/yq && \
8081
rm -rf /tmp/*
8182

8283
# Install Google Cloud SDK (architecture-aware)
83-
ENV CLOUDSDK_CONFIG=/usr/local/configs/gcloud
8484
RUN ARCH=$(uname -m) && \
8585
if [ "$ARCH" = "x86_64" ]; then \
8686
curl -sSL "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-532.0.0-linux-x86_64.tar.gz" -o google-cloud-sdk.tar.gz; \
@@ -95,7 +95,6 @@ RUN ARCH=$(uname -m) && \
9595
ENV PATH=$PATH:/google-cloud-sdk/bin
9696

9797
# Install AWS CLI (architecture-aware)
98-
ENV AWS_CONFIG_FILE=/usr/local/configs/aws
9998
RUN ARCH=$(uname -m) && \
10099
curl "https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}.zip" -o "awscliv2.zip" && \
101100
unzip awscliv2.zip && \
@@ -136,9 +135,10 @@ RUN mkdir -p \
136135
# User and config directories
137136
${HOME}/.config/worker \
138137
# Cloud SDK config directories
139-
${CLOUDSDK_CONFIG} \
140-
${AWS_CONFIG_FILE%/*} \
141-
${AZURE_CONFIG_DIR} && \
138+
${HOME}/.config/gcloud \
139+
${HOME}/.config/gcloud/credentials \
140+
${HOME}/.config/aws \
141+
${HOME}/.config/azure && \
142142
# Create and set permissions for environment files
143143
touch ${WORKER_CONFIG_DIR}/environment && \
144144
chown ${USER}:${USER} ${WORKER_CONFIG_DIR}/environment && \
@@ -168,13 +168,12 @@ RUN \
168168
${WORKER_LIB_DIR} \
169169
${WORKER_BIN_DIR} \
170170
${HOME} \
171-
${CLOUDSDK_CONFIG} \
172-
${AWS_CONFIG_FILE%/*} \
173-
${AZURE_CONFIG_DIR} \
174171
/opt/az && \
175172
# Set Azure CLI permissions
176173
chmod -R 755 /opt/az/bin && \
177-
chmod -R 700 ${AZURE_CONFIG_DIR} && \
174+
# Set cloud config directory permissions
175+
chmod -R 700 ${HOME}/.config/gcloud/credentials && \
176+
chmod -R 700 ${HOME}/.config/azure && \
178177
# Set directory permissions
179178
find ${WORKER_BASE_DIR} ${WORKER_CONFIG_DIR} ${WORKER_LIB_DIR} ${WORKER_BIN_DIR} -type d -exec chmod 755 {} + && \
180179
# Set base file permissions

docs/authorization.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,33 @@ The UDX Worker supports multiple cloud providers and services through environmen
66

77
## Supported Providers
88

9-
| Provider | Environment Variable | Description |
10-
|------------|---------------------|-------------|
11-
| Azure | `AZURE_CREDS` | Azure cloud credentials |
12-
| AWS | `AWS_CREDS` | Amazon Web Services credentials |
13-
| GCP | `GCP_CREDS` | Google Cloud Platform credentials |
14-
| Bitwarden | `BITWARDEN_CREDS` | Bitwarden secrets management credentials |
9+
| Provider | Environment Variable | Description |
10+
| --------- | -------------------- | ---------------------------------------- |
11+
| Azure | `AZURE_CREDS` | Azure cloud credentials |
12+
| AWS | `AWS_CREDS` | Amazon Web Services credentials |
13+
| GCP | `GCP_CREDS` | Google Cloud Platform credentials |
14+
| Bitwarden | `BITWARDEN_CREDS` | Bitwarden secrets management credentials |
1515

1616
## Credential Formats
1717

1818
Credentials can be provided in three formats:
1919

20-
| Format | Description | Use Case |
21-
|--------|-------------|----------|
22-
| JSON | Plain JSON string | Direct configuration |
23-
| Base64 | Base64-encoded JSON | Secure environment variables |
24-
| File Path | Path to JSON file | Local development |
20+
| Format | Description | Use Case |
21+
| --------- | ------------------- | ---------------------------- |
22+
| JSON | Plain JSON string | Direct configuration |
23+
| Base64 | Base64-encoded JSON | Secure environment variables |
24+
| File Path | Path to JSON file | Local development |
2525

2626
## Format Examples
2727

2828
### 1. JSON Format
2929

3030
```json
3131
{
32-
"client_id": "CLIENT_ID",
33-
"client_secret": "CLIENT_SECRET",
34-
"tenant_id": "TENANT_ID",
35-
"subscription_id": "SUBSCRIPTION_ID"
32+
"client_id": "CLIENT_ID",
33+
"client_secret": "CLIENT_SECRET",
34+
"tenant_id": "TENANT_ID",
35+
"subscription_id": "SUBSCRIPTION_ID"
3636
}
3737
```
3838

@@ -52,6 +52,7 @@ ewogICAgImNsaWVudF9pZCI6ICJDTElFTlRfSUQiLAogICAgImNsaWVudF9zZWNyZXQiOiAiQ0xJRU5U
5252
```
5353

5454
**Generate Base64 Format:**
55+
5556
```bash
5657
echo -n '{"client_id":"CLIENT_ID","client_secret":"CLIENT_SECRET","tenant_id":"TENANT_ID","subscription_id":"SUBSCRIPTION_ID"}' | base64
5758
```
@@ -71,4 +72,15 @@ AZURE_CREDS="/path/to/azure_credentials.json"
7172
}
7273
```
7374

74-
> **Note**: Always use absolute paths in production environments to avoid path resolution issues.
75+
> **Note**: Always use absolute paths in production environments to avoid path resolution issues.
76+
77+
## Credential Management
78+
79+
| Flag | Default | Description |
80+
| ---------------- | ------- | ------------------------------------------------------------------------- |
81+
| `ACTORS_CLEANUP` | `true` | Controls how cloud provider credentials are handled after authentication: |
82+
83+
- When `true` (default): All temporary credentials and login sessions are cleaned up after use, improving security by not leaving credentials on disk
84+
- When `false`: Credentials are preserved on disk for reuse (e.g., GCP credentials are stored at `$HOME/creds/gcp_creds.json` and `GOOGLE_APPLICATION_CREDENTIALS` is set)
85+
86+
This flag is particularly useful for long-running processes or development environments where frequent re-authentication would be inefficient.

lib/auth/gcp.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ gcp_authenticate() {
4343
# Use jq to create a valid JSON with the modified privateKey
4444
jq -n --arg clientEmail "$clientEmail" --arg privateKey "$privateKey" --arg projectId "$projectId" \
4545
'{client_email: $clientEmail, private_key: $privateKey, project_id: $projectId}' > "$temp_creds_file"
46+
47+
# Set GOOGLE_APPLICATION_CREDENTIALS only if ACTORS_CLEANUP is disabled
48+
if [ "$ACTORS_CLEANUP" = false ]; then
49+
if [ -f "$GCP_CREDS" ]; then
50+
# If GCP_CREDS is a file path and exists, use it directly
51+
export GOOGLE_APPLICATION_CREDENTIALS="$GCP_CREDS"
52+
else
53+
# Otherwise create and use a local copy
54+
mkdir -p "$HOME/creds"
55+
cat "$creds_json" > "$HOME/creds/gcp_creds.json"
56+
export GOOGLE_APPLICATION_CREDENTIALS="$HOME/creds/gcp_creds.json"
57+
fi
58+
fi
4659

4760
log_info "GCP Authentication" "Authenticating GCP service account..."
4861
if ! gcloud auth activate-service-account "$clientEmail" --key-file="$temp_creds_file" >/dev/null 2>&1; then

lib/cleanup.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ source "${WORKER_LIB_DIR}/worker_config.sh"
77
# shellcheck source=/dev/null
88
source "${WORKER_LIB_DIR}/utils.sh"
99

10-
# Enable actors cleanup by default
11-
ACTORS_CLEANUP=${ACTORS_CLEANUP:-true}
12-
1310
# Generic function to clean up authentication for any provider
1411
cleanup_provider() {
1512
local provider=$1

lib/cli/config.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ config_show() {
5252
esac
5353
i=$((i + 1))
5454
done
55-
56-
log_info "Config" "Current configuration:"
5755

5856
# Check if user config exists
5957
if [ ! -f "$USER_CONFIG" ] || [ ! -s "$USER_CONFIG" ]; then

lib/environment.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ configure_environment() {
3131
return 1
3232
fi
3333

34+
# Set default envs
35+
if [[ -z "${ACTORS_CLEANUP:-}" ]]; then
36+
export ACTORS_CLEANUP=true
37+
fi
38+
3439
# Extract and authenticate actors
3540
local actors
3641
actors=$(get_config_section "$resolved_config" "actors")

0 commit comments

Comments
 (0)