Security? Check! — Using Checks for Compliance

Imran Roshan
Google Cloud - Community
5 min readJul 31, 2024

Utilizing Google Checks for App/Code compliance and AI Safety on GCP.

Wouldn’t it be absolutely amazing to help manage compliance on your GCP workloads with efficiency that too with the added sprinkle of AI to make it better?? Checks to the rescue!!!

What is Checks?

Google Checks is an AI-powered tool made to make sure your app complies with privacy laws as simple and quick as possible. In order to assist you in recognizing and resolving any possible privacy concerns, it offers automated analysis, end-to-end monitoring, and practical recommendations.

Checks may identify privacy concerns in your app’s code, resources, and configurations by utilizing cutting-edge AI technologies. It gives a thorough report detailing any problems and offers detailed instructions on how to fix them.

https://developers.googleblog.com/en/checks-now-available-to-all-developers/

Features

  • App Compliance: Checks keeps an eye on whether your app complies with pertinent laws, like the CCPA, GDPR, and others. It points out possible infractions and provides fixes to guarantee compliance.
  • Code Compliance: Checks finds privacy-related problems in your codebase and makes recommendations for fixes. This preserves the security and quality of the code.
  • AI Safety: By highlighting potential biases and hazards, Checks helps developers of AI models ensure responsible development and deployment.
  • Information Monitoring: See how your app gathers and shares information. Checks assist you in recognizing possible vulnerabilities and comprehending data flow.
  • Compliance Monitoring: Automate the procedure of comparing the policies and regulations of the app store with your application.

So how does it help?

  • Simplifies Compliance: Saves time and money by automating a number of privacy compliance-related chores.
  • Increases Accuracy: When utilizing AI for analysis, more thorough and accurate insights are obtained in comparison to conventional methods.
  • Lowers Risk: You can lessen the chance of facing fines from the government and harm to your reputation by spotting and fixing privacy-related concerns early on.
  • Increases User Trust: You can gain users’ trust by showcasing your dedication to privacy.

Compliance Standpoint

Google Checks uses cutting-edge AI to thoroughly examine your app for privacy flaws. It addresses several different privacy-related topics, such as:

  1. Data collecting and Usage: Verifies that your app’s data collecting procedures adhere to legal requirements as well as user expectations.
  2. Data Sharing: Examines and highlights any hazards in the data shared both inside and outside of your application.
  3. Data Security: Assesses data transport and storage techniques to safeguard user data.
  4. User Consent: Confirms that consent from users has been properly obtained for the collection and use of their data.
  5. Regulation Compliance: Evaluates how well your app complies with various privacy rules, including the CCPA and GDPR.

Integrating your Application

Your app has to be developed with Gradle and have the Android Gradle Plugin activated in order to use the Checks SDK tracking functionality. Verify that the Android Gradle Plugin is up to date in your instance of Android Studio and that you haven’t disabled this feature.

Further feel free to integrate your Jenkins Pipelines for a more automated approach and to make time for that cup of coffee you deserve

pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building APK ...'
sh 'build-apk-cmd'
}
}
stage('Checks Analysis') {
steps {
script {
ACCOUNT_ID = "your_account_id"
APP_ID = "your_app_id"
BINARY_PATH = "${WORKSPACE}/path/to/binary.apk"

echo 'Starting Checks Analysis ...'

sh "./checks report generate --binary-path=${BINARY_PATH} --app-id=${APP_ID} --account-id=${ACCOUNT_ID} --no-input --json --wait-and-print-report > checks_results.json"

echo "Wrote Checks analysis results to checks_results.json"

def report = readJSON file: "${WORKSPACE}/checks_results.json"

echo "Generated report name: ${report.name}"
echo "Report console URL: ${report.resultsUri}"

def failingChecks = []
for (check in report.checks) {
if (check.severity.toString() == "PRIORITY" && check.state.toString() == "FAILED") {
failingChecks.push(check)
}
}

if (failingChecks.size() > 0) {
echo "${failingChecks.size()} priority issue(s) detected: "
for (check in failingChecks) {
echo "Type: ${check.type}. Details: ${check}"
}
error('Failing build because Checks detected at least one priority issue.')
}
}
}
}
}
post {
failure {
echo "Pipeline failed :("
}
}
}

Let’s see another example of generating a report for us but hey let’s just assume we have a Checks library for Python:

Even though we are unable to use Checks directly through Python just now, we may improve this code to be more helpful if Google Checks is made available as an official API:

from google.cloud import checks  # Assuming Google Checks API becomes available

# Replace with the path to your app's directory
app_dir = "/path/to/your/app"

def analyze_app(app_dir):
"""Analyzes an app using Google Checks (if available).

Args:
app_dir: Path to the app's directory.

Returns:
None (prints results to console).
"""

try:
# Create a Checks client
client = checks.Client()

# Analyze the app
results = client.run_checks(app_dir)

# Print results with better formatting
print(f"Google Checks Results:")
print("-" * 50)

for finding in results.findings:
print(f"Finding ID: {finding.id}")
print(f"Description: {finding.description}")
print(f"Severity: {finding.severity}")

if finding.recommendation:
print(f"Recommendation: {finding.recommendation}")

print("-" * 20)

except Exception as e:
print(f"Error analyzing app: {e}")

if __name__ == "__main__":
analyze_app(app_dir)

Disclaimer: Google Checks is a platform, not a Python library or API. It’s designed for human interaction to analyze applications and provide reports. There’s no direct Python code integration for automating checks within the platform at this time. This code is just a FANTASY (atleast for now).

What Next?

While Checks currently being in Beta feel free to explore the possibilities to help attain a secure compliance standpoint for your applications. Code compliance is an ongoing process. Continuous monitoring and improvement are crucial for maintaining high code quality and security.

Try looking into the platform and documentation for more:

Connect with me

--

--

Imran Roshan
Google Cloud - Community

Your security sherpa | Google Developer Expert (GCP) | Ethical Hacker | Cloud Security