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

chore: disable analytics & sentry when fedramp [HEAD-677] #245

Merged

Conversation

bastiandoetsch
Copy link
Contributor

Description

Provide description of this PR and changes, if linked Jira ticket doesn't cover it in full.

Checklist

  • Tests added and all succeed
  • Linted
  • CHANGELOG.md updated
  • README.md updated, if user-facing

Screenshots / GIFs

Visuals that may help the reviewer. Please add screenshots for any UI change. GIFs are most welcome!

@bastiandoetsch bastiandoetsch temporarily deployed to snyk-msbuild-envs August 29, 2023 12:19 — with GitHub Actions Inactive
@bastiandoetsch bastiandoetsch temporarily deployed to snyk-msbuild-envs August 29, 2023 13:46 — with GitHub Actions Inactive
@bastiandoetsch bastiandoetsch marked this pull request as ready for review August 29, 2023 13:59
@bastiandoetsch bastiandoetsch requested a review from a team as a code owner August 29, 2023 13:59
@bastiandoetsch bastiandoetsch temporarily deployed to snyk-msbuild-envs August 31, 2023 08:36 — with GitHub Actions Inactive
@bastiandoetsch bastiandoetsch temporarily deployed to snyk-msbuild-envs August 31, 2023 08:49 — with GitHub Actions Inactive
@bastiandoetsch bastiandoetsch temporarily deployed to snyk-msbuild-envs August 31, 2023 09:22 — with GitHub Actions Inactive
@bastiandoetsch bastiandoetsch temporarily deployed to snyk-msbuild-envs September 1, 2023 12:38 — with GitHub Actions Inactive
@bastiandoetsch bastiandoetsch enabled auto-merge (squash) September 1, 2023 12:58
Copy link
Contributor

@asaf92 asaf92 left a comment

Choose a reason for hiding this comment

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

Left some suggestions

@@ -14,6 +14,8 @@ public interface ISnykOptions
/// </summary>
AuthenticationToken ApiToken { get; }

bool IsFedramp();
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually when you have FooType GetFoo(), it's idiomatic to use a getter only auto-property, so FooType Foo { get; }

Comment on lines +92 to +102
public bool IsFedramp()
{
var endpoint = this.customEndpoint;
if (endpoint.IsNullOrEmpty())
{
return false;
}

var endpointUri = new Uri(endpoint);
return endpointUri.Host.ToLower().EndsWith("snykgov.io");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

(Suggestion)
You can also do something like this:

Suggested change
public bool IsFedramp()
{
var endpoint = this.customEndpoint;
if (endpoint.IsNullOrEmpty())
{
return false;
}
var endpointUri = new Uri(endpoint);
return endpointUri.Host.ToLower().EndsWith("snykgov.io");
}
public bool IsFedramp() => > Uri.TryCreate(this.customEndpoint, UriKind.Absolute, out var uri) &&
uri.Host.ToLower().EndsWith("snykgov.io");

It's shorter and handles any error in the URI parsing (like invalid format). I recently added code to the CustomEndpoint setter to avoid invalid URIs, but it's better to be safe anyway.

@bastiandoetsch bastiandoetsch temporarily deployed to snyk-msbuild-envs September 26, 2023 12:43 — with GitHub Actions Inactive
@bastiandoetsch bastiandoetsch merged commit b004ef0 into main Sep 29, 2023
5 checks passed
@bastiandoetsch bastiandoetsch deleted the chore/HEAD-677_disable-analytics-and-sentry-when-fedramp branch September 29, 2023 09:30
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