Overview
ThePassRunner class runs a list of obfuscation passes over a Dart kernel Component. It creates a shared PassContext that all passes can access to coordinate symbol table updates, name generation, and configuration options.
Constructor
Ordered list of obfuscation passes to run. Passes execute sequentially in the order provided.
Optional Mason logger for logging pass execution progress
Methods
run()
Runs all passes on the given component and returns the modified component along with the symbol table.The kernel
Component to obfuscate. This is mutated in-place by the passes.Configuration options for all passes, including exclude patterns and feature flags
Returns a tuple containing:
- The modified kernel
Component(same instance, mutated in-place) - The
SymbolTablewith all recorded identifier mappings
Supporting Classes
PassContext
Shared mutable context passed to every obfuscation pass.Shared symbol table for recording identifier mappings
Shared name generator for producing obfuscated identifiers
Configuration options including exclusion patterns and feature flags
shouldObfuscateLibrary()
Determines if a library should be obfuscated based on its import URI.false for:
- SDK libraries (
dart:*) - Libraries matching
excludeLibraryUriPatterns - Third-party packages (only project package is obfuscated)
PassOptions
Configuration options for the obfuscation engine.URI/path glob patterns for libraries to skip entirely
If true, the top-level
main procedure is not renamedRegex patterns for string literals that should not be encrypted
If true, enable verbose logging
Pass
Base class for all obfuscation passes.Human-readable name used in logging and CLI
--passes flagrun() to mutate the component in-place using the shared context.
Usage Example
Passes are executed sequentially in the order provided. Each pass sees the modifications made by previous passes.
The
PassContext provides a shouldObfuscateLibrary() helper that automatically excludes SDK libraries, third-party packages, and libraries matching your exclude patterns.Creating Custom Passes
Extend thePass base class to create your own obfuscation transformation:
Related
RefractorEngine
High-level engine that uses PassRunner internally
SymbolTable
Tracks identifier mappings produced by passes