Open
Conversation
Contributor
There was a problem hiding this comment.
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
NSInvalidArgumentExceptionwhen 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 |
This was referenced Aug 25, 2025
Merged
| } | ||
| } | ||
|
|
||
| - (void)test_Radar_initialize_acceptsValidPublishableKey { |
Contributor
There was a problem hiding this comment.
this case is covered by test_Radar_initialize, no?
ShiCheng-Lu
approved these changes
Aug 26, 2025
| } | ||
|
|
||
| - (void)test_Radar_initialize_throwsCorrectExceptionTypeForSecretKey { | ||
| NSString *secretKey = @"prj_test_sk_0000000000000000000000000000000000000000"; |
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.