diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cae1ca86..f974f6b8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,15 +9,15 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "main" ] + branches: ['main'] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] - + branches: ['main'] + jobs: analyze: name: Analyze @@ -30,41 +30,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - queries: security-extended,security-and-quality + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 \ No newline at end of file + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/src/getStepStartStates.ts b/src/getStepStartStates.ts index f1d66222..5b938ee5 100644 --- a/src/getStepStartStates.ts +++ b/src/getStepStartStates.ts @@ -1,8 +1,8 @@ import { IntegrationExecutionContext, - IntegrationInfoEventName, IntegrationLogger, IntegrationValidationError, + IntegrationWarnEventName, StepStartState, StepStartStates, } from '@jupiterone/integration-sdk-core'; @@ -15,8 +15,8 @@ import { } from './steps/access-context-manager/constants'; import { apiGatewaySteps } from './steps/api-gateway'; import { - STEP_API_GATEWAY_APIS, STEP_API_GATEWAY_API_CONFIGS, + STEP_API_GATEWAY_APIS, STEP_API_GATEWAY_GATEWAYS, } from './steps/api-gateway/constants'; import { appEngineSteps } from './steps/app-engine'; @@ -77,37 +77,37 @@ import { STEP_COMPUTE_ADDRESSES, STEP_COMPUTE_BACKEND_BUCKETS, STEP_COMPUTE_BACKEND_SERVICES, - STEP_COMPUTE_DISKS, STEP_COMPUTE_DISK_IMAGE_RELATIONSHIPS, STEP_COMPUTE_DISK_KMS_RELATIONSHIPS, + STEP_COMPUTE_DISKS, STEP_COMPUTE_FIREWALLS, STEP_COMPUTE_FORWARDING_RULES, STEP_COMPUTE_GLOBAL_ADDRESSES, STEP_COMPUTE_GLOBAL_FORWARDING_RULES, STEP_COMPUTE_HEALTH_CHECKS, - STEP_COMPUTE_IMAGES, STEP_COMPUTE_IMAGE_IMAGE_RELATIONSHIPS, STEP_COMPUTE_IMAGE_KMS_RELATIONSHIPS, - STEP_COMPUTE_INSTANCES, + STEP_COMPUTE_IMAGES, STEP_COMPUTE_INSTANCE_GROUPS, STEP_COMPUTE_INSTANCE_SERVICE_ACCOUNT_RELATIONSHIPS, + STEP_COMPUTE_INSTANCES, STEP_COMPUTE_LOADBALANCERS, - STEP_COMPUTE_NETWORKS, STEP_COMPUTE_NETWORK_PEERING_RELATIONSHIPS, + STEP_COMPUTE_NETWORKS, STEP_COMPUTE_PROJECT, STEP_COMPUTE_REGION_BACKEND_SERVICES, STEP_COMPUTE_REGION_DISKS, STEP_COMPUTE_REGION_HEALTH_CHECKS, STEP_COMPUTE_REGION_INSTANCE_GROUPS, STEP_COMPUTE_REGION_LOADBALANCERS, - STEP_COMPUTE_REGION_TARGET_HTTPS_PROXIES, STEP_COMPUTE_REGION_TARGET_HTTP_PROXIES, - STEP_COMPUTE_SNAPSHOTS, + STEP_COMPUTE_REGION_TARGET_HTTPS_PROXIES, STEP_COMPUTE_SNAPSHOT_DISK_RELATIONSHIPS, + STEP_COMPUTE_SNAPSHOTS, STEP_COMPUTE_SSL_POLICIES, STEP_COMPUTE_SUBNETWORKS, - STEP_COMPUTE_TARGET_HTTPS_PROXIES, STEP_COMPUTE_TARGET_HTTP_PROXIES, + STEP_COMPUTE_TARGET_HTTPS_PROXIES, STEP_COMPUTE_TARGET_SSL_PROXIES, STEP_CREATE_COMPUTE_BACKEND_BUCKET_BUCKET_RELATIONSHIPS, } from './steps/compute'; @@ -116,8 +116,8 @@ import { dataprocSteps } from './steps/dataproc'; import { STEP_CREATE_CLUSTER_IMAGE_RELATIONSHIPS, STEP_CREATE_CLUSTER_STORAGE_RELATIONSHIPS, - STEP_DATAPROC_CLUSTERS, STEP_DATAPROC_CLUSTER_KMS_RELATIONSHIPS, + STEP_DATAPROC_CLUSTERS, } from './steps/dataproc/constants'; import { dnsManagedZonesSteps } from './steps/dns'; import { @@ -134,15 +134,15 @@ import { } from './steps/functions'; import { iamSteps, - STEP_IAM_CUSTOM_ROLES, STEP_IAM_CUSTOM_ROLE_SERVICE_API_RELATIONSHIPS, + STEP_IAM_CUSTOM_ROLES, STEP_IAM_MANAGED_ROLES, STEP_IAM_SERVICE_ACCOUNTS, } from './steps/iam'; import { kmsSteps, - STEP_CLOUD_KMS_KEYS, STEP_CLOUD_KMS_KEY_RINGS, + STEP_CLOUD_KMS_KEYS, } from './steps/kms'; import { loggingSteps } from './steps/logging'; import { @@ -174,8 +174,8 @@ import { resourceManagerSteps, STEP_AUDIT_CONFIG_IAM_POLICY, STEP_RESOURCE_MANAGER_FOLDERS, - STEP_RESOURCE_MANAGER_ORGANIZATION, STEP_RESOURCE_MANAGER_ORG_PROJECT_RELATIONSHIPS, + STEP_RESOURCE_MANAGER_ORGANIZATION, STEP_RESOURCE_MANAGER_PROJECT, } from './steps/resource-manager'; import { secretManagerSteps } from './steps/secret-manager'; @@ -184,9 +184,9 @@ import { serviceUsageSteps } from './steps/service-usage'; import { ServiceUsageStepIds } from './steps/service-usage/constants'; import { spannerSteps } from './steps/spanner'; import { - STEP_SPANNER_INSTANCES, STEP_SPANNER_INSTANCE_CONFIGS, STEP_SPANNER_INSTANCE_DATABASES, + STEP_SPANNER_INSTANCES, } from './steps/spanner/constants'; import { sqlAdminSteps, @@ -948,8 +948,8 @@ async function getStepStartStatesUsingServiceEnablements(params: { for (const serviceName of Object.keys(apiServiceToStepIdsMap)) { if (!enabledServiceNames.includes(serviceName)) { - logger.publishInfoEvent({ - name: '[service_disabled]' as IntegrationInfoEventName, + logger.publishWarnEvent({ + name: 'step_skip' as IntegrationWarnEventName, description: `The API Service ${serviceName} is disabled in this account. As a result, the following steps are disabled: ${apiServiceToStepIdsMap[serviceName]}`, }); } diff --git a/src/steps/__test__/service-api-disabled-error-response.json b/src/steps/__test__/service-api-disabled-error-response.json index 9c8ffef9..edb8ad77 100644 --- a/src/steps/__test__/service-api-disabled-error-response.json +++ b/src/steps/__test__/service-api-disabled-error-response.json @@ -23,27 +23,12 @@ "retryConfig": { "currentRetryAttempt": 0, "retry": 3, - "httpMethodsToRetry": [ - "GET", - "HEAD", - "PUT", - "OPTIONS", - "DELETE" - ], + "httpMethodsToRetry": ["GET", "HEAD", "PUT", "OPTIONS", "DELETE"], "noResponseRetries": 2, "statusCodesToRetry": [ - [ - 100, - 199 - ], - [ - 429, - 429 - ], - [ - 500, - 599 - ] + [100, 199], + [429, 429], + [500, 599] ] } }, @@ -125,27 +110,12 @@ "retryConfig": { "currentRetryAttempt": 0, "retry": 3, - "httpMethodsToRetry": [ - "GET", - "HEAD", - "PUT", - "OPTIONS", - "DELETE" - ], + "httpMethodsToRetry": ["GET", "HEAD", "PUT", "OPTIONS", "DELETE"], "noResponseRetries": 2, "statusCodesToRetry": [ - [ - 100, - 199 - ], - [ - 429, - 429 - ], - [ - 500, - 599 - ] + [100, 199], + [429, 429], + [500, 599] ] } }, diff --git a/src/steps/dns/index.test.ts b/src/steps/dns/index.test.ts index b18778c3..958a108a 100644 --- a/src/steps/dns/index.test.ts +++ b/src/steps/dns/index.test.ts @@ -7,7 +7,7 @@ import { fetchComputeNetworks } from '../compute'; import { DNS_MANAGED_ZONE_ENTITY_TYPE, DNS_POLICY_ENTITY_TYPE, - RELATIONSHIP_TYPE_COMPUTE_NETWORK_HAS_DNS_POLICY + RELATIONSHIP_TYPE_COMPUTE_NETWORK_HAS_DNS_POLICY, } from './constants'; const tempNewAccountConfig = { diff --git a/src/utils/events.ts b/src/utils/events.ts index 1d847e0b..156fd84e 100644 --- a/src/utils/events.ts +++ b/src/utils/events.ts @@ -1,4 +1,7 @@ -import { IntegrationLogger } from '@jupiterone/integration-sdk-core'; +import { + IntegrationLogger, + IntegrationWarnEventName, +} from '@jupiterone/integration-sdk-core'; interface PublishMissingPermissionEventParams { logger: IntegrationLogger; @@ -11,8 +14,8 @@ export function publishMissingPermissionEvent({ permission, stepId, }: PublishMissingPermissionEventParams) { - logger.publishEvent({ - name: 'missing_permission', + logger.publishWarnEvent({ + name: IntegrationWarnEventName.MissingPermission, description: `"${permission}" is not a required permission to run the Google Cloud integration, but is required for step "${stepId}"`, }); }