Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
581a835fb5 | ||
|
|
cf1a288161 | ||
|
|
2792fede48 |
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@@ -2,6 +2,16 @@ on: push
|
|||||||
name: Run acceptance tests
|
name: Run acceptance tests
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
unit-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm test
|
||||||
|
|
||||||
test-with-output-secrets:
|
test-with-output-secrets:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -29,7 +39,7 @@ jobs:
|
|||||||
if: ${{ matrix.auth == 'connect' }}
|
if: ${{ matrix.auth == 'connect' }}
|
||||||
uses: ./configure # 1password/load-secrets-action/configure@<version>
|
uses: ./configure # 1password/load-secrets-action/configure@<version>
|
||||||
with:
|
with:
|
||||||
connect-host: localhost:8080
|
connect-host: http://localhost:8080
|
||||||
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
|
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}
|
||||||
- name: Load secrets
|
- name: Load secrets
|
||||||
id: load_secrets
|
id: load_secrets
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Load secret
|
- name: Load secret
|
||||||
uses: 1password/load-secrets-action@v1
|
uses: 1password/load-secrets-action@v2
|
||||||
with:
|
with:
|
||||||
# Export loaded secrets as environment variables
|
# Export loaded secrets as environment variables
|
||||||
export-env: true
|
export-env: true
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ inputs:
|
|||||||
description: Export the secrets as environment variables
|
description: Export the secrets as environment variables
|
||||||
default: "true"
|
default: "true"
|
||||||
runs:
|
runs:
|
||||||
using: "node16"
|
using: "node20"
|
||||||
main: "dist/index.js"
|
main: "dist/index.js"
|
||||||
|
|||||||
@@ -11,7 +11,16 @@ const jestConfig = {
|
|||||||
testEnvironment: "node",
|
testEnvironment: "node",
|
||||||
testRegex: "(/__tests__/.*|(\\.|/)test)\\.ts",
|
testRegex: "(/__tests__/.*|(\\.|/)test)\\.ts",
|
||||||
transform: {
|
transform: {
|
||||||
".ts": ["ts-jest"],
|
".ts": [
|
||||||
|
"ts-jest",
|
||||||
|
{
|
||||||
|
// Note: We shouldn't need to include `isolatedModules` here because it's a deprecated config option in TS 5,
|
||||||
|
// but setting it to `true` fixes the `ESM syntax is not allowed in a CommonJS module when
|
||||||
|
// 'verbatimModuleSyntax' is enabled` error that we're seeing when running our Jest tests.
|
||||||
|
isolatedModules: true,
|
||||||
|
useESM: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
verbose: true,
|
verbose: true,
|
||||||
};
|
};
|
||||||
|
|||||||
3742
dist/index.js
vendored
3742
dist/index.js
vendored
File diff suppressed because one or more lines are too long
172
entrypoint.sh
172
entrypoint.sh
@@ -1,172 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# shellcheck disable=SC2046,SC2001,SC2086
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Pass User-Agent Inforomation to the 1Password CLI
|
|
||||||
export OP_INTEGRATION_NAME="1Password GitHub Action"
|
|
||||||
export OP_INTEGRATION_ID="GHA"
|
|
||||||
export OP_INTEGRATION_BUILDNUMBER="1010001"
|
|
||||||
|
|
||||||
readonly CONNECT="CONNECT"
|
|
||||||
readonly SERVICE_ACCOUNT="SERVICE_ACCOUNT"
|
|
||||||
|
|
||||||
auth_type=$CONNECT
|
|
||||||
managed_variables_var="OP_MANAGED_VARIABLES"
|
|
||||||
IFS=','
|
|
||||||
|
|
||||||
if [[ "$OP_CONNECT_HOST" != "http://"* ]] && [[ "$OP_CONNECT_HOST" != "https://"* ]]; then
|
|
||||||
export OP_CONNECT_HOST="http://"$OP_CONNECT_HOST
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Unset all secrets managed by 1Password if `unset-previous` is set.
|
|
||||||
unset_prev_secrets() {
|
|
||||||
if [ "$INPUT_UNSET_PREVIOUS" == "true" ]; then
|
|
||||||
echo "Unsetting previous values..."
|
|
||||||
|
|
||||||
# Find environment variables that are managed by 1Password.
|
|
||||||
for env_var in "${managed_variables[@]}"; do
|
|
||||||
echo "Unsetting $env_var"
|
|
||||||
unset $env_var
|
|
||||||
|
|
||||||
echo "$env_var=" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Keep the masks, just in case.
|
|
||||||
done
|
|
||||||
|
|
||||||
managed_variables=()
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Install op-cli
|
|
||||||
install_op_cli() {
|
|
||||||
# Create a temporary directory where the CLI is installed
|
|
||||||
OP_INSTALL_DIR="$(mktemp -d)"
|
|
||||||
if [[ ! -d "$OP_INSTALL_DIR" ]]; then
|
|
||||||
echo "Install dir $OP_INSTALL_DIR not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
export OP_INSTALL_DIR
|
|
||||||
echo "::debug::OP_INSTALL_DIR: ${OP_INSTALL_DIR}"
|
|
||||||
|
|
||||||
# Get the latest stable version of the CLI
|
|
||||||
OP_CLI_VERSION="v$(curl https://app-updates.agilebits.com/check/1/0/CLI2/en/2.0.0/N -s | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')"
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
||||||
# Get runner's architecture
|
|
||||||
ARCH=$(uname -m)
|
|
||||||
if [[ "$(getconf LONG_BIT)" = 32 ]]; then
|
|
||||||
ARCH="386"
|
|
||||||
elif [[ "$ARCH" == "x86_64" ]]; then
|
|
||||||
ARCH="amd64"
|
|
||||||
elif [[ "$ARCH" == "aarch64" ]]; then
|
|
||||||
ARCH="arm64"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$ARCH" != "386" ]] && [[ "$ARCH" != "amd64" ]] && [[ "$ARCH" != "arm" ]] && [[ "$ARCH" != "arm64" ]]; then
|
|
||||||
echo "Unsupported architecture for the 1Password CLI: $ARCH."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
curl -sSfLo op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/${OP_CLI_VERSION}/op_linux_${ARCH}_${OP_CLI_VERSION}.zip"
|
|
||||||
unzip -od "$OP_INSTALL_DIR" op.zip && rm op.zip
|
|
||||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
curl -sSfLo op.pkg "https://cache.agilebits.com/dist/1P/op2/pkg/${OP_CLI_VERSION}/op_apple_universal_${OP_CLI_VERSION}.pkg"
|
|
||||||
pkgutil --expand op.pkg temp-pkg
|
|
||||||
tar -xvf temp-pkg/op.pkg/Payload -C "$OP_INSTALL_DIR"
|
|
||||||
rm -rf temp-pkg && rm op.pkg
|
|
||||||
else
|
|
||||||
echo "Operating system not supported yet for this GitHub Action: $OSTYPE."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Uninstall op-cli
|
|
||||||
uninstall_op_cli() {
|
|
||||||
if [[ -d "$OP_INSTALL_DIR" ]]; then
|
|
||||||
rm -fr "$OP_INSTALL_DIR"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
populating_secret() {
|
|
||||||
ref=$(printenv $1)
|
|
||||||
|
|
||||||
echo "Populating variable: $1"
|
|
||||||
secret_value=$("${OP_INSTALL_DIR}/op" read "$ref")
|
|
||||||
|
|
||||||
if [ -z "$secret_value" ]; then
|
|
||||||
echo "Could not find or access secret $ref"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Register a mask for the secret to prevent accidental log exposure.
|
|
||||||
# To support multiline secrets, escape percent signs and add a mask per line.
|
|
||||||
escaped_mask_value=$(echo "$secret_value" | sed -e 's/%/%25/g')
|
|
||||||
IFS=$'\n'
|
|
||||||
for line in $escaped_mask_value; do
|
|
||||||
if [ "${#line}" -lt 3 ]; then
|
|
||||||
# To avoid false positives and unreadable logs, omit mask for lines that are too short.
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
echo "::add-mask::$line"
|
|
||||||
done
|
|
||||||
unset IFS
|
|
||||||
|
|
||||||
# To support multiline secrets, we'll use the heredoc syntax to populate the environment variables.
|
|
||||||
# As the heredoc identifier, we'll use a randomly generated 64-character string,
|
|
||||||
# so that collisions are practically impossible.
|
|
||||||
# Read more: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
|
|
||||||
delimiter="$(openssl rand -hex 32)"
|
|
||||||
|
|
||||||
if [ "$INPUT_EXPORT_ENV" == "true" ]; then
|
|
||||||
{
|
|
||||||
# Populate env var, using heredoc syntax with generated identifier
|
|
||||||
echo "$env_var<<${delimiter}"
|
|
||||||
echo "$secret_value"
|
|
||||||
echo "${delimiter}"
|
|
||||||
} >> $GITHUB_ENV
|
|
||||||
echo "GITHUB_ENV: $(cat $GITHUB_ENV)"
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Populate env var, using heredoc syntax with generated identifier
|
|
||||||
echo "$env_var<<${delimiter}"
|
|
||||||
echo "$secret_value"
|
|
||||||
echo "${delimiter}"
|
|
||||||
} >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
managed_variables+=("$env_var")
|
|
||||||
}
|
|
||||||
|
|
||||||
# Load environment variables using op cli. Iterate over them to find 1Password references, load the secret values,
|
|
||||||
# and make them available as environment variables in the next steps.
|
|
||||||
extract_secrets() {
|
|
||||||
IFS=$'\n'
|
|
||||||
for env_var in $("${OP_INSTALL_DIR}/op" env ls); do
|
|
||||||
populating_secret $env_var
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
read -r -a managed_variables <<< "$(printenv $managed_variables_var)"
|
|
||||||
|
|
||||||
if [ -z "$OP_CONNECT_TOKEN" ] || [ -z "$OP_CONNECT_HOST" ]; then
|
|
||||||
if [ -z "$OP_SERVICE_ACCOUNT_TOKEN" ]; then
|
|
||||||
echo "(\$OP_CONNECT_TOKEN and \$OP_CONNECT_HOST) or \$OP_SERVICE_ACCOUNT_TOKEN must be set"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
auth_type=$SERVICE_ACCOUNT
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "Authenticated with %s \n" $auth_type
|
|
||||||
|
|
||||||
unset_prev_secrets
|
|
||||||
install_op_cli
|
|
||||||
extract_secrets
|
|
||||||
uninstall_op_cli
|
|
||||||
|
|
||||||
unset IFS
|
|
||||||
# Add extra env var that lists which secrets are managed by 1Password so that in a later step
|
|
||||||
# these can be unset again.
|
|
||||||
managed_variables_str=$(IFS=','; echo "${managed_variables[*]}")
|
|
||||||
echo "$managed_variables_var=$managed_variables_str" >> $GITHUB_ENV
|
|
||||||
46
install_cli.sh
Executable file
46
install_cli.sh
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Install op-cli
|
||||||
|
install_op_cli() {
|
||||||
|
# Create a temporary directory where the CLI is installed
|
||||||
|
OP_INSTALL_DIR="$(mktemp -d)"
|
||||||
|
if [[ ! -d "$OP_INSTALL_DIR" ]]; then
|
||||||
|
echo "Install dir $OP_INSTALL_DIR not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "::debug::OP_INSTALL_DIR: ${OP_INSTALL_DIR}"
|
||||||
|
|
||||||
|
# Get the latest stable version of the CLI
|
||||||
|
CLI_VERSION="v$(curl https://app-updates.agilebits.com/check/1/0/CLI2/en/2.0.0/N -s | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')"
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
# Get runner's architecture
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
if [[ "$(getconf LONG_BIT)" = 32 ]]; then
|
||||||
|
ARCH="386"
|
||||||
|
elif [[ "$ARCH" == "x86_64" ]]; then
|
||||||
|
ARCH="amd64"
|
||||||
|
elif [[ "$ARCH" == "aarch64" ]]; then
|
||||||
|
ARCH="arm64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$ARCH" != "386" ]] && [[ "$ARCH" != "amd64" ]] && [[ "$ARCH" != "arm" ]] && [[ "$ARCH" != "arm64" ]]; then
|
||||||
|
echo "Unsupported architecture for the 1Password CLI: $ARCH."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -sSfLo op.zip "https://cache.agilebits.com/dist/1P/op2/pkg/${CLI_VERSION}/op_linux_${ARCH}_${CLI_VERSION}.zip"
|
||||||
|
unzip -od "$OP_INSTALL_DIR" op.zip && rm op.zip
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
curl -sSfLo op.pkg "https://cache.agilebits.com/dist/1P/op2/pkg/${CLI_VERSION}/op_apple_universal_${CLI_VERSION}.pkg"
|
||||||
|
pkgutil --expand op.pkg temp-pkg
|
||||||
|
tar -xvf temp-pkg/op.pkg/Payload -C "$OP_INSTALL_DIR"
|
||||||
|
rm -rf temp-pkg && rm op.pkg
|
||||||
|
else
|
||||||
|
echo "Operating system not supported yet for this GitHub Action: $OSTYPE."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_op_cli
|
||||||
364
package-lock.json
generated
364
package-lock.json
generated
@@ -1,27 +1,28 @@
|
|||||||
{
|
{
|
||||||
"name": "load-secrets-action",
|
"name": "load-secrets-action",
|
||||||
"version": "1.2.0",
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "load-secrets-action",
|
"name": "load-secrets-action",
|
||||||
"version": "1.2.0",
|
"version": "2.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@1password/op-js": "^0.1.11",
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1"
|
"@actions/exec": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@1password/front-end-style": "^6.0.1",
|
"@1password/front-end-style": "^6.0.1",
|
||||||
"@types/jest": "^29.5.6",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/node": "^18.18.6",
|
"@types/node": "^20.11.30",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"husky": "^8.0.3",
|
"husky": "^9.0.11",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"lint-staged": "^13.3.0",
|
"lint-staged": "^15.2.2",
|
||||||
"ts-jest": "^29.1.1",
|
"ts-jest": "^29.1.2",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^5.4.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@1password/front-end-style": {
|
"node_modules/@1password/front-end-style": {
|
||||||
@@ -57,6 +58,15 @@
|
|||||||
"typescript": ">=4.0.3"
|
"typescript": ">=4.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@1password/op-js": {
|
||||||
|
"version": "0.1.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@1password/op-js/-/op-js-0.1.11.tgz",
|
||||||
|
"integrity": "sha512-ZT4B3zYfYz7tz3fol+qAhWYgheUzG9i9OoJq4UcXsKL/8bxtwyt+IrcRcRd3wsyo+MgnsMXQMPOzqYDUNW+S2Q==",
|
||||||
|
"dependencies": {
|
||||||
|
"lookpath": "^1.2.2",
|
||||||
|
"semver": "^7.3.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
"version": "1.2.6",
|
"version": "1.2.6",
|
||||||
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
|
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
|
||||||
@@ -1581,9 +1591,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/jest": {
|
"node_modules/@types/jest": {
|
||||||
"version": "29.5.6",
|
"version": "29.5.12",
|
||||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz",
|
||||||
"integrity": "sha512-/t9NnzkOpXb4Nfvg17ieHE6EeSjDS2SGSpNYfoLbUAeL/EOueU/RSdOWFpfQTXBEM7BguYW1XQ0EbM+6RlIh6w==",
|
"integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"expect": "^29.0.0",
|
"expect": "^29.0.0",
|
||||||
@@ -1609,10 +1619,13 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "18.18.6",
|
"version": "20.11.30",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz",
|
||||||
"integrity": "sha512-wf3Vz+jCmOQ2HV1YUJuCWdL64adYxumkrxtc+H1VUQlnQI04+5HtH+qZCOE21lBE7gIrt+CwX2Wv8Acrw5Ak6w==",
|
"integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~5.26.4"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/normalize-package-data": {
|
"node_modules/@types/normalize-package-data": {
|
||||||
"version": "2.4.3",
|
"version": "2.4.3",
|
||||||
@@ -1939,9 +1952,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vercel/ncc": {
|
"node_modules/@vercel/ncc": {
|
||||||
"version": "0.36.1",
|
"version": "0.38.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz",
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz",
|
||||||
"integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==",
|
"integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"ncc": "dist/ncc/cli.js"
|
"ncc": "dist/ncc/cli.js"
|
||||||
@@ -2581,16 +2594,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cli-truncate": {
|
"node_modules/cli-truncate": {
|
||||||
"version": "3.1.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz",
|
||||||
"integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==",
|
"integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"slice-ansi": "^5.0.0",
|
"slice-ansi": "^5.0.0",
|
||||||
"string-width": "^5.0.0"
|
"string-width": "^7.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
@@ -2703,9 +2716,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/commander": {
|
"node_modules/commander": {
|
||||||
"version": "11.0.0",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
|
||||||
"integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==",
|
"integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16"
|
"node": ">=16"
|
||||||
@@ -2966,12 +2979,6 @@
|
|||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eastasianwidth": {
|
|
||||||
"version": "0.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
|
||||||
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.4.565",
|
"version": "1.4.565",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.565.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.565.tgz",
|
||||||
@@ -2991,9 +2998,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/emoji-regex": {
|
"node_modules/emoji-regex": {
|
||||||
"version": "9.2.2",
|
"version": "10.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz",
|
||||||
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
|
"integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/enquirer": {
|
"node_modules/enquirer": {
|
||||||
@@ -3983,6 +3990,18 @@
|
|||||||
"node": "6.* || 8.* || >= 10.*"
|
"node": "6.* || 8.* || >= 10.*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/get-east-asian-width": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/get-intrinsic": {
|
"node_modules/get-intrinsic": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz",
|
||||||
@@ -4312,15 +4331,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/husky": {
|
"node_modules/husky": {
|
||||||
"version": "8.0.3",
|
"version": "9.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz",
|
||||||
"integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==",
|
"integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"husky": "lib/bin.js"
|
"husky": "bin.mjs"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/typicode"
|
"url": "https://github.com/sponsors/typicode"
|
||||||
@@ -5717,12 +5736,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lilconfig": {
|
"node_modules/lilconfig": {
|
||||||
"version": "2.1.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.0.0.tgz",
|
||||||
"integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==",
|
"integrity": "sha512-K2U4W2Ff5ibV7j7ydLr+zLAkIg5JJ4lPn1Ltsdt+Tz/IjQ8buJ55pZAxoP34lqIiwtF9iAvtLv3JGv7CAyAg+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lines-and-columns": {
|
"node_modules/lines-and-columns": {
|
||||||
@@ -5732,27 +5751,27 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/lint-staged": {
|
"node_modules/lint-staged": {
|
||||||
"version": "13.3.0",
|
"version": "15.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.2.tgz",
|
||||||
"integrity": "sha512-mPRtrYnipYYv1FEE134ufbWpeggNTo+O/UPzngoaKzbzHAthvR55am+8GfHTnqNRQVRRrYQLGW9ZyUoD7DsBHQ==",
|
"integrity": "sha512-TiTt93OPh1OZOsb5B7k96A/ATl2AjIZo+vnzFZ6oHK5FuTk63ByDtxGQpHm+kFETjEWqgkF95M8FRXKR/LEBcw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "5.3.0",
|
"chalk": "5.3.0",
|
||||||
"commander": "11.0.0",
|
"commander": "11.1.0",
|
||||||
"debug": "4.3.4",
|
"debug": "4.3.4",
|
||||||
"execa": "7.2.0",
|
"execa": "8.0.1",
|
||||||
"lilconfig": "2.1.0",
|
"lilconfig": "3.0.0",
|
||||||
"listr2": "6.6.1",
|
"listr2": "8.0.1",
|
||||||
"micromatch": "4.0.5",
|
"micromatch": "4.0.5",
|
||||||
"pidtree": "0.6.0",
|
"pidtree": "0.6.0",
|
||||||
"string-argv": "0.3.2",
|
"string-argv": "0.3.2",
|
||||||
"yaml": "2.3.1"
|
"yaml": "2.3.4"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"lint-staged": "bin/lint-staged.js"
|
"lint-staged": "bin/lint-staged.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^16.14.0 || >=18.0.0"
|
"node": ">=18.12.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://opencollective.com/lint-staged"
|
"url": "https://opencollective.com/lint-staged"
|
||||||
@@ -5771,35 +5790,47 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lint-staged/node_modules/execa": {
|
"node_modules/lint-staged/node_modules/execa": {
|
||||||
"version": "7.2.0",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz",
|
||||||
"integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==",
|
"integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
"get-stream": "^6.0.1",
|
"get-stream": "^8.0.1",
|
||||||
"human-signals": "^4.3.0",
|
"human-signals": "^5.0.0",
|
||||||
"is-stream": "^3.0.0",
|
"is-stream": "^3.0.0",
|
||||||
"merge-stream": "^2.0.0",
|
"merge-stream": "^2.0.0",
|
||||||
"npm-run-path": "^5.1.0",
|
"npm-run-path": "^5.1.0",
|
||||||
"onetime": "^6.0.0",
|
"onetime": "^6.0.0",
|
||||||
"signal-exit": "^3.0.7",
|
"signal-exit": "^4.1.0",
|
||||||
"strip-final-newline": "^3.0.0"
|
"strip-final-newline": "^3.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.18.0 || ^16.14.0 || >=18.0.0"
|
"node": ">=16.17"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lint-staged/node_modules/human-signals": {
|
"node_modules/lint-staged/node_modules/get-stream": {
|
||||||
"version": "4.3.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",
|
||||||
"integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==",
|
"integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.18.0"
|
"node": ">=16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/lint-staged/node_modules/human-signals": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.17.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lint-staged/node_modules/is-stream": {
|
"node_modules/lint-staged/node_modules/is-stream": {
|
||||||
@@ -5827,9 +5858,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lint-staged/node_modules/npm-run-path": {
|
"node_modules/lint-staged/node_modules/npm-run-path": {
|
||||||
"version": "5.1.0",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.2.0.tgz",
|
||||||
"integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==",
|
"integrity": "sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"path-key": "^4.0.0"
|
"path-key": "^4.0.0"
|
||||||
@@ -5868,6 +5899,18 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lint-staged/node_modules/signal-exit": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lint-staged/node_modules/strip-final-newline": {
|
"node_modules/lint-staged/node_modules/strip-final-newline": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
|
||||||
@@ -5881,28 +5924,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/listr2": {
|
"node_modules/listr2": {
|
||||||
"version": "6.6.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/listr2/-/listr2-6.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/listr2/-/listr2-8.0.1.tgz",
|
||||||
"integrity": "sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==",
|
"integrity": "sha512-ovJXBXkKGfq+CwmKTjluEqFi3p4h8xvkxGQQAQan22YCgef4KZ1mKGjzfGh6PL6AW5Csw0QiQPNuQyH+6Xk3hA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cli-truncate": "^3.1.0",
|
"cli-truncate": "^4.0.0",
|
||||||
"colorette": "^2.0.20",
|
"colorette": "^2.0.20",
|
||||||
"eventemitter3": "^5.0.1",
|
"eventemitter3": "^5.0.1",
|
||||||
"log-update": "^5.0.1",
|
"log-update": "^6.0.0",
|
||||||
"rfdc": "^1.3.0",
|
"rfdc": "^1.3.0",
|
||||||
"wrap-ansi": "^8.1.0"
|
"wrap-ansi": "^9.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.0.0"
|
"node": ">=18.0.0"
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"enquirer": ">= 2.3.0 < 3"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"enquirer": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/locate-path": {
|
"node_modules/locate-path": {
|
||||||
@@ -5954,34 +5989,34 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/log-update": {
|
"node_modules/log-update": {
|
||||||
"version": "5.0.1",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/log-update/-/log-update-6.0.0.tgz",
|
||||||
"integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==",
|
"integrity": "sha512-niTvB4gqvtof056rRIrTZvjNYE4rCUzO6X/X+kYjd7WFxXeJ0NwEFnRxX6ehkvv3jTwrXnNdtAak5XYZuIyPFw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-escapes": "^5.0.0",
|
"ansi-escapes": "^6.2.0",
|
||||||
"cli-cursor": "^4.0.0",
|
"cli-cursor": "^4.0.0",
|
||||||
"slice-ansi": "^5.0.0",
|
"slice-ansi": "^7.0.0",
|
||||||
"strip-ansi": "^7.0.1",
|
"strip-ansi": "^7.1.0",
|
||||||
"wrap-ansi": "^8.0.1"
|
"wrap-ansi": "^9.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/log-update/node_modules/ansi-escapes": {
|
"node_modules/log-update/node_modules/ansi-escapes": {
|
||||||
"version": "5.0.0",
|
"version": "6.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-6.2.0.tgz",
|
||||||
"integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==",
|
"integrity": "sha512-kzRaCqXnpzWs+3z5ABPQiVke+iq0KXkHo8xiWV4RPTi5Yli0l97BEQuhXV1s7+aSU/fu1kUuxgS4MsQ0fRuygw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"type-fest": "^1.0.2"
|
"type-fest": "^3.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=14.16"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
@@ -5999,6 +6034,49 @@
|
|||||||
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/log-update/node_modules/ansi-styles": {
|
||||||
|
"version": "6.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
||||||
|
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/log-update/node_modules/is-fullwidth-code-point": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"get-east-asian-width": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/log-update/node_modules/slice-ansi": {
|
||||||
|
"version": "7.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz",
|
||||||
|
"integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^6.2.1",
|
||||||
|
"is-fullwidth-code-point": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/slice-ansi?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/log-update/node_modules/strip-ansi": {
|
"node_modules/log-update/node_modules/strip-ansi": {
|
||||||
"version": "7.1.0",
|
"version": "7.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
|
||||||
@@ -6015,17 +6093,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/log-update/node_modules/type-fest": {
|
"node_modules/log-update/node_modules/type-fest": {
|
||||||
"version": "1.4.0",
|
"version": "3.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz",
|
||||||
"integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==",
|
"integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=14.16"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/lookpath": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/lookpath/-/lookpath-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-k2Gmn8iV6qdME3ztZC2spubmQISimFOPLuQKiPaLcVdRz0IpdxrNClVepMlyTJlhodm/zG/VfbkWERm3kUIh+Q==",
|
||||||
|
"bin": {
|
||||||
|
"lookpath": "bin/lookpath.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"npm": ">=6.13.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/loose-envify": {
|
"node_modules/loose-envify": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
|
||||||
@@ -7179,9 +7268,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rfdc": {
|
"node_modules/rfdc": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz",
|
||||||
"integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==",
|
"integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/rimraf": {
|
"node_modules/rimraf": {
|
||||||
@@ -7267,7 +7356,6 @@
|
|||||||
"version": "7.5.4",
|
"version": "7.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
},
|
},
|
||||||
@@ -7282,7 +7370,6 @@
|
|||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"yallist": "^4.0.0"
|
"yallist": "^4.0.0"
|
||||||
},
|
},
|
||||||
@@ -7293,8 +7380,7 @@
|
|||||||
"node_modules/semver/node_modules/yallist": {
|
"node_modules/semver/node_modules/yallist": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/set-function-length": {
|
"node_modules/set-function-length": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
@@ -7519,17 +7605,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string-width": {
|
"node_modules/string-width": {
|
||||||
"version": "5.1.2",
|
"version": "7.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.1.0.tgz",
|
||||||
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
|
"integrity": "sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"eastasianwidth": "^0.2.0",
|
"emoji-regex": "^10.3.0",
|
||||||
"emoji-regex": "^9.2.2",
|
"get-east-asian-width": "^1.0.0",
|
||||||
"strip-ansi": "^7.0.1"
|
"strip-ansi": "^7.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
@@ -7986,9 +8072,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ts-jest": {
|
"node_modules/ts-jest": {
|
||||||
"version": "29.1.1",
|
"version": "29.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz",
|
||||||
"integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==",
|
"integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bs-logger": "0.x",
|
"bs-logger": "0.x",
|
||||||
@@ -8004,7 +8090,7 @@
|
|||||||
"ts-jest": "cli.js"
|
"ts-jest": "cli.js"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
"node": "^16.10.0 || ^18.0.0 || >=20.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": ">=7.0.0-beta.0 <8",
|
"@babel/core": ">=7.0.0-beta.0 <8",
|
||||||
@@ -8204,16 +8290,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.9.5",
|
"version": "5.4.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz",
|
||||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
"integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.2.0"
|
"node": ">=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/unbox-primitive": {
|
"node_modules/unbox-primitive": {
|
||||||
@@ -8232,9 +8318,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "5.26.5",
|
"version": "5.28.3",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.26.5.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz",
|
||||||
"integrity": "sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==",
|
"integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/busboy": "^2.0.0"
|
"@fastify/busboy": "^2.0.0"
|
||||||
},
|
},
|
||||||
@@ -8242,6 +8328,12 @@
|
|||||||
"node": ">=14.0"
|
"node": ">=14.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "5.26.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||||
|
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.0.13",
|
"version": "1.0.13",
|
||||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
|
||||||
@@ -8426,17 +8518,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/wrap-ansi": {
|
"node_modules/wrap-ansi": {
|
||||||
"version": "8.1.0",
|
"version": "9.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz",
|
||||||
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
|
"integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-styles": "^6.1.0",
|
"ansi-styles": "^6.2.1",
|
||||||
"string-width": "^5.0.1",
|
"string-width": "^7.0.0",
|
||||||
"strip-ansi": "^7.0.1"
|
"strip-ansi": "^7.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
@@ -8516,9 +8608,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/yaml": {
|
"node_modules/yaml": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz",
|
||||||
"integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==",
|
"integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 14"
|
"node": ">= 14"
|
||||||
|
|||||||
17
package.json
17
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "load-secrets-action",
|
"name": "load-secrets-action",
|
||||||
"version": "1.2.0",
|
"version": "2.0.0",
|
||||||
"description": "Load Secrets from 1Password",
|
"description": "Load Secrets from 1Password",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@@ -39,19 +39,20 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/1Password/load-secrets-action#readme",
|
"homepage": "https://github.com/1Password/load-secrets-action#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@1password/op-js": "^0.1.11",
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1"
|
"@actions/exec": "^1.1.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@1password/front-end-style": "^6.0.1",
|
"@1password/front-end-style": "^6.0.1",
|
||||||
"@types/jest": "^29.5.6",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/node": "^18.18.6",
|
"@types/node": "^20.11.30",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"husky": "^8.0.3",
|
"husky": "^9.0.11",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"lint-staged": "^13.3.0",
|
"lint-staged": "^15.2.2",
|
||||||
"ts-jest": "^29.1.1",
|
"ts-jest": "^29.1.2",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^5.4.2"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "./node_modules/@1password/front-end-style/eslintrc.yml",
|
"extends": "./node_modules/@1password/front-end-style/eslintrc.yml",
|
||||||
|
|||||||
6
src/constants.ts
Normal file
6
src/constants.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
export const envConnectHost = "OP_CONNECT_HOST";
|
||||||
|
export const envConnectToken = "OP_CONNECT_TOKEN";
|
||||||
|
export const envServiceAccountToken = "OP_SERVICE_ACCOUNT_TOKEN";
|
||||||
|
export const envManagedVariables = "OP_MANAGED_VARIABLES";
|
||||||
|
|
||||||
|
export const authErr = `Authentication error with environment variables: you must set either 1) ${envServiceAccountToken}, or 2) both ${envConnectHost} and ${envConnectToken}.`;
|
||||||
55
src/index.ts
55
src/index.ts
@@ -2,19 +2,28 @@ import path from "path";
|
|||||||
import url from "url";
|
import url from "url";
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import * as exec from "@actions/exec";
|
import * as exec from "@actions/exec";
|
||||||
|
import { validateCli } from "@1password/op-js";
|
||||||
|
import { loadSecrets, unsetPrevious, validateAuth } from "./utils";
|
||||||
|
|
||||||
const run = async () => {
|
const loadSecretsAction = async () => {
|
||||||
try {
|
try {
|
||||||
const currentFile = url.fileURLToPath(import.meta.url);
|
|
||||||
const currentDir = path.dirname(currentFile);
|
|
||||||
const parentDir = path.resolve(currentDir, "..");
|
|
||||||
|
|
||||||
// Get action inputs
|
// Get action inputs
|
||||||
process.env.INPUT_UNSET_PREVIOUS = core.getInput("unset-previous");
|
const shouldUnsetPrevious = core.getBooleanInput("unset-previous");
|
||||||
process.env.INPUT_EXPORT_ENV = core.getInput("export-env");
|
const shouldExportEnv = core.getBooleanInput("export-env");
|
||||||
|
|
||||||
// Execute bash script
|
// Unset all secrets managed by 1Password if `unset-previous` is set.
|
||||||
await exec.exec(`sh -c "` + parentDir + `/entrypoint.sh"`);
|
if (shouldUnsetPrevious) {
|
||||||
|
unsetPrevious();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate that a proper authentication configuration is set for the CLI
|
||||||
|
validateAuth();
|
||||||
|
|
||||||
|
// Download and install the CLI
|
||||||
|
await installCLI();
|
||||||
|
|
||||||
|
// Load secrets
|
||||||
|
await loadSecrets(shouldExportEnv);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// It's possible for the Error constructor to be modified to be anything
|
// It's possible for the Error constructor to be modified to be anything
|
||||||
// in JavaScript, so the following code accounts for this possibility.
|
// in JavaScript, so the following code accounts for this possibility.
|
||||||
@@ -29,4 +38,30 @@ const run = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void run();
|
// This function's name is an exception from the naming convention
|
||||||
|
// since we refer to the 1Password CLI here.
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
const installCLI = async (): Promise<void> => {
|
||||||
|
// validateCli checks if there's an existing 1Password CLI installed on the runner.
|
||||||
|
// If there's no CLI installed, then validateCli will throw an error, which we will use
|
||||||
|
// as an indicator that we need to execute the installation script.
|
||||||
|
await validateCli().catch(async () => {
|
||||||
|
const currentFile = url.fileURLToPath(import.meta.url);
|
||||||
|
const currentDir = path.dirname(currentFile);
|
||||||
|
const parentDir = path.resolve(currentDir, "..");
|
||||||
|
|
||||||
|
// Execute bash script
|
||||||
|
const cmdOut = await exec.getExecOutput(
|
||||||
|
`sh -c "` + parentDir + `/install_cli.sh"`,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add path to 1Password CLI to $PATH
|
||||||
|
const outArr = cmdOut.stdout.split("\n");
|
||||||
|
if (outArr[0] && process.env.PATH) {
|
||||||
|
const cliPath = outArr[0]?.replace(/^(::debug::OP_INSTALL_DIR: )/, "");
|
||||||
|
core.addPath(cliPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
void loadSecretsAction();
|
||||||
|
|||||||
164
src/utils.test.ts
Normal file
164
src/utils.test.ts
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
|
import * as exec from "@actions/exec";
|
||||||
|
import { read, setClientInfo } from "@1password/op-js";
|
||||||
|
import {
|
||||||
|
extractSecret,
|
||||||
|
loadSecrets,
|
||||||
|
unsetPrevious,
|
||||||
|
validateAuth,
|
||||||
|
} from "./utils";
|
||||||
|
import {
|
||||||
|
authErr,
|
||||||
|
envConnectHost,
|
||||||
|
envConnectToken,
|
||||||
|
envManagedVariables,
|
||||||
|
envServiceAccountToken,
|
||||||
|
} from "./constants";
|
||||||
|
|
||||||
|
jest.mock("@actions/core");
|
||||||
|
jest.mock("@actions/exec", () => ({
|
||||||
|
getExecOutput: jest.fn(() => ({
|
||||||
|
stdout: "MOCK_SECRET",
|
||||||
|
})),
|
||||||
|
}));
|
||||||
|
jest.mock("@1password/op-js");
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("validateAuth", () => {
|
||||||
|
const testConnectHost = "https://localhost:8000";
|
||||||
|
const testConnectToken = "token";
|
||||||
|
const testServiceAccountToken = "ops_token";
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
process.env[envConnectHost] = "";
|
||||||
|
process.env[envConnectToken] = "";
|
||||||
|
process.env[envServiceAccountToken] = "";
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should throw an error when no config is provided", () => {
|
||||||
|
expect(validateAuth).toThrowError(authErr);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should throw an error when partial Connect config is provided", () => {
|
||||||
|
process.env[envConnectHost] = testConnectHost;
|
||||||
|
expect(validateAuth).toThrowError(authErr);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should be authenticated as a Connect client", () => {
|
||||||
|
process.env[envConnectHost] = testConnectHost;
|
||||||
|
process.env[envConnectToken] = testConnectToken;
|
||||||
|
expect(validateAuth).not.toThrowError(authErr);
|
||||||
|
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should be authenticated as a service account", () => {
|
||||||
|
process.env[envServiceAccountToken] = testServiceAccountToken;
|
||||||
|
expect(validateAuth).not.toThrowError(authErr);
|
||||||
|
expect(core.info).toHaveBeenCalledWith(
|
||||||
|
"Authenticated with Service account.",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should prioritize Connect over service account if both are configured", () => {
|
||||||
|
process.env[envServiceAccountToken] = testServiceAccountToken;
|
||||||
|
process.env[envConnectHost] = testConnectHost;
|
||||||
|
process.env[envConnectToken] = testConnectToken;
|
||||||
|
expect(validateAuth).not.toThrowError(authErr);
|
||||||
|
expect(core.warning).toHaveBeenCalled();
|
||||||
|
expect(core.info).toHaveBeenCalledWith("Authenticated with Connect.");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("extractSecret", () => {
|
||||||
|
const envTestSecretEnv = "TEST_SECRET";
|
||||||
|
const testSecretRef = "op://vault/item/secret";
|
||||||
|
const testSecretValue = "Secret1@3$";
|
||||||
|
|
||||||
|
read.parse = jest.fn().mockReturnValue(testSecretValue);
|
||||||
|
|
||||||
|
process.env[envTestSecretEnv] = testSecretRef;
|
||||||
|
|
||||||
|
it("should set secret as step output", () => {
|
||||||
|
extractSecret(envTestSecretEnv, false);
|
||||||
|
expect(core.exportVariable).not.toHaveBeenCalledWith(
|
||||||
|
envTestSecretEnv,
|
||||||
|
testSecretValue,
|
||||||
|
);
|
||||||
|
expect(core.setOutput).toHaveBeenCalledWith(
|
||||||
|
envTestSecretEnv,
|
||||||
|
testSecretValue,
|
||||||
|
);
|
||||||
|
expect(core.setSecret).toHaveBeenCalledWith(testSecretValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should set secret as environment variable", () => {
|
||||||
|
extractSecret(envTestSecretEnv, true);
|
||||||
|
expect(core.exportVariable).toHaveBeenCalledWith(
|
||||||
|
envTestSecretEnv,
|
||||||
|
testSecretValue,
|
||||||
|
);
|
||||||
|
expect(core.setOutput).not.toHaveBeenCalledWith(
|
||||||
|
envTestSecretEnv,
|
||||||
|
testSecretValue,
|
||||||
|
);
|
||||||
|
expect(core.setSecret).toHaveBeenCalledWith(testSecretValue);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("loadSecrets", () => {
|
||||||
|
it("sets the client info and gets the executed output", async () => {
|
||||||
|
await loadSecrets(true);
|
||||||
|
|
||||||
|
expect(setClientInfo).toHaveBeenCalledWith({
|
||||||
|
name: "1Password GitHub Action",
|
||||||
|
id: "GHA",
|
||||||
|
});
|
||||||
|
expect(exec.getExecOutput).toHaveBeenCalledWith('sh -c "op env ls"');
|
||||||
|
expect(core.exportVariable).toHaveBeenCalledWith(
|
||||||
|
"OP_MANAGED_VARIABLES",
|
||||||
|
"MOCK_SECRET",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("return early if no env vars with secrets found", async () => {
|
||||||
|
(exec.getExecOutput as jest.Mock).mockReturnValueOnce({ stdout: "" });
|
||||||
|
await loadSecrets(true);
|
||||||
|
|
||||||
|
expect(exec.getExecOutput).toHaveBeenCalledWith('sh -c "op env ls"');
|
||||||
|
expect(core.exportVariable).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("core.exportVariable", () => {
|
||||||
|
it("is called when shouldExportEnv is true", async () => {
|
||||||
|
await loadSecrets(true);
|
||||||
|
|
||||||
|
expect(core.exportVariable).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("is not called when shouldExportEnv is false", async () => {
|
||||||
|
await loadSecrets(false);
|
||||||
|
|
||||||
|
expect(core.exportVariable).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("unsetPrevious", () => {
|
||||||
|
const testManagedEnv = "TEST_SECRET";
|
||||||
|
const testSecretValue = "MyS3cr#T";
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
process.env[testManagedEnv] = testSecretValue;
|
||||||
|
process.env[envManagedVariables] = testManagedEnv;
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should unset the environment variable if user wants it", () => {
|
||||||
|
unsetPrevious();
|
||||||
|
expect(core.info).toHaveBeenCalledWith("Unsetting previous values ...");
|
||||||
|
expect(core.info).toHaveBeenCalledWith("Unsetting TEST_SECRET");
|
||||||
|
expect(core.exportVariable).toHaveBeenCalledWith("TEST_SECRET", "");
|
||||||
|
});
|
||||||
|
});
|
||||||
91
src/utils.ts
Normal file
91
src/utils.ts
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
import * as core from "@actions/core";
|
||||||
|
import * as exec from "@actions/exec";
|
||||||
|
import { read, setClientInfo, semverToInt } from "@1password/op-js";
|
||||||
|
import { version } from "../package.json";
|
||||||
|
import {
|
||||||
|
authErr,
|
||||||
|
envConnectHost,
|
||||||
|
envConnectToken,
|
||||||
|
envServiceAccountToken,
|
||||||
|
envManagedVariables,
|
||||||
|
} from "./constants";
|
||||||
|
|
||||||
|
export const validateAuth = (): void => {
|
||||||
|
const isConnect = process.env[envConnectHost] && process.env[envConnectToken];
|
||||||
|
const isServiceAccount = process.env[envServiceAccountToken];
|
||||||
|
|
||||||
|
if (isConnect && isServiceAccount) {
|
||||||
|
core.warning(
|
||||||
|
"WARNING: Both service account and Connect credentials are provided. Connect credentials will take priority.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isConnect && !isServiceAccount) {
|
||||||
|
throw new Error(authErr);
|
||||||
|
}
|
||||||
|
|
||||||
|
const authType = isConnect ? "Connect" : "Service account";
|
||||||
|
|
||||||
|
core.info(`Authenticated with ${authType}.`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const extractSecret = (
|
||||||
|
envName: string,
|
||||||
|
shouldExportEnv: boolean,
|
||||||
|
): void => {
|
||||||
|
core.info(`Populating variable: ${envName}`);
|
||||||
|
|
||||||
|
const ref = process.env[envName];
|
||||||
|
if (!ref) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const secretValue = read.parse(ref);
|
||||||
|
if (!secretValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldExportEnv) {
|
||||||
|
core.exportVariable(envName, secretValue);
|
||||||
|
} else {
|
||||||
|
core.setOutput(envName, secretValue);
|
||||||
|
}
|
||||||
|
core.setSecret(secretValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const loadSecrets = async (shouldExportEnv: boolean): Promise<void> => {
|
||||||
|
// Pass User-Agent Information to the 1Password CLI
|
||||||
|
setClientInfo({
|
||||||
|
name: "1Password GitHub Action",
|
||||||
|
id: "GHA",
|
||||||
|
build: semverToInt(version),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Load secrets from environment variables using 1Password CLI.
|
||||||
|
// Iterate over them to find 1Password references, extract the secret values,
|
||||||
|
// and make them available in the next steps either as step outputs or as environment variables.
|
||||||
|
const res = await exec.getExecOutput(`sh -c "op env ls"`);
|
||||||
|
|
||||||
|
if (res.stdout === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const envs = res.stdout.replace(/\n+$/g, "").split(/\r?\n/);
|
||||||
|
for (const envName of envs) {
|
||||||
|
extractSecret(envName, shouldExportEnv);
|
||||||
|
}
|
||||||
|
if (shouldExportEnv) {
|
||||||
|
core.exportVariable(envManagedVariables, envs.join());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const unsetPrevious = (): void => {
|
||||||
|
if (process.env[envManagedVariables]) {
|
||||||
|
core.info("Unsetting previous values ...");
|
||||||
|
const managedEnvs = process.env[envManagedVariables].split(",");
|
||||||
|
for (const envName of managedEnvs) {
|
||||||
|
core.info(`Unsetting ${envName}`);
|
||||||
|
core.exportVariable(envName, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -6,8 +6,6 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"exactOptionalPropertyTypes": true,
|
"exactOptionalPropertyTypes": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"importsNotUsedAsValues": "error",
|
|
||||||
"isolatedModules": true,
|
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
@@ -17,9 +15,9 @@
|
|||||||
"noUncheckedIndexedAccess": true,
|
"noUncheckedIndexedAccess": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"outDir": "./dist/",
|
"resolveJsonModule": true,
|
||||||
"rootDir": "./src/",
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "es2022"
|
"target": "es2022",
|
||||||
|
"verbatimModuleSyntax": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user