Google Cloud Provider (GCP)

The RegScale CLI integrates with Google Cloud Platform to synchronize assets, security findings, and compliance data from GCP Security Command Center (SCC) into RegScale for continuous monitoring and compliance automation.

Overview

This integration enables:

  • Asset Synchronization: Import GCP resources as RegScale assets
  • Findings Synchronization: Import SCC security findings as RegScale vulnerabilities (the platform opens one issue per vulnerability)
  • Compliance Automation: Map SCC findings to compliance controls (NIST 800-53, FedRAMP, CIS, PCI-DSS, SOC2)
  • Evidence Collection: Automated evidence gathering for audit trails
  • Inventory Export: Export GCP resource inventory for analysis

Prerequisites

  • Active GCP account with appropriate permissions
  • GCP project with Security Command Center enabled
  • Service account with required IAM roles
  • RegScale CLI installed and configured (regscale init)

Setup

Step 1: Create a GCP Project (if needed)

  1. Navigate to the GCP Console
  2. Click the project dropdown and select New Project
  3. Enter a project name and click Create

Step 2: Enable Required APIs

Core APIs (Required)

# Security Command Center API - Required for findings and compliance
gcloud services enable securitycenter.googleapis.com

# Cloud Asset API - Required for asset inventory
gcloud services enable cloudasset.googleapis.com

# Resource Manager API - Required for project/org metadata
gcloud services enable cloudresourcemanager.googleapis.com

Optional APIs (based on inventory scope)

Enable these APIs to collect inventory for specific resource types:

# Compute resources
gcloud services enable compute.googleapis.com
gcloud services enable container.googleapis.com
gcloud services enable run.googleapis.com
gcloud services enable cloudfunctions.googleapis.com
gcloud services enable appengine.googleapis.com

# Storage & Database
gcloud services enable storage.googleapis.com
gcloud services enable sqladmin.googleapis.com
gcloud services enable spanner.googleapis.com
gcloud services enable bigtable.googleapis.com
gcloud services enable firestore.googleapis.com
gcloud services enable redis.googleapis.com

# Security & Compliance
gcloud services enable iam.googleapis.com
gcloud services enable cloudkms.googleapis.com
gcloud services enable logging.googleapis.com

# Networking
gcloud services enable dns.googleapis.com

Step 3: Create a Service Account

  1. Navigate to IAM & Admin > Service Accounts in the GCP Console
  2. Click Create Service Account
  3. Enter a name (e.g., regscale-integration) and description
  4. Click Create and Continue
  5. Assign the required roles (see Required IAM Permissions)
  6. Click Done

Step 4: Generate Service Account Key

  1. Click on the newly created service account
  2. Navigate to the Keys tab
  3. Click Add Key > Create new key
  4. Select JSON format
  5. Click Create to download the key file
  6. Store the key file securely (do not commit to version control)

Required IAM Permissions

Minimum Required Roles

These roles are required for basic functionality:

RolePurposeRequired For
roles/securitycenter.findingsViewerView Security Command Center findingssync_findings, sync_compliance
roles/securitycenter.sourcesViewerView SCC sources and compliance posturesync_compliance, collect_evidence
roles/cloudasset.viewerView Cloud Asset Inventorysync_assets, inventory

Optional Roles (for comprehensive inventory)

These roles provide access to additional resource details:

RolePurpose
roles/iam.securityReviewerIAM policies, service accounts, and roles
roles/logging.viewerLog sinks, metrics, and audit logs
roles/cloudkms.viewerKMS key rings and crypto keys
roles/compute.viewerCompute Engine instances, disks, networks
roles/storage.objectViewerCloud Storage bucket metadata
roles/container.viewerGKE clusters and node pools

Granting Permissions

Organization-Level (Recommended for full visibility)

Organization-level permissions provide visibility across all projects:

# Set variables
SERVICE_ACCOUNT="regscale-integration@YOUR_PROJECT.iam.gserviceaccount.com"
ORG_ID="123456789012"  # Your numeric organization ID

# Grant required roles
gcloud organizations add-iam-policy-binding $ORG_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/securitycenter.findingsViewer"

gcloud organizations add-iam-policy-binding $ORG_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/securitycenter.sourcesViewer"

gcloud organizations add-iam-policy-binding $ORG_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/cloudasset.viewer"

