How bishopfox/cloudfox works
Main components
• Command Line Interface (CLI) Layer – Represented by files in the “cli” directory and the main.go file. This is the entry point that parses user input and delegates actions.
• Cloud Provider Modules – Separate major modules exist for each cloud provider:
– AWS – Found in the “aws” directory (including extensive sub-packages like aws/sdk, aws/graph, tests, and various command implementations).
– Azure – Handled in the “azure” directory (with inventory, RBAC, storage, and VM enumeration).
– GCP – Located in the “gcp” folder (commands and services for its multiple cloud operations).
• Shared & Internal Libraries – Items in “globals” and “internal” provide common functionality such as logging, utility functions, caching, output formatting, and internal policies.
• CI/CD and Testing – The “.github” folder (with workflows) indicates established processes for continuous integration, and the presence of test files in virtually every module shows a test-driven approach.
• Miscellaneous Assets – The “misc” directory contains supporting data (e.g., a sample AWS policy) used by the system.
Relationships and interactions
• The CLI layer (main.go, cli/aws.go, cli/azure.go, cli/gcp.go) directs control to the respective provider modules based on the user’s input.
• Within each provider module, commands invoke various sub-packages and services. For example, the AWS module calls functions from its “sdk” subdirectory (which wraps external AWS APIs) and uses graph building (found under aws/graph) to analyze relationships.
• Shared components (in “globals” and “internal”) are used across modules to handle tasks like logging, output formatting, and common utility operations.
• External interactions: Each provider module (via its SDK wrappers) communicates with the external cloud provider APIs (AWS, Azure, GCP).
• The testing directories and test-data folders are used to simulate cloud responses, confirming the modular design and verifying behavior.
Important architectural patterns
• Modularity – The design clearly decomposes the system into provider-specific modules, allowing each cloud provider’s implementation to be developed and enhanced independently.
• Layered Architecture – There’s a clear separation between the CLI/input handling, business logic (the enumeration commands per provider), and external API integrations.
• SDK Wrapper Pattern – AWS and other providers have dedicated “sdk” packages that encapsulate API communications (with corresponding mocks) to facilitate testing and easy future modifications.
• Use of common internal and global libraries for repeating concerns such as logging, output management, and utility functions.
Relevant technologies and frameworks
• Programming Language: Go (with its package/module structure clearly visible)
• CI/CD: GitHub workflows in the “.github/workflows” directory, indicating continuous integration and automated testing.
• Testing: Built-in testing via separate test files (e.g., *_test.go) and test-data directories to simulate API responses.
• External Integration: AWS CLI, Azure CLI, and GCP authentication for cloud API access, as described in the README.