A CLI app that runs AI-powered security workflows
Project description
Fraim
A flexible framework for security teams to build and deploy AI-powered workflows that complement their existing security operations.
🔭 Overview
Fraim empowers security teams to easily create, customize, and deploy AI workflows tailored to their specific security needs. Rather than providing a one-size-fits-all solution, Fraim gives teams the building blocks to construct intelligent automation that integrates seamlessly with their existing security stack. Fraim comes built as a CLI, but you can also run workflows via our Github Action.
❓ Why Fraim?
- Framework-First Approach: Build custom AI workflows instead of using rigid, pre-built tools
- Security Team Focused: Designed specifically for security operations and threat analysis
- Extensible Architecture: Easily add new workflows, data sources, and AI models
🔎 Preview
Output of running the
code workflow
Github Action Quick Start
NOTE: This example assumes you are using a Gemini based model. If you’d like to use an OpenAI based model, replace references of GEMINI with OPENAI and specify an OpenAI model in the action arguments.
Set your API key as a Secret in your repo. - Settings -> Secrets and Variables -> New Repository Secret -> GEMINI_API_KEY Define your workflow inside your repo at .github/workflows/<action_name>.yml
name: AI Security Scan
on:
pull_request:
branches: [main]
jobs:
security-scan:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
security-events: write # Required for uploading SARIF
pull-requests: write # Required for PR comments and annotations
steps:
- name: Run Fraim Security Scan
uses: fraim-dev/fraim-action@v0
with:
gemini-api-key: ${{ secrets.GEMINI_API_KEY }}
workflows: "code"
🚀 CLI Quick Start
Prerequisites
- Python 3.12+
- pipx installation tool
- API Key for your chosen AI provider (Google Gemini, OpenAI, etc.)
Installation
NOTE: These instructions are for Linux based systems, see docs for Windows installation instructions
- Install Fraim:
pipx install fraim
-
Configure your AI provider:
Google Gemini
- Get an API key from Google AI Studio
- Export it in your environment:
export GEMINI_API_KEY=your_api_key_here
OpenAI
- Get an API key from OpenAI Platform
- Export it in your environment:
export OPENAI_API_KEY=your_api_key_here
Basic Usage
# Run code security analysis on a Git repository
fraim code --location https://github.com/username/repo-name
# Analyze local directory
fraim code --location /path/to/code
💬 Community & Support
Join our growing community of security professionals using Fraim:
- Documentation: Visit docs.fraim.dev for comprehensive guides and tutorials
- Schedule a Demo: Book time with our team - We'd love to help! Schedule a call for anything related to Fraim (debugging, new integrations, customizing workflows, or even just to chat)
- Slack Community: Join our Slack - Get help, share ideas, and connect with other security minded people looking to use AI to help their team succeed
- Issues: Report bugs and request features via GitHub Issues
- Contributing: See the contributing guide for more information.
📖 Documentation
Running Workflows
# Adjust performance settings
fraim code --location /code --chunk-size 1000
# Enable debug logging
fraim --debug code --location /code
# Custom output location
fraim --output /path/to/results/ code --location /code
Observability
Fraim supports optional observability and tracing through Langfuse, which helps track workflow performance, debug issues, and analyze AI model usage.
To enable observability:
- Install with observability support:
pipx install 'fraim[langfuse]'
- Enable observability during execution:
fraim --observability langfuse code --location /code
This will trace your workflow execution, LLM calls, and performance metrics in Langfuse for analysis and debugging.
Configuration
Fraim uses a flexible configuration system that allows you to:
- Customize AI model parameters
- Configure workflow-specific settings
- Set up custom data sources
- Define output formats
See the fraim/config/ directory for configuration options.
Key Components
- Workflow Engine: Orchestrates AI agents and tools
- LLM Integrations: Support for multiple AI providers
- Tool System: Extensible security analysis tools
- Input Connectors: Git repositories, file systems, APIs
- Output Formatters: JSON, SARIF, HTML reports
🔧 Available Workflows
Fraim includes several pre-built workflows that demonstrate the framework's capabilities:
Code Security Analysis
Status: Available Workflow Name: code
Automated source code vulnerability scanning using AI-powered analysis. Detects common security issues across multiple programming languages including SQL injection, XSS, CSRF, and more.
Example
fraim code --location https://github.com/username/repo-name
Infrastructure as Code (IAC) Analysis
Status: Available Workflow Name: iac
Analyzes infrastructure configuration files for security misconfigurations and compliance violations.
Example
fraim iac --location https://github.com/username/repo-name
🛠️ Building Custom Workflows
Fraim makes it easy to create custom security workflows:
1. Define Input and Output Types
# workflows/<name>/workflow.py
@dataclass
class MyWorkflowInput:
"""Input for the custom workflow."""
code: Contextual[str]
config: Config
type MyWorkflowOutput = List[sarif.Result]
2. Create Workflow Class
# workflows/<name>/workflow.py
# Define file patterns for your workflow
FILE_PATTERNS = [
'*.config', '*.ini', '*.yaml', '*.yml', '*.json'
]
# Load prompts from YAML files
PROMPTS = PromptTemplate.from_yaml(os.path.join(os.path.dirname(__file__), "my_prompts.yaml"))
@workflow('my_custom_workflow')
class MyCustomWorkflow(Workflow[MyWorkflowInput, MyWorkflowOutput]):
"""Analyzes custom configuration files for security issues"""
def __init__(self, config: Config, *args, **kwargs):
super().__init__(config, *args, **kwargs)
# Construct an LLM instance
llm = LiteLLM.from_config(config)
# Construct the analysis step
parser = PydanticOutputParser(sarif.RunResults)
self.analysis_step = LLMStep(llm, PROMPTS["system"], PROMPTS["user"], parser)
async def workflow(self, input: MyWorkflowInput) -> MyWorkflowOutput:
"""Main workflow execution"""
# 1. Analyze the configuration file
analysis_results = await self.analysis_step.run({"code": input.code})
# 2. Filter results by confidence threshold
filtered_results = self.filter_results_by_confidence(
analysis_results.results, input.config.confidence
)
return filtered_results
def filter_results_by_confidence(self, results: List[sarif.Result], confidence_threshold: int) -> List[sarif.Result]:
"""Filter results by confidence."""
return [result for result in results if result.properties.confidence > confidence_threshold]
3. Create Prompt Files
Create my_prompts.yaml in the same directory:
system: |
You are a configuration security analyzer.
Your job is to analyze configuration files for security misconfigurations and vulnerabilities.
<vulnerability_types>
Valid vulnerability types (use EXACTLY as shown):
- Hardcoded Credentials
- Insecure Defaults
- Excessive Permissions
- Unencrypted Storage
- Weak Cryptography
- Missing Security Headers
- Debug Mode Enabled
- Exposed Secrets
- Insecure Protocols
- Missing Access Controls
</vulnerability_types>
{{ output_format }}
user: |
Analyze the following configuration file for security issues:
{{ code }}
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Fraim is built by security teams, for security teams. Help us make AI-powered security accessible to everyone.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fraim-0.3.1.tar.gz.
File metadata
- Download URL: fraim-0.3.1.tar.gz
- Upload date:
- Size: 9.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e99168fcfe83b1c6fcd8bc7900de2f2eb96b3e8e49b2949510a30e4894cc3d8
|
|
| MD5 |
8ab4a1e8b1300c87f21581964280fed2
|
|
| BLAKE2b-256 |
d0c3c56a2cdec865ae30c1a6a319d7ae065ce0355ef4473a76e6d0078b891253
|
Provenance
The following attestation bundles were made for fraim-0.3.1.tar.gz:
Publisher:
publish.yml on fraim-dev/fraim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fraim-0.3.1.tar.gz -
Subject digest:
6e99168fcfe83b1c6fcd8bc7900de2f2eb96b3e8e49b2949510a30e4894cc3d8 - Sigstore transparency entry: 289587223
- Sigstore integration time:
-
Permalink:
fraim-dev/fraim@d6d666cc74f07993885ec1d491b489966ad9ed4e -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/fraim-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d6d666cc74f07993885ec1d491b489966ad9ed4e -
Trigger Event:
release
-
Statement type:
File details
Details for the file fraim-0.3.1-py3-none-any.whl.
File metadata
- Download URL: fraim-0.3.1-py3-none-any.whl
- Upload date:
- Size: 149.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f660edfc45d072130687a8f050afd3f807c71da56c02c19bd20c146384be131
|
|
| MD5 |
7f19621ecbeda22e450e2a2a4d90b9f4
|
|
| BLAKE2b-256 |
a252a84cbde599f0ed2bb8051aae48fe638a4e5debb7ae0dac5485f4e0cca8f7
|
Provenance
The following attestation bundles were made for fraim-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on fraim-dev/fraim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fraim-0.3.1-py3-none-any.whl -
Subject digest:
0f660edfc45d072130687a8f050afd3f807c71da56c02c19bd20c146384be131 - Sigstore transparency entry: 289587278
- Sigstore integration time:
-
Permalink:
fraim-dev/fraim@d6d666cc74f07993885ec1d491b489966ad9ed4e -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/fraim-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d6d666cc74f07993885ec1d491b489966ad9ed4e -
Trigger Event:
release
-
Statement type: