Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace api_key with gcp secret #15080

Merged
merged 9 commits into from
Oct 28, 2024
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
34 changes: 25 additions & 9 deletions .github/workflows/indexer-processor-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,31 @@ jobs:
- name: Update Rust toolchain
run: rustup update

- id: auth
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}

- name: Prepare and Replace API Keys in Yaml
id: api_key_tokens
uses: 'google-github-actions/get-secretmanager-secrets@v2'
with:
secrets: |-
testnet_api_key:aptos-ci/TESTNET_INDEXER_API_KEY
mainnet_api_key:aptos-ci/MAINNET_INDEXER_API_KEY

- name: Run CLI to Generate JSON Files
id: api_key_update
run: |
cd ecosystem/indexer-grpc/indexer-transaction-generator
cargo run -- --testing-folder ./example_tests --output-folder ../indexer-test-transactions/new_json_transactions
ls -al ./imported_transactions
echo "Updating API keys in YAML files..."
sed -i "s/TESTNET_API_KEY/${{ steps.api_key_tokens.outputs.testnet_api_key }}/g" ./imported_transactions/imported_transactions.yaml
sed -i "s/MAINNET_API_KEY/${{ steps.api_key_tokens.outputs.mainnet_api_key }}/g" ./imported_transactions/imported_transactions.yaml

cat ./imported_transactions/imported_transactions.yaml # Print the updated file for verification
Copy link

Choose a reason for hiding this comment

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

The cat command here prints API keys to public workflow logs, creating a security risk. While the sed commands confirm the file modifications are working, exposing sensitive credentials should be avoided. Consider removing this debug line or redirecting the output to a secure location if verification is needed.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

cargo run -- --testing-folder ./imported_transactions --output-folder ../indexer-test-transactions/new_json_transactions

- name: Install jq
run: sudo apt-get install jq # Ensure jq is installed for JSON processing
Expand All @@ -52,7 +73,8 @@ jobs:
- name: Prepare and Clean JSON Files
run: |
cd ecosystem/indexer-grpc/indexer-test-transactions

ls -al ./new_json_transactions/scripted_transactions

for folder in json_transactions/scripted_transactions new_json_transactions/scripted_transactions; do
for file in $folder/*.json; do
echo "Processing $file..."
Expand All @@ -75,6 +97,7 @@ jobs:
.user.request.sender,
.user.request.expirationTimestampSecs.seconds,
.user.request.signature.ed25519.publicKey,
.user.request.payload.scriptPayload.code.bytecode,
.user.request.signature.ed25519.signature)
| (.info.changes[].writeResource.data |=
if type == "string" then
Expand Down Expand Up @@ -110,13 +133,6 @@ jobs:
exit 0 # Proceed successfully only if no new files or differences are found
fi

- id: auth
if: steps.diff_check.outputs.diff_found == 'true' && steps.diff_check.outputs.new_file_found == 'false'
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}

- name: Log active service account email
if: steps.diff_check.outputs.diff_found == 'true' && steps.diff_check.outputs.new_file_found == 'false'
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ run_*
test_indexer_grpc_*.yaml
test_indexer_grpc/*
ecosystem/indexer-grpc/indexer-transaction-generator/*.yaml
ecosystem/indexer-grpc/indexer-transaction-generator/**/*.yaml

# ignore compiler artifacts
*.dot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cargo run -p aptos-indexer-transaction-generator -- \

```bash
./aptos-indexer-transaction-generator \
--testing-folder /your/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/example_tests \
--testing-folder /your/aptos-core/ecosystem/indexer-grpc/indexer-transaction-generator/imported_transactions \
--output-folder /tmp/ttt
```

Expand Down Expand Up @@ -58,7 +58,7 @@ cargo run -p aptos-indexer-transaction-generator -- \
```


You can check the example [here](example_tests).
You can check the example [here](imported_transactions).


### Account Management
Expand Down
10 changes: 0 additions & 10 deletions ecosystem/indexer-grpc/indexer-transaction-generator/example.yaml

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ testnet:
# Transaction Stream endpoint addresss.
transaction_stream_endpoint: https://grpc.testnet.aptoslabs.com:443
# (Optional) The key to use with developers.aptoslabs.com
api_key: YOUR_KEY_HERE
api_key: TESTNET_API_KEY
# A map from versions to dump and their output names.
versions_to_import:
# naming: <version_descriptive_name>
Expand All @@ -17,6 +17,6 @@ testnet:

mainnet:
transaction_stream_endpoint: https://grpc.mainnet.aptoslabs.com:443
api_key: YOUR_KEY_HERE # update with oncall key
api_key: MAINNET_API_KEY
versions_to_import:
308783012: 308783012_fa_transfer
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ mainnet:
# example:
# 123: "example_transaction"
}

# testnet:
# transaction_stream_endpoint: https://grpc.testnet.aptoslabs.com:443
# api_key: YOUR_KEY_HERE
# versions_to_import: {
# }
# devnet:
# transaction_stream_endpoint: https://grpc.devnet.aptoslabs.com:443
# api_key: YOUR_KEY_HERE
# versions_to_import: {
# }
# custom:
# transaction_stream_endpoint: https://CUSTOM_ENDPOINT:443
# versions_to_import: {
# }
Loading