-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(misconf): Add reference info on internals of Trivy IaC scanning #8272
Draft
simar7
wants to merge
1
commit into
aquasecurity:main
Choose a base branch
from
simar7:add-misconfig-tech-refs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Architecture | ||
|
||
## Overview | ||
|
||
The following diagram shows the high-level architecture of misconfiguration scanning. | ||
|
||
```mermaid | ||
graph TD; | ||
tf[Terraform] | ||
cf[CloudFormation] | ||
aws[Live AWS Account] | ||
k8s[Kubernetes YAML] | ||
df[Dockerfiles] | ||
k8sparser[Kubernetes Parser/Scanner] | ||
dfparser[Dockerfile Parser/Scanner] | ||
tfparser[Terraform Parser/Scanner] | ||
cfparser[CloudFormation Parser/Scanner] | ||
tfadapter[Terraform Adapter] | ||
cfadapter[CloudFormation Adapter] | ||
awsadapter[AWS Adapter] | ||
checks[OPA Engine] | ||
tf --> tfparser | ||
cf --> cfparser | ||
k8s --> k8sparser | ||
df --> dfparser | ||
tfparser --> tfadapter | ||
cfparser --> cfadapter | ||
aws --> awsadapter | ||
tfadapter --> checks | ||
cfadapter --> checks | ||
awsadapter --> checks | ||
k8sparser --> checks | ||
dfparser --> checks | ||
checks --> Result | ||
``` | ||
|
||
## Component breakdown | ||
|
||
Trivy Misconfiguration scanner can be divided into the following components as show below. | ||
|
||
![misconfig-code-org](../../imgs/misconfig-code-org.jpg) | ||
|
||
Trivy is able to obtain input from both IaC and Live Clouds when it comes to misconfiguration scanning. | ||
In the case of IaC scanning, language models such as Terraform and CloudFormation are used to build the common model. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
For Live Cloud scanning, API calls are made directly to the Cloud provider and information is obtained. | ||
|
||
Ultimately, Trivy is able to "normalize" the various sources into a single common denominator which is the same across all input methods by which the resource could be constructed. | ||
|
||
|
||
### `pkg/iac` directory | ||
|
||
The `pkg/iac` components can be described as follows. | ||
|
||
| Component | Description | | ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| Adapters | They are responsible for "adapting" language specific model and transforming it into a common object understood by Trivy | | ||
| Providers | Providers "provide" a language specific model to the scanners, thereby enabling the scanner to call the adapter to "adapt" into a common model | | ||
| Scanners | Scanners take the input that providers provide and ask the adapters to adapt it into a common object. This common object is then run through with checks and finally the result is obtained | | ||
|
||
|
||
|
||
|
||
Furthermore, misconfiguration scanning can be visualized with the following code flow chart. | ||
|
||
![misconfig-iac-functioning](../../imgs/misconfig-iac-functioning.jpg) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the term
Live Clouds
common?