Skip to content

Conversation

mustansir14
Copy link

Description:

This PR adds an initial detector for Smartling API credentials.

Notes

  • Regex patterns for userIdentifier and userSecret are best guesses based on public documentation and example screenshots.
  • We could not generate or validate against real Smartling credentials because Smartling does not provide self-serve/free accounts to new users. Access requires an enterprise subscription, so we don’t currently have a way to obtain valid secrets.
  • Integration tests use mocked API responses (gock) with dummy values to exercise verification flow. These should be updated once we have access to real credentials.

Marking as draft since the detector is not production-ready until regexes and verification can be confirmed.

References (used to infer credential formats)

Checklist:

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

@CLAassistant
Copy link

CLAassistant commented Sep 12, 2025

CLA assistant check
All committers have signed the CLA.

@mustansir14 mustansir14 changed the title Add draft detector for the Smartling API Secrets Add draft detector for the Smartling API Secrets [INS-38] Sep 15, 2025
return
}

func verifyMatch(ctx context.Context, client *http.Client, userId string, secret string) (bool, map[string]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The verification function doesn't really need to return a map[string]string since it's always nil

Copy link
Author

@mustansir14 mustansir14 Sep 17, 2025

Choose a reason for hiding this comment

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

Good catch. I'll remove it.

Comment on lines 115 to 120
case http.StatusBadRequest:
// The request was malformed. We can't verify this secret, but it might be valid.
return false, nil, fmt.Errorf("received HTTP 400 Bad Request from Smartling API")
case http.StatusTooManyRequests:
// We have been rate limited. We can't verify this secret, but it might be valid.
return false, nil, fmt.Errorf("received HTTP 429 Too Many Requests from Smartling API")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not quite sure why we need to describe these cases, since they are covered in default?

Copy link
Author

Choose a reason for hiding this comment

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

This is done to provide specific errors for each case, and also as a measure to include all response status codes specified in the documentation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm.. I don't see any specific info in either of the error messages not covered in the default case since the status code is being logged in it as well. This is definitely a nit though, so feel free to ignore.

Copy link
Author

Choose a reason for hiding this comment

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

Hmm, makes sense. I'll remove them.

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.

3 participants