How sethsec/cloudfox works
Main Components
• Entry Point & CLI Layer: Represent the main.go file as the entry point. This is where the tool is initiated. The “cli” directory further encapsulates the command line interface logic for each provider (aws.go, azure.go, gcp.go).
• Provider Modules: Show distinct modules for each cloud provider:
– Azure Module: Represent the “azure” directory that contains inventory, RBAC, storage, vms, and test-data.
– GCP Module: Illustrate the “gcp” directory which is split into “commands” and “services” subfolders handling operations like instances, IAM, buckets, and more.
• Shared/Global Libraries: Include components like the “globals” and “internal” directories. These hold shared utility functions (e.g., logging, common types, output handling, array utilities) and domain-specific logic such as AWS policy evaluation.
• Configuration & CI/CD: Optionally note the GitHub workflows and configuration files (e.g., .github/workflows, Makefile, go.mod, go.sum) as supporting infrastructure for build, testing, and deployment.
Relationships and Interactions
• Provider Internals: Within each provider module:
• For AWS, illustrate further splitting into submodules for graphing, SDK wrappers (mock and real), and helper files that perform service-specific enumerations (for instance, “iam-simulator”, “resource-trusts”, “pmapper”).
• Testing Support: Note that each provider has associated test files (named *_test.go) grouped alongside the implementation components. This shows a layer of validation and quality assurance without cluttering the high-level architecture.
Architectural Patterns & Design Principles
• Command Pattern: The numerous commands (listed in the README) and individual command files indicate a design where each command is implemented as a separate module or function – represent these as smaller blocks within each provider container.
• Abstraction & Wrapping: The use of an “sdk” directory (with production and mock files) suggests that CloudFox wraps standard cloud SDKs with its own abstractions. Show this as a subsystem inside the AWS (and analogous in other providers) module.