# Optional: Additional roles for comprehensive inventory
gcloud organizations add-iam-policy-binding $ORG_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/iam.securityReviewer"

gcloud organizations add-iam-policy-binding $ORG_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/logging.viewer"

Project-Level

For single-project scanning:

# Set variables
SERVICE_ACCOUNT="regscale-integration@YOUR_PROJECT.iam.gserviceaccount.com"
PROJECT_ID="my-gcp-project"

# Grant required roles
gcloud projects add-iam-policy-binding $PROJECT_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/securitycenter.findingsViewer"

gcloud projects add-iam-policy-binding $PROJECT_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/cloudasset.viewer"

Folder-Level

For folder-scoped scanning:

# Set variables
SERVICE_ACCOUNT="regscale-integration@YOUR_PROJECT.iam.gserviceaccount.com"
FOLDER_ID="987654321098"  # Your numeric folder ID

# Grant required roles
gcloud resource-manager folders add-iam-policy-binding $FOLDER_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/securitycenter.findingsViewer"

gcloud resource-manager folders add-iam-policy-binding $FOLDER_ID \
  --member="serviceAccount:$SERVICE_ACCOUNT" \
  --role="roles/cloudasset.viewer"

Configuration

Configuration File (init.yaml)

Add the following settings to your init.yaml file:

Required Settings

# Path to service account JSON key file
gcpCredentials: '/path/to/service-account-key.json'

# Scan scope: project, organization, or folder
gcpScanType: 'project'

Scope-Dependent Settings

Based on your gcpScanType, configure the appropriate scope identifier:

# For project scope
gcpProjectId: 'my-gcp-project'

# For organization scope
gcpOrganizationId: '123456789012'  # Numeric organization ID

# For folder scope
gcpFolderId: '987654321098'  # Numeric folder ID

Optional Settings

# Compliance framework for control mapping
# Options: NIST800-53R5, CIS_GCP, FedRAMP, PCI-DSS, SOC2
gcpComplianceFramework: 'NIST800-53R5'

# Cache time-to-live in hours (reduces API calls)
gcpCacheTTLHours: 8

# Evidence collection mode: attachments or records
gcpEvidenceMode: 'attachments'

Complete Configuration Examples

Project-Level Scanning

gcpCredentials: '/secure/path/gcp-regscale-sa.json'
gcpScanType: 'project'
gcpProjectId: 'my-gcp-project'

Organization-Level Compliance Scanning

gcpCredentials: '/secure/path/gcp-regscale-sa.json'
gcpScanType: 'organization'
gcpOrganizationId: '123456789012'
gcpComplianceFramework: 'FedRAMP'
gcpCacheTTLHours: 8
gcpEvidenceMode: 'attachments'

Folder-Level Scanning

gcpCredentials: '/secure/path/gcp-regscale-sa.json'
gcpScanType: 'folder'
gcpFolderId: '987654321098'
gcpComplianceFramework: 'NIST800-53R5'

Authentication Methods

The GCP integration supports multiple authentication methods to accommodate different deployment scenarios.

Method 1: Service Account JSON File (Recommended for local use)

Store the service account key as a JSON file:

# In init.yaml
gcpCredentials: '/path/to/service-account-key.json'

Or via environment variable:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json

Method 2: Base64-Encoded JSON (Recommended for CI/CD and unattended runs)

Encode your credentials for secure storage in environment variables or secrets managers:

# Encode the credentials
cat service-account-key.json | base64 > credentials.b64

# View the encoded string
cat credentials.b64

Configure in init.yaml:

gcpCredentialsJsonBase64: 'eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6Li4ufQ=='

Or via environment variable:

export GCP_CREDENTIALS_JSON_BASE64=$(cat service-account-key.json | base64)

Method 3: Raw JSON String

For environments where file storage is not available:

# In init.yaml (ensure proper YAML escaping)
gcpCredentialsJson: '{"type": "service_account", "project_id": "my-project", ...}'

Or via environment variable:

export GCP_CREDENTIALS_JSON='{"type": "service_account", "project_id": "my-project", ...}'

Credential Priority Order

