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

updated storyblok detector #3981

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kashifkhan0771
Copy link
Contributor

@kashifkhan0771 kashifkhan0771 commented Mar 17, 2025

Description:

This PR fixes #3909 and oss-136

Tests:

Screenshot from 2025-03-17 13-56-01

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

Sorry, something went wrong.

@kashifkhan0771 kashifkhan0771 requested review from a team as code owners March 17, 2025 09:00
Copy link
Contributor

@abmussani abmussani left a comment

Choose a reason for hiding this comment

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

Thanks @kashifkhan0771. Overall, looks great. Just few minor comments.

}
// docs: https://www.storyblok.com/docs/api/content-delivery/v2/getting-started/authentication
func verifyStoryBlokAccessToken(ctx context.Context, client *http.Client, token string) (bool, error) {
req, err := http.NewRequestWithContext(ctx, "GET", "https://api.storyblok.com/v1/cdn/spaces/me/?token="+token, nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: http.GET

func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (results []detectors.Result, err error) {
dataStr := string(data)

matches := keyPat.FindAllStringSubmatch(dataStr, -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

can we put uniqueness logic here to avoid duplicates ?


// docs: http://storyblok.com/docs/api/management/core-resources/spaces/retrieve-multiple-spaces
func verifyStoryBlokPersonalAccessToken(ctx context.Context, client *http.Client, token string) (bool, error) {
req, err := http.NewRequestWithContext(ctx, "GET", "https://mapi.storyblok.com/v1/spaces/", nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: http.GET

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Storyblok Detector Fails to Detect Personal Access Token
2 participants