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

refactor(cmd-api-server): clean up configuration parameters gitguardi… #2086

Closed
wants to merge 6 commits into from
Closed
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
30 changes: 30 additions & 0 deletions .gitguardian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2

# Set to true if the desired exit code for the CLI is always 0,
# otherwise the exit code will be 1 if incidents are found
# the environment variable GITGUARDIAN_EXIT_ZERO=true can also be used toggle this behavior.
exit-zero: false # default: false

verbose: false # default: false

instance: https://api.gitguardian.com/

# Maximum commits to scan in a hook.
max-commits-for-hook: 50 # default: 50

# Accept self-signed certificates for the API.
allow-self-signed: false # default: False

secret:
show-secrets: false # default: false

# Exclude files and paths by globbing
ignored-paths:
- '**/README.md'
- 'doc/*'
- 'LICENSE'
- '**/examples/cactus-example-carbon-accounting-backend/example-config.json'

# Detectors to ignore.
ignored-detectors: # default: []
- Generic Password
42 changes: 42 additions & 0 deletions .github/workflows/gg-shield-action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: GitGuardian scan

on:
push:
pull_request_target:
types:
- assigned
- opened
- synchronize
- reopened
- unlabeled
- closed

# Publish `main` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*

jobs:
scanning:
name: GitGuardian scan
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0 # fetch all history so multiple commits can be scanned
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: GitGuardian scan
uses: GitGuardian/[email protected]
with:
args: --show-secrets --exit-zero --all-policies --verbose
Copy link
Contributor

@petermetz petermetz Feb 16, 2023

Choose a reason for hiding this comment

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

Idea 1

Suggested change
args: --show-secrets --exit-zero --all-policies --verbose
args: --show-secrets --exit-zero --all-policies --verbose --config-path ./gitguardian.yaml

Idea 2 (desperate option)

Try to rename the config file to have .yml extension instead of .yaml just to 100% match what their documentation says.

env:
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_DEFAULT_BRANCH: main
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"configFile": ".config.json",
"authorizationConfigJson" : {},
"cactusNodeId": "972b1aec-a027-4dfb-bf0f-3811ad8d15e4",
"consortiumId": "fb3edae7-46db-4e84-837e-c66f6f2bc78e",
"logLevel": "debug",
"minNodeVersion": "12.0.0",
"tlsDefaultMaxVersion": "TLSv1.3",
Expand All @@ -26,7 +24,6 @@
"cockpitTlsKeyPem": "-----BEGIN RSA PRIVATE KEY-----\r\nMIIJKAIBAAKCAgEAslebFV2ZuSf/EsfDIaAj3sm38CeyKsbIta5dXGsGwD0S38V4\r\nsVOQcs15V8RYerzDHPD+Iz1dkhIVO7E9TLPexrhHbi00Wgq+SwUcQzRd16wlkxWe\r\nK+c+LReEiy8e/N95gKUobtJX6c6F+M5BIOyZZuj+KVewwhRD9cFbCOrivCAzV7ZA\r\nN2naLEf/E3kuimPOBOa5IYxjKJ4C1wuMXaWGNJp9kSwbYFblqcpEyf0IhPYJpsCM\r\nGqwwMXmSWr5ME68YQKQ/2rvv8ud7OKVz8qSwJrFasndoUtlZ4az+fMRMtVBUwC1x\r\nq4SO7a5fiicklaZ2Z2+oIcGjR7mGTLWgPcpQtC8InnP45duF+B+Q+P0CuDtwuSa5\r\n/ZFeM4p8S2g01wiaAUwWWA6BueKCWhYc/P5N1ixxbCYo8habxif2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Dzs45qXXHn30tp\r\noXFShpEsXrVQ4laeqvruD9BnAr69Ppt5UNRCAXDBNEhVWtSwkis+avK+XDlhapvt\r\no+Z8kMbJqHHTGAZLSUp4qaLGu8TlhA9Dyi7aQjN4WG8fzSlFup/TIivK6U6GE/rj\r\nVUnBic2qVWnOdLLZV4fo6xRzwwF22UJjVgb1l15nMR+lDpGvPznr5TMOR0lXCxFj\r\n0y8D4gkgNzclVqjKYwYbQEGgo5k01ycep0A+YRFB2DIlDLPFwcqU0ukZGm/XnC58\r\n9GJfpuKacnK5WDwzR2SoYPbOQxKrlnkCggEBANJLCqOibsezhhNa1vg+JpCL777C\r\nKAkE8bQd7rPoEZIFQqDDdapez0ZrzVWL4L8pgnpjyywxXe0p77PR5A2HRN5z1cFD\r\nDz5Kd0ZDL++5/IQ6KJgQ9EjftIy1zW+XnzBXThY+rpH0RZ15DwFoJxw+PCejjLC5\r\n7zYa2EOJ698N9WryGsxGkfPuViTbIDJKBed+4kXgLTT1hCTq53JFTJtHsO57gRkK\r\ngrPsa0O10EsJtKODFNFHzAiqwfmNxrVVcmUNmKYG4WXuJci+kw1VEJDD6GiSFyx2\r\n1MBhF3x64UtKdsj/7Cskdr6xnrxC9NHsRoZlmGGMZsSFL+MLovZv9MKl6W0=\r\n-----END RSA PRIVATE KEY-----\r\n",
"cockpitTlsClientCaPem": "-",
"keyPairPem": "-----BEGIN PRIVATE KEY-----\nMIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgHy0hDxj3Uhz16F8aLiWq\nhf6bcqRU3fqAv2u2YvYdSF+hRANCAAQpvM3dbCigeGLDKs0JUTi0yf5UHGC2eSRD\nd3Dk1WpBjbJDLKGdSGVGE0h1Zys8o3Den3Xag8Y1EcTxDHDInMEc\n-----END PRIVATE KEY-----\n",
"keychainSuffixKeyPairPem": "CACTUS_NODE_KEY_PAIR_PEM",
"plugins": [
{
"packageName": "@hyperledger/cactus-plugin-keychain-memory",
Expand Down
2 changes: 0 additions & 2 deletions examples/carbon-accounting/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ COPY --chown=${APP_USER}:${APP_USER} ./examples/carbon-accounting/healthcheck.sh

ENV AUTHORIZATION_CONFIG_JSON="{}"
ENV AUTHORIZATION_PROTOCOL=NONE
ENV CACTUS_NODE_ID=-
ENV CONSORTIUM_ID=-
ENV KEY_PAIR_PEM=-
ENV COCKPIT_WWW_ROOT=/usr/src/app/node_modules/@hyperledger/cactus-example-carbon-accounting-frontend/www/
ENV COCKPIT_TLS_ENABLED=false
Expand Down
2 changes: 0 additions & 2 deletions examples/supply-chain-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ COPY --chown=${APP_USER}:${APP_USER} ./examples/supply-chain-app/healthcheck.sh

ENV AUTHORIZATION_CONFIG_JSON="{}"
ENV AUTHORIZATION_PROTOCOL=NONE
ENV CACTUS_NODE_ID=-
ENV CONSORTIUM_ID=-
ENV KEY_PAIR_PEM=-
ENV COCKPIT_WWW_ROOT=/usr/src/app/node_modules/@hyperledger/cactus-example-supply-chain-frontend/www/
ENV COCKPIT_TLS_ENABLED=false
Expand Down
2 changes: 0 additions & 2 deletions examples/supply-chain-app/process.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
CACTUS_NODE_ID=-
CONSORTIUM_ID=-
KEY_PAIR_PEM=-
COCKPIT_WWW_ROOT=./node_modules/@hyperledger/cactus-example-supply-chain-frontend/www/
COCKPIT_TLS_ENABLED=false
Expand Down
2 changes: 0 additions & 2 deletions packages/cactus-cmd-api-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ ARG NPM_PKG_VERSION=latest
ENV TZ=Etc/UTC
ENV NODE_ENV=production

ENV CACTUS_NODE_ID=-
ENV CONSORTIUM_ID=-
ENV KEY_PAIR_PEM=-
ENV COCKPIT_WWW_ROOT=${APP}node_modules/@hyperledger/cactus-cockpit/www/
ENV COCKPIT_TLS_ENABLED=false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export interface ICactusApiServerOptions {
authorizationProtocol: AuthorizationProtocol;
authorizationConfigJson: IAuthorizationConfig;
configFile: string;
cactusNodeId: string;
consortiumId: string;
logLevel: LogLevelDesc;
tlsDefaultMaxVersion: SecureVersion;
cockpitEnabled: boolean;
Expand All @@ -66,7 +64,6 @@ export interface ICactusApiServerOptions {
grpcMtlsEnabled: boolean;
plugins: PluginImport[];
keyPairPem: string;
keychainSuffixKeyPairPem: string;
minNodeVersion: string;
enableShutdownHook: boolean;
}
Expand Down Expand Up @@ -180,24 +177,6 @@ export class ConfigService {
env: "CONFIG_FILE",
arg: "config-file",
},
consortiumId: {
doc:
"Identifier of the consortium your node is part of. " +
" Can be any string of characters such as a UUID",
format: ConfigService.formatNonBlankString,
default: null as string | null,
env: "CONSORTIUM_ID",
arg: "consortium-id",
},
cactusNodeId: {
doc:
"Identifier of this particular Cactus node. Must be unique among the total set of Cactus nodes running in any " +
"given Cactus deployment. Can be any string of characters such as a UUID or an Int64",
format: ConfigService.formatNonBlankString,
default: null as string | null,
env: "CACTUS_NODE_ID",
arg: "cactus-node-id",
},
logLevel: {
doc:
"The level at which loggers should be configured. Supported values include the following: " +
Expand Down Expand Up @@ -427,17 +406,6 @@ export class ConfigService {
format: ConfigService.formatNonBlankString,
default: null as string | null,
},
keychainSuffixKeyPairPem: {
doc:
"The key under which to store/retrieve the key pair PEM from the " +
" keychain of this Cactus node (API server) The complete lookup key" +
" is constructed from the ${CACTUS_NODE_ID}" +
"${KEYCHAIN_SUFFIX_KEY_PAIR_PEM} template.",
env: "KEYCHAIN_SUFFIX_KEY_PAIR_PEM",
arg: "keychain-suffix-key-pair-pem",
format: "*",
default: "CACTUS_NODE_KEY_PAIR_PEM",
},
enableShutdownHook: {
doc:
"It will cause the API server to listen to OS process signals and will attempt " +
Expand Down Expand Up @@ -613,8 +581,6 @@ export class ConfigService {
authorizationProtocol: AuthorizationProtocol.JSON_WEB_TOKEN,
authorizationConfigJson,
configFile: ".config.json",
cactusNodeId: uuidV4(),
consortiumId: uuidV4(),
logLevel: "debug",
minNodeVersion: (schema.minNodeVersion as SchemaObj).default,
tlsDefaultMaxVersion: "TLSv1.3",
Expand All @@ -640,8 +606,6 @@ export class ConfigService {
cockpitTlsKeyPem: pkiServer.privateKeyPem,
cockpitTlsClientCaPem: "-", // Cockpit mTLS is off so this will not crash the server
keyPairPem,
keychainSuffixKeyPairPem: (schema.keychainSuffixKeyPairPem as SchemaObj)
.default,
plugins,
enableShutdownHook,
};
Expand Down
2 changes: 0 additions & 2 deletions tools/docker/besu-all-in-one/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ services:
cactus-api-server:
image: ghcr.io/hyperledger/cactus-cmd-api-server:2021-08-15--refactor-1222
environment:
CACTUS_NODE_ID: "-"
CONSORTIUM_ID: "-"
KEY_PAIR_PEM: "-"
COCKPIT_WWW_ROOT: ${APP}node_modules/@hyperledger/cactus-cockpit/www/
COCKPIT_TLS_ENABLED: "false"
Expand Down
9 changes: 2 additions & 7 deletions whitepaper/whitepaper.md
Original file line number Diff line number Diff line change
Expand Up @@ -1077,11 +1077,6 @@ Configuration Parameters
Default: Mandatory parameter without a default value.
Env: CONFIG_FILE
CLI: --config-file
cactusNodeId:
Description: Identifier of this particular Cactus node. Must be unique among the total set of Cactus nodes running in any given Cactus deployment. Can be any string of characters such as a UUID or an Int64
Default: Mandatory parameter without a default value.
Env: CACTUS_NODE_ID
CLI: --cactus-node-id
logLevel:
Description: The level at which loggers should be configured. Supported values include the following: error, warn, info, debug, trace
Default: warn
Expand Down Expand Up @@ -1128,12 +1123,12 @@ Configuration Parameters
Env: PRIVATE_KEY
CLI: --private-key
keychainSuffixPrivateKey:
Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Default: CACTUS_NODE_PRIVATE_KEY
Env: KEYCHAIN_SUFFIX_PRIVATE_KEY
CLI: --keychain-suffix-private-key
keychainSuffixPublicKey:
Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Default: CACTUS_NODE_PUBLIC_KEY
Env: KEYCHAIN_SUFFIX_PUBLIC_KEY
CLI: --keychain-suffix-public-key
Expand Down
9 changes: 2 additions & 7 deletions whitepaper/whitepaper_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,6 @@ $ npx ts-node -e "import {ConfigService} from './packages/cactus-cmd-api-server/
Default: Mandatory parameter without a default value.
Env: CONFIG_FILE
CLI: --config-file
cactusNodeId:
Description: Identifier of this particular Cactus node. Must be unique among the total set of Cactus nodes running in any given Cactus deployment. Can be any string of characters such as a UUID or an Int64
Default: Mandatory parameter without a default value.
Env: CACTUS_NODE_ID
CLI: --cactus-node-id
logLevel:
Description: The level at which loggers should be configured. Supported values include the following: error, warn, info, debug, trace
Default: warn
Expand Down Expand Up @@ -562,12 +557,12 @@ $ npx ts-node -e "import {ConfigService} from './packages/cactus-cmd-api-server/
Env: PRIVATE_KEY
CLI: --private-key
keychainSuffixPrivateKey:
Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Description: The key under which to store/retrieve the private key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Default: CACTUS_NODE_PRIVATE_KEY
Env: KEYCHAIN_SUFFIX_PRIVATE_KEY
CLI: --keychain-suffix-private-key
keychainSuffixPublicKey:
Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${CACTUS_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Description: The key under which to store/retrieve the public key from the keychain of this Cactus node (API server)The complete lookup key is constructed from the ${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.
Default: CACTUS_NODE_PUBLIC_KEY
Env: KEYCHAIN_SUFFIX_PUBLIC_KEY
CLI: --keychain-suffix-public-key
Expand Down