Skip to content

Conversation

lmeier
Copy link
Contributor

@lmeier lmeier commented Aug 6, 2025

No description provided.

@lmeier lmeier requested review from nickpatrick and Copilot August 6, 2025 11:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds validation to prevent the use of secret keys during Radar SDK initialization. The change ensures that only publishable keys (containing "pk") are accepted, while secret keys (containing "sk") will throw an exception to maintain security best practices.

  • Adds secret key validation logic to throw NSInvalidArgumentException when secret keys are used
  • Implements comprehensive test coverage for the new validation behavior
  • Maintains existing functionality for valid publishable keys

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
RadarSDK/Radar.m Adds secret key detection and exception throwing logic in the initialization method
RadarSDKTests/RadarSDKTests.m Adds three test cases to verify exception behavior and valid key acceptance

@lmeier lmeier requested a review from ShiCheng-Lu August 25, 2025 15:54
}
}

- (void)test_Radar_initialize_acceptsValidPublishableKey {
Copy link
Contributor

Choose a reason for hiding this comment

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

this case is covered by test_Radar_initialize, no?

}

- (void)test_Radar_initialize_throwsCorrectExceptionTypeForSecretKey {
NSString *secretKey = @"prj_test_sk_0000000000000000000000000000000000000000";
Copy link
Contributor

Choose a reason for hiding this comment

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

and this test would cover test_Radar_initialize_throwsExceptionForSecretKey

I think it would cover all cases with just this test that verify it throws and throws the right error. But it's probably fine to have more tests.

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