When multiple credential sources are configured, the integration uses this priority order:

  1. Command-line flags (--credentials-json-base64, --credentials-json, --credentials-file)
  2. Environment variables (GCP_CREDENTIALS_JSON_BASE64, GCP_CREDENTIALS_JSON, GOOGLE_APPLICATION_CREDENTIALS)
  3. Configuration file settings (gcpCredentialsJsonBase64, gcpCredentialsJson, gcpCredentials)

CLI Commands

Authentication Test

Validate your GCP credentials and API access:

# Using credentials file path
regscale gcp authenticate --credentials-file /path/to/key.json

# Using base64-encoded credentials
regscale gcp authenticate --credentials-json-base64 "eyJ0eXBlIjoi..."

Asset Synchronization

Sync GCP resources to RegScale as assets:

# Basic usage
regscale gcp sync_assets --regscale-ssp-id 123

# With scope options
regscale gcp sync_assets --regscale-ssp-id 123 \
  --scope organization \
  --organization-id 123456789012

# With filtering
regscale gcp sync_assets --regscale-ssp-id 123 \
  --asset-types "compute.googleapis.com/Instance,storage.googleapis.com/Bucket" \
  --labels "env=prod,team=security"

# Force refresh (bypass cache)
regscale gcp sync_assets --regscale-ssp-id 123 --force-refresh

Options:

OptionDescription
--regscale-ssp-idRegScale Security Plan ID (required)
--scopeScan scope: project, organization, or folder
--project-idGCP project ID (for project scope)
--organization-idGCP organization ID (for organization scope)
--asset-typesFilter by asset types (comma-separated)
--labelsFilter by GCP labels (e.g., env=prod,team=security)
--force-refreshBypass cache and fetch fresh data

Findings Synchronization

Sync Security Command Center findings to RegScale as vulnerabilities.

What sync_findings writes

sync_findings writes vulnerabilities to the security plan. It does not write issues. The RegScale platform opens
the issues from these vulnerabilities.

  • Findings: one vulnerability for each SCC finding. The key is the finding's own SCC name (for example
    organizations/123/sources/456/findings/abc), not its affected resource. So two findings on one resource are two
    vulnerabilities. An active finding is Open. A finding that SCC marks INACTIVE (remediated) is Closed.
  • Control-test rows: Closed vulnerabilities for the passed control tests. The control tests are a fixed list of
    50 control and category pairs over 13 NIST controls (AC-2, AC-3, AC-5, AC-6, AU-2, AU-9, AU-11, CA-3, CP-9, IA-2,
    SC-7, SC-12 and SI-4). This list is not the category table below. The rows are keyed by category, so the tests of
    one category share one row. If all 50 tests pass, the run writes 45 rows.
  • A control test does not pass, and gets no row, if an active finding in the run maps to its control or has its
    category.
  • A run whose scope is not the init.yaml scope writes no control-test rows.
  • With --generate-evidence, the command also runs the compliance pass that collect_evidence runs, with issue
    creation and control-status updates off. That pass syncs assets and writes evidence to the plan. It takes its mode
    from gcpEvidenceMode. It does not run with --dry-run, and it does not use --offset or --limit.

Which findings sync_findings imports

sync_findings imports every SCC finding that SCC returns for the scope, active or INACTIVE, after these options:

  • --severity-filter keeps only the severities that you name.
  • --sources keeps only the SCC sources that you name. If no source matches, the command logs a warning and imports
    findings from all sources.
  • --offset and --limit keep one slice of the run's records: the findings first, then the control-test rows. A
    run with either option closes nothing.

A finding takes its NIST controls from its own SCC compliance entries for NIST 800-53. Both sync_findings and
sync_compliance read these entries in the same way, so a tagged finding maps to the same controls in both
commands. If the standard of an entry names 800-53, for example nist-800-53 or NIST SP 800-53, the entry counts.
If the standard is only nist, the entry counts when its version is empty, a revision such as R5, or 800-53.
Entries for other NIST standards, such as nist-csf or nist-800-171, do not count. If a finding has no NIST
800-53 entries, it takes its controls from the category table below. A finding with no control from either source
is still imported, with no control labels.

Warning: do not use --severity-filter or --sources in a run of the init.yaml scope. That run closes the plan's
GCP vulnerabilities that the filter skipped. It also writes passed control-test rows for the controls of the skipped
findings. Use these filters only in a run whose scope is not the init.yaml scope, which closes nothing.

Category-to-control mapping

If a finding carries no NIST 800-53 tags of its own, sync_findings and sync_compliance map it by one table: this
table plus the 9 pairs below. An untagged vulnerability finding whose category is not in the table maps to SI-2 in
both commands. An example is a SOFTWARE_VULNERABILITY (CVE) finding.

NIST controlNameSCC categories
AC-17Remote AccessOPEN_SSH_PORT, OPEN_RDP_PORT, PUBLIC_IP_ADDRESS, OPEN_TELNET_PORT, COMPUTE_SECURE_BOOT, OS_LOGIN_DISABLED
AC-2Account ManagementADMIN_SERVICE_ACCOUNT, USER_MANAGED_SERVICE_ACCOUNT_KEY, SERVICE_ACCOUNT_KEY_NOT_ROTATED, DEFAULT_SERVICE_ACCOUNT_USED, OVER_PRIVILEGED_SERVICE_ACCOUNT_USER, MFA_NOT_ENFORCED
AC-3Access EnforcementPUBLIC_BUCKET_ACL, BUCKET_POLICY_ONLY_DISABLED, NON_ORG_IAM_MEMBER, SQL_NO_ROOT_PASSWORD, PUBLIC_DATASET, ALLOYDB_PUBLIC_IP, CLOUD_SQL_PUBLIC_IP
AC-4Information Flow EnforcementVPC_FLOW_LOGS_DISABLED, FLOW_LOGS_DISABLED, FIREWALL_RULE_LOGGING_DISABLED, PRIVATE_GOOGLE_ACCESS_DISABLED, LEGACY_NETWORK
AC-5Separation of DutiesKMS_ROLE_SEPARATION, SERVICE_ACCOUNT_ROLE_SEPARATION, PRIMITIVE_ROLES_USED, KMS_PROJECT_HAS_OWNER
AC-6Least PrivilegeFULL_API_ACCESS, OVER_PRIVILEGED_SERVICE_ACCOUNT_USER, PRIMITIVE_ROLES_USED, OVER_PRIVILEGED_ACCOUNT, KMS_PROJECT_HAS_OWNER, ADMIN_SERVICE_ACCOUNT, OVER_PRIVILEGED_SCOPES
AU-12Audit Record GenerationAUDIT_LOGGING_DISABLED, FIREWALL_RULE_LOGGING_DISABLED, FLOW_LOGS_DISABLED, LOAD_BALANCER_LOGGING_DISABLED
AU-2Event LoggingAUDIT_LOGGING_DISABLED, AUDIT_CONFIG_NOT_MONITORED, BUCKET_LOGGING_DISABLED, CLOUD_AUDIT_LOGGING_DISABLED
AU-3Content of Audit RecordsAUDIT_LOGGING_DISABLED, LOG_NOT_EXPORTED, BUCKET_LOGGING_DISABLED
AU-6Audit Record Review, Analysis, and ReportingAUDIT_CONFIG_NOT_MONITORED, FLOW_LOGS_DISABLED, DNS_LOGGING_DISABLED, LOG_NOT_EXPORTED
AU-9Protection of Audit InformationPUBLIC_LOG_BUCKET, LOCKED_RETENTION_POLICY_NOT_SET, OBJECT_VERSIONING_DISABLED, BUCKET_IAM_NOT_MONITORED
CA-7Continuous MonitoringFLOW_LOGS_DISABLED, FIREWALL_RULE_LOGGING_DISABLED, AUDIT_LOGGING_DISABLED, WEB_UI_ENABLED, MONITORING_ACCOUNT_NOT_CONFIGURED
CM-2Baseline ConfigurationDEFAULT_SERVICE_ACCOUNT_USED, LEGACY_NETWORK, INSTANCE_TEMPLATE_NOT_FOUND, OUTDATED_LIBRARY
CM-6Configuration SettingsSQL_NO_ROOT_PASSWORD, SQL_WEAK_ROOT_PASSWORD, COMPUTE_SECURE_BOOT, IP_FORWARDING_ENABLED, SERIAL_PORT_ENABLED, COS_NOT_USED, LEGACY_AUTHORIZATION_ENABLED, INTEGRITY_MONITORING_DISABLED
CM-7Least FunctionalityFULL_API_ACCESS, WEB_UI_ENABLED, SERIAL_PORT_ENABLED, IP_FORWARDING_ENABLED, LEGACY_AUTHORIZATION_ENABLED, LEGACY_METADATA_ENABLED
CM-8System Component InventoryASSET_INVENTORY_DISABLED, RESOURCE_NOT_FOUND
CP-9System BackupAUTO_BACKUP_DISABLED, BUCKET_VERSIONING_DISABLED, OBJECT_VERSIONING_DISABLED, SNAPSHOT_NOT_FOUND
IA-2Identification and Authentication (Organizational Users)MFA_NOT_ENFORCED, NON_ORG_IAM_MEMBER, OS_LOGIN_DISABLED, TWO_STEP_VERIFICATION_NOT_ENFORCED
IA-4Identifier ManagementADMIN_SERVICE_ACCOUNT, DEFAULT_SERVICE_ACCOUNT_USED, USER_MANAGED_SERVICE_ACCOUNT_KEY
IA-5Authenticator ManagementSERVICE_ACCOUNT_KEY_NOT_ROTATED, SQL_NO_ROOT_PASSWORD, SQL_WEAK_ROOT_PASSWORD, USER_MANAGED_SERVICE_ACCOUNT_KEY, API_KEY_NOT_ROTATED, API_KEY_NOT_RESTRICTED
SC-12Cryptographic Key Establishment and ManagementKMS_PROJECT_HAS_OWNER, KMS_KEY_NOT_ROTATED, KMS_ROLE_SEPARATION, KMS_PUBLIC_KEY, CMEK_DISABLED
SC-13Cryptographic ProtectionWEAK_SSL_POLICY, CMEK_DISABLED, SQL_CMEK_DISABLED, BUCKET_CMEK_DISABLED, DISK_CSEK_DISABLED
SC-28Protection of Information at RestDISK_CSEK_DISABLED, CMEK_DISABLED, SQL_CMEK_DISABLED, BUCKET_CMEK_DISABLED, DEFAULT_ENCRYPTION_DISABLED
SC-7Boundary ProtectionOPEN_CASSANDRA_PORT, OPEN_CISCOSECURE_WEBSM_PORT, OPEN_DIRECTORY_SERVICES_PORT, OPEN_DNS_PORT, OPEN_ELASTICSEARCH_PORT, OPEN_FTP_PORT, OPEN_HTTP_PORT, OPEN_LDAP_PORT, OPEN_MEMCACHED_PORT, OPEN_MONGODB_PORT, OPEN_MYSQL_PORT, OPEN_NETBIOS_PORT, OPEN_ORACLEDB_PORT, OPEN_POP3_PORT, OPEN_POSTGRESQL_PORT, OPEN_RDP_PORT, OPEN_REDIS_PORT, OPEN_SMTP_PORT, OPEN_SSH_PORT, OPEN_TELNET_PORT, NETWORK_POLICY_DISABLED, PUBLIC_IP_ADDRESS, PUBLIC_SQL_INSTANCE, FIREWALL_RULE_LOGGING_DISABLED, OVER_PRIVILEGED_ACCOUNT, MASTER_AUTHORIZED_NETWORKS_DISABLED, PRIVATE_CLUSTER_DISABLED
SC-8Transmission Confidentiality and IntegritySSL_NOT_ENFORCED, WEAK_SSL_POLICY, REDIS_AUTH_DISABLED, COMPUTE_SECURE_BOOT, HTTPS_NOT_ENFORCED, LOAD_BALANCER_SSL_POLICY
SI-2Flaw RemediationOUTDATED_LIBRARY, OUTDATED_DEPENDENCIES, VULNERABILITY_FOUND, WEB_VULNERABILITY_FOUND, CONTAINER_VULNERABILITY, AUTO_UPGRADE_DISABLED, NODE_AUTO_UPGRADE_DISABLED
SI-3Malicious Code ProtectionMALWARE_DETECTED, SUSPICIOUS_ACTIVITY_DETECTED, BINARY_AUTHORIZATION_DISABLED, ANTIMALWARE_NOT_ENABLED
SI-4System MonitoringFIREWALL_RULE_LOGGING_DISABLED, FLOW_LOGS_DISABLED, AUDIT_LOGGING_DISABLED, DNS_LOGGING_DISABLED, VPC_FLOW_LOGS_DISABLED, CLOUD_ARMOR_LOGGING_DISABLED, THREAT_DETECTION_DISABLED

These 9 pairs come from the legacy control tests:

SCC categoryAlso maps to
AUDIT_LOGGING_DISABLEDAC-2
PUBLIC_BUCKET_ACLAC-2
PUBLIC_DATASETAC-2
LOCKED_RETENTION_POLICY_NOT_SETAU-11
OBJECT_VERSIONING_DISABLEDAU-11
PUBLIC_IP_ADDRESSCA-3
PUBLIC_SQL_INSTANCECA-3
SSL_NOT_ENFORCEDSC-7
WEAK_SSL_POLICYSC-7

The table applies to sync_compliance with the NIST800-53R5 or FedRAMP framework. With the CIS_GCP,
PCI-DSS or SOC2 framework, sync_compliance uses that framework's own table. In every framework,
sync_compliance first uses the controls that SCC tags on the finding for that framework.

Commands:

# Basic usage
regscale gcp sync_findings --regscale-ssp-id 123

# With severity filter, for a project other than the init.yaml one (see the warning above)
regscale gcp sync_findings --regscale-ssp-id 123 \
  --scope project --project-id my-other-project \
  --severity-filter CRITICAL,HIGH

# With source filter, for a project other than the init.yaml one (see the warning above)
regscale gcp sync_findings --regscale-ssp-id 123 \
  --scope project --project-id my-other-project \
  --sources "SECURITY_HEALTH_ANALYTICS,EVENT_THREAT_DETECTION"

# Generate evidence for findings
regscale gcp sync_findings --regscale-ssp-id 123 \
  --generate-evidence \
  --control-ids "AC-1,AC-2,SC-7"

--scope, --project-id and --organization-id (or the GCP_PROJECT_ID and GCP_ORGANIZATION_ID environment
variables) choose the project or organization whose findings are synced; each falls back to init.yaml when not given.
A run whose resulting scope is not the init.yaml scope turns off mop-up and sends no passed control assessments, so it
never closes the plan's GCP findings outside that scope. Stale findings are closed only by a run of the init.yaml scope.
If init.yaml holds no gcpProjectId (project scope) or gcpOrganizationId (organization scope), because every run
passes --project-id or --organization-id instead, no run is the init.yaml scope: mop-up and passed control assessments stay off
for every run, so findings that leave SCC stay open. Set gcpScanType and that ID to the plan's GCP scope to have its
runs close them.

Options:

OptionDescription
--regscale-ssp-idRegScale Security Plan ID (required)
--severity-filterFilter by severity: CRITICAL, HIGH, MEDIUM, LOW
--sourcesFilter by SCC sources (comma-separated)
--generate-evidenceAlso run the compliance pass and write evidence to the plan
--control-idsTarget specific control IDs
--project-idProject whose findings are synced at project scope; defaults to gcpProjectId
--organization-idOrganization whose findings are synced at organization scope; defaults to gcpOrganizationId
--scopeScan scope: project, organization, or folder

An untagged SOFTWARE_VULNERABILITY (CVE) finding maps to SI-2, as the category-to-control mapping section says. A finding that maps to no control is still imported, with no control labels. The run logs at INFO how many findings had no control. CVE findings carry their CVE id and CVSS v3 base score. Every finding names its affected resource, which links it to the asset that sync_assets created for that resource.

sync_compliance is different: it updates control status, so it uses only the findings it can map to a control.

Compliance Synchronization

Update RegScale control implementation status based on SCC compliance findings:

# Basic usage with default framework (NIST 800-53 R5)
regscale gcp sync_compliance --regscale-ssp-id 123

# Specify compliance framework
regscale gcp sync_compliance --regscale-ssp-id 123 \
  --framework FedRAMP

# Create issues for failed controls
regscale gcp sync_compliance --regscale-ssp-id 123 \
  --framework NIST800-53R5 \
  --create-issues

# Update control status and create POAMs
regscale gcp sync_compliance --regscale-ssp-id 123 \
  --framework FedRAMP \
  --update-control-status \
  --create-poams

Options:

OptionDescription
--regscale-ssp-idRegScale Security Plan ID (required)
--frameworkCompliance framework (see Supported Frameworks)
--create-issuesCreate RegScale issues for failed controls
--update-control-statusUpdate control implementation status
--create-poamsMark failed controls as POAMs

