-
Notifications
You must be signed in to change notification settings - Fork 20
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
[FSSDK-9533] Log error & reject on track event with null, empty or whitespace event key #362
Conversation
This will need to be part of a cherry-pick and release for a v3.11.4 along with #361 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create a test case to reproduce the suspected failure cases first? The current solution looks fine and also validated with FSC tests as well.
var config = ProjectConfigManager?.GetConfig(); | ||
|
||
if (config == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove this config ready check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to call .GetEvent(eventKey)
later (L365 below on this older version) to check if the provided eventKey
is in the datafile, I think we'd probably still need this check, right?
var eevent = config.GetEvent(eventKey); | ||
|
||
if (eevent.Key == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these 2 lines will filter out null or empty eventKey cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see what you're talking about: The eventKey must be in the datafile before it can be tracked anyway, regardless of whether it's not null, empty, or whitespace.
@@ -338,54 +339,60 @@ private bool ValidateInputs(string datafile, bool skipJsonValidation) | |||
/// <summary> | |||
/// Sends conversion event to Optimizely. | |||
/// </summary> | |||
/// <param name="eventKey">Event key representing the event which needs to be recorded</param> | |||
/// <param name="eventKey">Event key representing the event (must not be null, empty, or whitespace)</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this should read: "Event key representing the event in the datafile which must not be null, empty, or whitespace"
var config = ProjectConfigManager?.GetConfig(); | ||
|
||
if (config == null) | ||
if (eventKey == null || Regex.IsMatch(eventKey, @"^\s*$")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an earlier eventKey check since it's cheaper before digging into the ProjectConfig to see if the eventKey is present in the datafile since it's required per the docs.
Summary
Test plan
Issues