Skip to content

activate snyk project on releases#9

Merged
staskolauren merged 1 commit into
mainfrom
activate-snyk-project
May 31, 2022
Merged

activate snyk project on releases#9
staskolauren merged 1 commit into
mainfrom
activate-snyk-project

Conversation

@staskolauren
Copy link
Copy Markdown
Contributor

@staskolauren staskolauren commented May 27, 2022

  • The activate-snyk-project.sh will automatically add images or "projects" to Snyk to be scanned as we push images to dockerhub as part of our gha build workflow
  • Note: For now we will manually cleanup "old" image projects to no longer be scanned by Snyk after we ensure they are no longer being used by Dwolla apps

curl \
-X POST \
--silent \
-H "Authorization: token $SNYK_TOKEN" \
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I didn't have much luck using a .netrc here instead of sending an authorization header. I think this is because the SNYK_TOKEN is technically an API token vs. an Oauth Token.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we used an environment variable here, would it print the value out when it executes? That might be a good compromise. (I think you're right that .netrc can't be used for bearer tokens—AFAICT it only works for basic auth (user/pass)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea! This commit should pass in SNYK_TOKEN as an env var to the activate-snyk-project script.

Out of curiosity, where do you see the auth header value being printed out when curl executes? I thought --silent would prevent any output from printing.

Comment thread .github/workflows/ci.yml
TEMURIN_TAG: ${{ matrix.temurin_tag }}
- name: Active Snyk Project
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
run: ./scripts/activate-snyk-project.sh ${{ secrets.SNYK_TOKEN }} java ${{ matrix.temurin_tag }} $(git rev-parse --short "$GITHUB_SHA") No newline at end of file
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${{ secrets.SNYK_TOKEN }} is currently my personal API token. Could we update this to be a process account's token instead? Is there such a concept on Snyk?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could just create a 'user' that's for account updating if there isn't

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind running this script through shellcheck? It caught a few minor things when I ran it locally.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh neat! 😎 I updated this script with findings from shellcheck.

@staskolauren staskolauren force-pushed the activate-snyk-project branch from c08eb89 to 34aedc3 Compare May 31, 2022 18:22
@staskolauren staskolauren merged commit b97e7ce into main May 31, 2022
@staskolauren staskolauren deleted the activate-snyk-project branch May 31, 2022 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants