GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - CrowdStrike/foundry-sample-functions-python: Functions with Python sample Foundry app

BranchesTags
Open more actions menu

Latest commit

 

History

193 Commits
193 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
api-integrations
api-integrations
 
 
app_docs
app_docs
 
 
collections
collections
 
 
e2e
e2e
 
 
functions
functions
 
 
images
images
 
 
ui/extensions/hello
ui/extensions/hello
 
 
workflows
workflows
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.pylintrc
.pylintrc
 
 
CITATION.cff
CITATION.cff
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
SUPPORT.md
SUPPORT.md
 
 
manifest.yml
manifest.yml
 
 

Repository files navigation

CrowdStrike Falcon

Functions with Python sample Foundry app

The Functions with Python sample Foundry app is a community-driven, open source project which serves as an example of an app which can be built using CrowdStrike's Foundry ecosystem. foundry-sample-functions-python is an open source project, not a CrowdStrike product. As such, it carries no formal support, expressed or implied.

This app is one of several App Templates included in Foundry that you can use to jumpstart your development. It comes complete with a set of preconfigured capabilities aligned to its business purpose. Deploy this app from the Templates page with a single click in the Foundry UI, create an app from this template using the Foundry CLI, or download it as a zip and import it.

Important

To view documentation and deploy this sample app, you need access to the Falcon console.

Description

The Functions with Python sample Foundry app shows how to use Python functions with FalconPy, workflows, API integrations, collections, and UI extensions.

Prerequisites

  • The Foundry CLI (instructions below).
  • pre-commit for secret scanning
  • Python 3.14+ (needed if running the app's functions locally). See Python For Beginners for installation instructions.

Install the Foundry CLI

You can install the Foundry CLI with Scoop on Windows or Homebrew on Linux/macOS.

Windows:

Install Scoop. Then, add the Foundry CLI bucket and install the Foundry CLI.

scoop bucket add foundry https://github.com/crowdstrike/scoop-foundry-cli.git
scoop install foundry

Or, you can download the latest Windows zip file, expand it, and add the install directory to your PATH environment variable.

Linux and macOS:

Install Homebrew. Then, add the Foundry CLI repository to the list of formulae that Homebrew uses and install the CLI:

brew tap crowdstrike/foundry-cli
brew install crowdstrike/foundry-cli/foundry

Run foundry version to verify it's installed correctly.

Getting Started

Clone this sample to your local system, or download as a zip file and import it into Foundry.

git clone https://github.com/CrowdStrike/foundry-sample-functions-python
cd foundry-sample-functions-python

Set up secret scanning:

pip install pre-commit
pre-commit install

Log in to Foundry:

foundry login

Select the following permissions:

  • Create and run RTR scripts
  • Create, execute and test workflow templates
  • Create, run and view API integrations
  • Create, edit, delete, and list queries

Deploy the app:

foundry apps deploy

Tip

If you get an error that the name already exists, change the name to something unique to your CID in manifest.yml.

Once the deployment has finished, you can release the app:

foundry apps release

Next, go to Foundry > App catalog, find your app, and install it. Go to Fusion SOAR > Workflows to see the test workflows from this app.

Testing

This sample has two kinds of tests: unit tests that run locally with mocked dependencies, and integration tests that run against the deployed functions.

Unit tests

Each function has a test_main.py. Create a virtual environment at the root of the repo, install the function's dependencies and pytest, and run pytest from the function's directory:

python3 -m venv .venv
source .venv/bin/activate
pip install -r functions/hello/requirements.txt pytest
cd functions/hello && pytest

Keep the virtual environment at the repo root. A .venv inside a function's directory is never deployed, but foundry functions exec and foundry functions test count it as an undeployed local change.

Integration tests

The hello and host-details functions have a tests.yml with test cases that foundry functions test runs against the deployed function (Foundry CLI 2.1.0 or later). Deploy the app first, then run:

foundry functions test --function hello

The host-details tests call the Hosts API through FalconPy, which needs an installed app. Release and install the app once, replace YOUR_HOST_AID_HERE in functions/host-details/tests.yml with a host ID from Host management in the Falcon console, then run:

foundry functions test --function host-details

Use --case <name> to run a single test case. Until the app is installed, the valid_host_id and invalid_host_id cases return 403 with app is not installed.

About this sample app

This sample is designed to show how to use Python Functions in Falcon Foundry. It contains a few capabilities:

  1. Python functions:

    • hello: Simple greeting service
    • host-details: Uses FalconPy to get Host details
    • servicenow: Uses FalconPy to invoke an API Integration
    • log-event: Uses FalconPy to store data in a collection
  2. Test workflows to invoke each function.

  3. A UI extension on Endpoint security > Endpoint detections that can be used to call the hello function.

See this sample's App docs README for configuration and usage information.

Technical Implementation

  • Built on CrowdStrike's Foundry Function framework
  • Written in Python with dependencies including:
    • crowdstrike-foundry-function and FalconPy for CrowdStrike API integration

Foundry resources

  • Falcon Foundry documentation
  • Getting started with Falcon Foundry

Secret Scanning

This repository enforces secret scanning on every commit via the pre-commit framework using betterleaks, a tool that detects secrets and credentials in source code before they are committed.

Setup

# Install pre-commit (run once)
brew install pre-commit

# Register the git hook (run once after cloning)
pre-commit install

How it works

On each git commit, betterleaks scans all staged files for secrets and credentials.

Scenario Result
Secret detected in staged files Commit blocked
No secrets found Commit allowed
pre-commit not installed No hook runs (secrets not scanned)

Bypass (false positives only):

git commit --no-verify


WE STOP BREACHES

About

Functions with Python sample Foundry app

www.crowdstrike.com/tech-hub/ng-siem/dive-into-falcon-foundry-functions-with-python/

Topics

falcon-foundrypython

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

7 stars

Watchers

4 watching

Forks

2 forks
Report repository

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.