A control is assessed only on evidence. sync_compliance reads the active SCC findings, and a control fails when an
active finding maps to it. A control that no active finding maps to is left unassessed, so its status in RegScale is not
changed: the absence of a finding is not evidence that the control is met.
A vulnerability finding whose category has no control mapping, such as a SOFTWARE_VULNERABILITY (CVE) finding, is
assessed against the framework's vulnerability controls (SI-2 for NIST 800-53 R5 and FedRAMP), so SI-2 fails while
active CVE findings exist.
sync_findings maps such a finding to SI-2 too. If the framework table does not list a control that SCC tags on an
active finding, the control is still assessed. An example is IA-5(1). If the plan does not have that control, it is
skipped.

Evidence Collection

Collect compliance evidence from GCP for RegScale controls:

# Collect evidence as SSP attachments
regscale gcp collect_evidence --regscale-ssp-id 123 \
  --mode attachments

# Collect evidence as individual records
regscale gcp collect_evidence --regscale-ssp-id 123 \
  --mode records

# Target specific controls
regscale gcp collect_evidence --regscale-ssp-id 123 \
  --control-ids "AC-1,AC-2,AU-2,SC-7"

Options:

OptionDescription
--regscale-ssp-idRegScale Security Plan ID (required)
--modeEvidence mode: attachments or records
--control-idsTarget specific control IDs (comma-separated)
--evidence-frequencyCollection frequency

Inventory Export

Export GCP resource inventory to a JSON file for analysis:

# Export project inventory
regscale gcp inventory collect \
  --scope project \
  --project-id my-gcp-project \
  --output-file gcp_inventory.json

# Export organization inventory
regscale gcp inventory collect \
  --scope organization \
  --organization-id 123456789012 \
  --output-file org_inventory.json

# Filter by labels
regscale gcp inventory collect \
  --scope project \
  --project-id my-gcp-project \
  --labels "env=prod" \
  --output-file prod_inventory.json

Options:

OptionDescription
--scopeScan scope: project, organization, or folder
--project-idGCP project ID
--organization-idGCP organization ID
--labelsFilter by GCP labels
--output-fileOutput file path

Supported Compliance Frameworks

The GCP integration maps Security Command Center findings to the following compliance frameworks:

FrameworkValueDescriptionUse Case
NIST 800-53 Rev 5NIST800-53R5NIST Special Publication 800-53 Revision 5Federal agencies, FedRAMP authorization
CIS GCP BenchmarkCIS_GCPCIS Google Cloud Platform Foundation BenchmarkGeneral security hardening
FedRAMPFedRAMPFederal Risk and Authorization Management ProgramCloud services for US government
PCI-DSSPCI-DSSPayment Card Industry Data Security StandardPayment processing systems
SOC 2SOC2Service Organization Control 2SaaS providers, service organizations

Framework Selection

Choose the framework that aligns with your compliance requirements:

# In init.yaml
gcpComplianceFramework: 'FedRAMP'

Or via command line:

regscale gcp sync_compliance --regscale-ssp-id 123 --framework FedRAMP

Severity Mapping

GCP Security Command Center finding severities are mapped to RegScale severity levels:

GCP SCC SeverityRegScale Severity
CRITICALCritical
HIGHHigh
MEDIUMModerate
LOWLow

Filtering by Severity

To import only some severities, use the --severity-filter option. The command does not read a severity filter from init.yaml. Read the
warning under Findings Synchronization before you use it in a run of the init.yaml scope.

regscale gcp sync_findings --regscale-ssp-id 123 --scope project --project-id my-other-project \
  --severity-filter CRITICAL,HIGH,MEDIUM

Inventory Resources

The GCP integration collects the following resource types:

Compute Resources

  • Compute Engine instances, disks, images, snapshots
  • Instance groups and templates
  • GKE clusters and node pools
  • Cloud Run services and revisions
  • Cloud Functions
  • App Engine services and versions

Storage Resources

  • Cloud Storage buckets
  • Filestore instances and backups

Database Resources

  • Cloud SQL instances
  • Cloud Spanner instances
  • BigTable instances
  • Firestore databases
  • Memorystore (Redis) instances
  • BigQuery datasets

