Skip to content
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

feat: pass oauth token to sast, if available #4196

Merged
merged 2 commits into from
Jan 11, 2023

Conversation

DarrellMozingo
Copy link
Contributor

@DarrellMozingo DarrellMozingo commented Nov 7, 2022

This allows SNYK_OAUTH_TOKEN support instead of just API Key.

What does this PR do?

Passes an OAuth token into the SAST backend if specified.

Where should the reviewer start?

The tests: test/jest/unit/snyk-code/snyk-code-test.spec.ts

How should this be manually tested?

SNYK_OAUTH_TOKEN=$token snyk code test

Any background context you want to provide?

Previously we only passed the api key as an auth header.
This method is deprecated (no token scheme), and doesn't support OAuth tokens. Use existing header building to do this, so we send bearer $jwt if specified.

The backend has already been updated to handle this.

What are the relevant tickets?

Screenshots

Additional questions

@ghost
Copy link

ghost commented Nov 7, 2022

This PR modifies files linked to issues tracked in Stepsize. You might want to review their status, priority, and scope.

✅  2 http libraries in CLI
  • src/lib/plugins/sast/analysis.ts
Created from GitHub PR snyk/snyk/#2826
  • src/lib/plugins/sast/analysis.ts

 Mention [stepsize] in a comment if you'd like to report some technical debt. See examples here.

@ghost
Copy link

ghost commented Dec 7, 2022

This PR modifies files linked to issues tracked in Stepsize. You might want to review their status, priority, and scope.

✅  2 http libraries in CLI
  • src/lib/plugins/sast/analysis.ts
Created from GitHub PR snyk/snyk/#2826
  • src/lib/plugins/sast/analysis.ts

 Mention [stepsize] in a comment if you'd like to report some technical debt. See examples here.

@DarrellMozingo DarrellMozingo force-pushed the pass-oauth-token-to-code branch 2 times, most recently from dd0ecb3 to e966732 Compare January 10, 2023 06:15
@DarrellMozingo DarrellMozingo marked this pull request as ready for review January 10, 2023 06:16
@DarrellMozingo DarrellMozingo requested review from a team as code owners January 10, 2023 06:16
@PeterSchafer
Copy link
Contributor

Hey @DarrellMozingo,
could you please run npm run format to satisfy the linker :)
Thanks!

This allows SNYK_OAUTH_TOKEN support instead of just API Key.

Also passes proper authn scheme (token or bearer), as only sending
the API key is deprecated.

The Snyk Code backend has already been modified to accept the new
authn material.
@DarrellMozingo DarrellMozingo merged commit 8a1b362 into master Jan 11, 2023
@DarrellMozingo DarrellMozingo deleted the pass-oauth-token-to-code branch January 11, 2023 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants