-
Notifications
You must be signed in to change notification settings - Fork 44
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
SUP-1602 Snyk task API migration from deprecated version to REST API version #549
Conversation
Snyk Api base url updated
Update rexml gem to address CVE-2024-35176
to avoid issue on the autocheck
testing 2
testing2
going back
@token = token | ||
@api_base_url = "https://#{api_base_url}/v1" |
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.
having api_base_url being just the base in snyk_v2_task and referring to the whole constructed url in snyk_v2_client is confusing and makes the code harder to read, can we change this to be @host or just @api_url ?
tasks/connectors/snyk_v2/readme.md
Outdated
@@ -36,4 +37,5 @@ Complete list of Options: | |||
| kenna_connector_id | false | If set, we'll try to upload to this connector | n/a | | |||
| kenna_api_key | false | Kenna API Key | n/a | | |||
| kenna_api_host | false | Kenna API Hostname | api.kennasecurity.com | | |||
| Snyk_api_url | true | Snyk environment API base URL without prefix e.g. api.eu.snyk.io, api.snyk.io or api.au.snyk.io | n/a | |
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.
- parameter name in snyk_v2_task.rb is snyk_api_base
- parameters are case sensitive when running the toolkit image so we should use all lowercase in readme file to match our definitions
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.
Task updated with change, thanks!
Version previous to pagination with rest
Lint code update
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.
Can we try changing
{ name: "snyk_api_base",
type: "string",
required: true,
default: nil,
description: "Snyk environment API base URL without prefix e.g. api.eu.snyk.io or api.snyk.io or api.au.snyk.io" }
to be optional and default to the US otherwise? I think ought to clear up the test failure.
to address issues with the autochecks
updating task to avoid possible duplicated values
Am getting this connector error when adding the data to the clients subscription. Exception occurred: NoMethodError - undefined method |
@slblack Please try with the new version I sent you. |
Resolved merge conflict in Gemfile.lock
Fixing vuln
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.
LGTM
requested changes implemented
Snyk Api base url updated
Problem
Due to changes in Snyk's API, customers now need to specify their API environment. Previously, we used the static URL:
HOST = "https://snyk.io"
Solution
We should request that customers provide their unique API_BASE_URL as a parameter during task execution. The API_BASE_URL should be one of the following valid values:
snyk_api_base:{
api.snyk.io
api.eu.snyk.io
api.au.snyk.io}
This base URL should be entered without the protocol (https://) and rest parts, as these will be appended automatically in the code. The complete URL will follow this format:
https://#{snyk_api_base}/rest
The task was updated to map the new schema showed in API documentation https://apidocs.snyk.io/?version=2024-04-29
Example of the task execution
docker run -it --rm -v ~/Desktop/toolkit_input:/opt/app/toolkit/input -v ~/Desktop/toolkit_output:/opt/app/toolkit/output -t kennasecurity/toolkit:latest task=snyk_v2 snyk_api_token=XXXXXXXXXXXXXXXXX snyk_api_base=api.eu.snyk.io
Output file:
![image](https://private-user-images.githubusercontent.com/121052811/334418092-86c1fca0-65bb-45b9-90b1-29655034dd5a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk3MjAwODYsIm5iZiI6MTczOTcxOTc4NiwicGF0aCI6Ii8xMjEwNTI4MTEvMzM0NDE4MDkyLTg2YzFmY2EwLTY1YmItNDViOS05MGIxLTI5NjU1MDM0ZGQ1YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQxNTI5NDZaJlgtQW16LUV4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