Home / Docs / Advanced

Advanced

A deep dive into Falcn’s architecture, from high-level system design to individual component interactions.

System Overview

Falcn is built as a modular, pipeline-based security scanner designed for high throughput and extensibility. The architecture separates concerns between input parsing, detection algorithms, AI analysis, and output generation.

High-Level Architecture

Figure 1: Falcn processes packages through multiple detection layers before generating outputs

Core Components

๐Ÿ“ฅ Input Layer

Accepts requests from CLI, REST API, or CI/CD webhooks. Normalizes input into a standard PackageRequest format regardless of source.

โš™๏ธ Core Engine

Orchestrates the scanning pipeline. Manages concurrency, caching, and coordination between detection algorithms.

๐Ÿ” Detection Layer

Runs multiple detection algorithms in parallel. Each algorithm produces independent threat scores that are aggregated.

๐Ÿค– AI Layer

Optional component that generates human-readable explanations using locally-running LLMs via Ollama.

Scan Pipeline Flow

When a scan is initiated, packages flow through a multi-stage pipeline:

Scan Pipeline Sequence

Figure 2: Sequence diagram showing the scan pipeline from user request to output

Detection Algorithm Architecture

RUNT (Registry Uncover Naming Threats)

RUNT specializes in detecting typosquatting attacks by comparing package names against known legitimate packages using multiple string similarity algorithms.

RUNT Detection Flow

Figure 3: RUNT uses multiple string analyzers to detect typosquatting

Attack Types Detected

Attack TypeExampleTarget
CHARACTER_OMISSIONcros-envcross-env
CHARACTER_SWAPaxoisaxios
CHARACTER_INSERTIONexpresssexpress
HOMOGLYPHcross-ะตnv (Cyrillic ะต)cross-env
KEYBOARD_TYPOlodasjlodash

DIRT (Dependency Intelligence Risk Tracker)

DIRT assesses business and security risk based on package metadata, maintainer activity, and historical patterns.

๐Ÿ“Š Risk Signals

  • Package age & download trends
  • Maintainer activity
  • Dependency count
  • Known CVEs
  • License type

โš–๏ธ Risk Levels

  • LOW – Minimal concern
  • MEDIUM – Review recommended
  • HIGH – Significant risk
  • CRITICAL – Immediate action

GTR (Graph Threat Recognition)

GTR analyzes the dependency graph to identify suspicious patterns:

  • Circular Dependencies – Packages that depend on each other
  • Excessive Depth – Unusually deep dependency chains
  • Shadow Dependencies – Hidden transitive dependencies
  • Namespace Confusion – Internal vs external package conflicts

AI Integration Architecture

Falcn’s AI layer provides human-readable explanations for detected threats without sending code to external services.

๐Ÿ”’ Privacy Guarantee

Only package metadata (name, version, similarity scores) is sent to the local LLM. Your source code, environment variables, and file contents never leave your machine.

Local AI Flow

  1. Threat detected by detection algorithms
  2. Falcn builds a prompt with package metadata only
  3. Prompt sent to local Ollama server (localhost:11434)
  4. LLM (Llama 3, Mistral, etc.) generates explanation
  5. Explanation parsed and included in results

Deployment Architectures

Developer Workstation

Simplest setup – CLI and optional Ollama running locally:

# Install and run
curl -sSL https://falcn.io/install | sh
falcn scan .

CI/CD Pipeline

Integrate with GitHub Actions, GitLab CI, or Jenkins:

- name: Security Scan
  uses: falcn-io/falcn-action@v2
  with:
    mode: fast
    fail-on-violation: true

Enterprise Deployment

For large organizations, deploy Falcn as a service:

  • Load Balancer – Distribute scan requests
  • API Cluster – Multiple Falcn API servers
  • Redis Cache – Shared result caching
  • AI Cluster – Dedicated Ollama nodes
  • Observability – Splunk, Prometheus, Slack integration

Component Reference

ComponentTechnologyPurpose
Scanner EngineGoCore orchestration and parallel processing
Package ParserGoMulti-format manifest parsing
Registry ClientGo + HTTP/2Efficient registry communication
RUNT AlgorithmGoString similarity analysis
DIRT AlgorithmGoRisk scoring engine
GTR AlgorithmGoGraph analysis
SandboxDocker + seccompBehavioral analysis
LLM ConnectorGo + gRPCOllama integration
REST APIGo + Chi routerHTTP interface
Cache LayerRedis / In-memoryResult caching

๐Ÿ“š Want to Contribute?

Falcn is open source! Check out our Contributing Guide to learn about the codebase structure and how to add new detection algorithms.