Contact
- Email: [email protected]
Table
Summary
Welcome to the exciting world of Snyk automation! As a passionate advocate for efficient cybersecurity practices, I am thrilled to introduce my latest project - a dedicated repository of Snyk automation scripts tailored for enterprise environments. Snyk, as many of you might know, is a powerful tool that helps identify and fix vulnerabilities in code and dependencies. While it offers incredible out-of-the-box features, I believe that automation can significantly enhance its capabilities, especially in complex enterprise settings. In this blog, we will delve into the nuances of these scripts. Join me as we embark on this journey to make cybersecurity more efficient and robust with the power of automation!
Prerequisites
Configuration Setup Instructions
File Rename:
Rename theconfig-template.py
toconfig.py
.Adding Credentials:
Insideconfig.py
, you’ll need to add yourgroupId
,sourceOrgId
, andAuthorization
tokens.- groupId:
This is your group ID value. To find it:- Navigate to your main group.
- Look at the URL:
https://app.snyk.io/group/{groupId}
. The{groupId}
portion is your value.
- sourceOrgId:
This represents the organization you’ll use to clone all the configurations. It’s a best practice when setting up Snyk to have a default organization with all your configurations in one place, making it easier to clone configurations to other organizations.- Go to the settings of your default organization.
- Locate the “organization id”. This will be the value for
sourceOrgId
in yourconfig.py
file.
- Authorization Token:
- Navigate to the bottom left side of the screen and click on your account.
- Choose ‘Account Settings’.
- Under ‘API Token’, click ‘click to show’. This reveals the token, which you’ll use as the
Authorization
in yourconfig.py
file.
- groupId:
CreateNewOrg.py
This script will take a list of organization names from a .csv file with one organization per line, as shown in the example file organization-names.csv
. The script will then create new organizations in the group selected in the config file. For configuration details, refer to the config file section.
One thing to note: This API endpoint will be replaced with a REST API. I will update the script once the update is released. If there is interest and if this comment is still here, the new endpoint hasn’t been released, and I haven’t updated the script.
getOrgList.py
This script will retrieve a list of all your organizations from your Snyk portal along with the slug for each organization. It will then create a .csv file with each entry on a separate line. This is useful for integrating Snyk with AD for custom role mapping, especially when adding new developers to SSO. This ensures they are automatically added to specific applications. Find more info here: Snyk Custom Mapping.
Reference:
https://snyk.docs.apiary.io/# https://apidocs.snyk.io/?version=2023-11-27