Set up Insights: Associating Snyk Open Source, Code, and Container Projects
Last updated
Last updated
More information
Snyk privacy policy© 2024 Snyk Limited | All product and company names and logos are trademarks of their respective owners.
The Insights feature is available only with Snyk AppRisk Pro.
After you have set up insights, Snyk can set up the required linking for the chosen application.
To prioritize your Snyk Code and Snyk Open Source vulnerabilities, Snyk needs to understand the relationships between those imported Snyk Projects and the Container Project. Snyk uses the relationships between these Projects as a proxy to understand the composition of the container image.
The Set up Insights UI displays a variety of asset types, including but not limited to:
Repository assets
Packages
Container images
Scanned artifacts
These assets are directly linked to the ones displayed on the Snyk AppRisk Inventory view.
The container image is the build artifact that is deployed and running on your Kubernetes cluster, so Snyk can map your application from its source code to its deployed state by understanding the following:
The link between the Source Code and Open Source Dependencies and the image.
What images are deployed to Kubernetes, and how are they configured.
Add Snyk Project tags to all the Projects used by your application to link these Projects together and allow Snyk to represent the whole application that you are testing.
To associate two Projects together, add the exact same tag to both Projects. For example, add the same tag to your Snyk Open Source Projects and Snyk Container Project if they are related to each other.
See the examples at the end of this section.
The same tag must be applied to the container image and Code or Open Source Projects,
The tag must follow the specified format,
The Projects do not have to be in the same Snyk Organization to be mapped but MUST be in the same Snyk Group,
In this example, there is a single repository containing your package.json which is built into an image called image-A.
To map these associations, you would have the following tags set up:
Location | Asset | Snyk Project Location | Tag(s) | Notes |
---|---|---|---|---|
github.com/my-team/front-end |
| Snyk Org: my-team Project name: package.json |
| The same tag is applied to both sides |
| Built container image called | Snyk Org: my-team Project name: image-A |
|
For this scenario, there are two contributing repositories.
There is a front-end repository containing the package.json scanned by Snyk Open Source and a back-end repository containing go code scanned by Snyk Code.
To map these associations, you would have the following tags set up:
Location | Asset | Snyk Project Location | Tag(s) | Notes |
---|---|---|---|---|
github.com/my-team/front-end |
| Snyk Org: my-team
Project name: package.json |
|
|
github.com/my-team/back-end |
| Snyk Org: my-team
Project name: Code |
|
|
| Built container image called | Snyk Org: my-team
Project name: image-A |
| The image has two tags applied, as there are two upstream dependencies which have different tags. You can apply multiple tags to an image. |
In this example, the application team is using a monorepo approach. The contents of the repository are built into different container images as they may be run separately.
Here we need to further differentiate the tags by scoping them more accurately.
Location | Asset | Snyk Project Location | Tag(s) | |
---|---|---|---|---|
github.com/my-team/service |
| Snyk Org: my-team
Project name: package.json |
| The tag is further scoped by specifying /front-end at the end |
| Built container image called | Snyk Org: my-team
Project name: my-app-frontend:latest |
|
Location | Asset | Snyk Project Location | Tag(s) | Notes |
---|---|---|---|---|
github.com/my-team/service |
| Snyk Org: my-team
Project name: Code |
| The tag is further scoped by specifying /back-end at the end |
| Built container image called | Snyk Org: my-team
Project name: my-app-backend:latest |
|
Project Tags can be applied as follows:
Product | Method | Project Source |
---|---|---|
Snyk Code |
| For projects created by
|
Snyk Open Source |
| For projects created by
|
Snyk Container |
| For projects created by
|
Snyk recommends applying the tags through the API in order to automate the process. For more information, see the endpoint Add a tag to a project.
snyk monitor --project-tags=component=pkg:github/my-team/back-end@main
See the Project Update documentation.
Example:
To ensure you have set up your Kubernetes Connector properly, navigate to the Set up Insights tab on the Insights page and check the Image composition section to view the data Insights has access to.