Networking Resources

  • VPC networks and subnets
  • Firewall rules
  • Load balancers
  • Cloud NAT gateways
  • VPN gateways and tunnels
  • Cloud DNS zones

Security Resources

  • Service accounts and keys
  • IAM policies and custom roles
  • KMS key rings and crypto keys
  • Security Command Center findings

Logging Resources

  • Log sinks
  • Log-based metrics
  • Audit log configurations

Caching

The GCP integration caches inventory data to reduce API calls and improve performance.

Cache Settings

# Cache time-to-live in hours (default: 8)
gcpCacheTTLHours: 8

Cache Location

  • Inventory cache: artifacts/gcp/inventory.json
  • Session cache: ~/.regscale/gcp_sessions/

Bypassing Cache

To fetch fresh data and bypass the cache:

regscale gcp sync_assets --regscale-ssp-id 123 --force-refresh

Troubleshooting

Common Issues

"Permission denied" or "403 Forbidden" Errors

Cause: Service account lacks required IAM roles.

Solution:

  1. Verify the service account has the required roles at the correct scope level
  2. Organization-level permissions are required for sync_compliance
  3. Wait a few minutes after granting permissions for propagation
# Verify service account roles
gcloud projects get-iam-policy PROJECT_ID \
  --flatten="bindings[].members" \
  --filter="bindings.members:serviceAccount:YOUR_SERVICE_ACCOUNT"

"API not enabled" Errors

Cause: Required GCP API is not enabled for the project.

Solution: Enable the required API:

gcloud services enable securitycenter.googleapis.com
gcloud services enable cloudasset.googleapis.com

"Security Command Center is not enabled" Errors

Cause: SCC is not enabled for the organization/project.

Solution:

  1. Navigate to Security Command Center in the GCP Console
  2. Enable Security Command Center for your organization
  3. Wait for initial scan to complete (may take several hours)

Stale or Outdated Data

Cause: Cached data is being returned.

Solution: Use the --force-refresh flag:

regscale gcp sync_assets --regscale-ssp-id 123 --force-refresh

No Findings Returned

Cause: Severity filter is excluding all findings, or no findings exist.

Solution:

  1. Check the --severity-filter setting
  2. Verify Security Health Analytics is enabled in SCC
  3. Check that findings exist in the SCC Console
# Include all severities: give no --severity-filter
regscale gcp sync_findings --regscale-ssp-id 123

Authentication Failures

Cause: Invalid or expired credentials.

Solution:

  1. Verify the JSON key file is valid and not corrupted
  2. Check that the service account has not been deleted
  3. Generate a new key if necessary
# Test authentication
regscale gcp authenticate --credentials-file /path/to/key.json

Validation Commands

Use these commands to validate your setup:

# Test authentication and credentials
regscale gcp authenticate --credentials-file /path/to/key.json

# Check what assets are visible
regscale gcp inventory collect \
  --scope project \
  --project-id my-project \
  --output-file test_inventory.json

# Verify API access with gcloud
gcloud asset list --project=my-project --limit=5
gcloud scc findings list organizations/ORG_ID --limit=5

Debug Logging

Enable debug logging for detailed troubleshooting:

# Set log level to DEBUG
export LOGLEVEL=DEBUG

# Run command with verbose output
regscale gcp sync_findings --regscale-ssp-id 123

Security Best Practices

  1. Least Privilege: Grant only the minimum required permissions
  2. Key Rotation: Rotate service account keys regularly
  3. Secure Storage: Never commit credentials to version control
  4. Environment Variables: Use environment variables or secrets managers for CI/CD
  5. Audit Logging: Enable Cloud Audit Logs to track API access
  6. Service Account Naming: Use descriptive names to identify purpose (e.g., regscale-integration)

Environment Variables Reference

VariableDescriptionExample
GOOGLE_APPLICATION_CREDENTIALSPath to service account JSON key/path/to/key.json
GCP_CREDENTIALS_JSONRaw JSON credentials string{"type": "service_account"...}
GCP_CREDENTIALS_JSON_BASE64Base64-encoded JSON credentialseyJ0eXBlIjoi...
GCP_PROJECT_IDGCP project IDmy-gcp-project
GCP_ORGANIZATION_IDGCP organization ID123456789012

Related Resources


Did this page help you?