-
Notifications
You must be signed in to change notification settings - Fork 519
[Jamf_Pro] - Fix empty string issue for date query param in filter for Jamf Pro inventory data stream #13329
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
Conversation
…ventory data stream.
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
| "capableUsers": ["user.mcuserface@company.com"] | ||
| "capableUsers": [ | ||
| "user.mcuserface@company.com" | ||
| ] |
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.
cause by elastic-package, but its a + change so I let it stay.
|
|
||
| keep_null: true | ||
| redact: | ||
| fields: ~ |
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.
added recommended redact field since it's a + change.
| *NOTE* Enabling many sections may impact query processing. | ||
| It is recommended to only enable sections of interest. | ||
| The General section is always included. | ||
| description: "Settings for inventory requests. \n*NOTE* Enabling many sections may impact query processing.\nIt is recommended to only enable sections of interest.\nThe General section is always included.\n" |
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.
caused by elastic-package format, but is good to have
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'm not sure this improves things.
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.
Yes agree but since it aligns with the format expected by elastic-package, I think it's ok to keep it in.
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 it reflects a bug in the yaml implementation and it makes the code harder to read, but I won't push.
🚀 Benchmarks reportTo see the full report comment with |
efd6
left a comment
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.
Suggest the following for the commit message:
The current cursor handling assumes that state.cursor.last_report_date is
either absent or a valid cursor. However, previously stored cursor values may
include an empty string for this value to indicate an absence. The outcome of
this is that an invalid filter parameter was being sent in those cases. This
changes the logic to correctly handle cursors that have used an empty string
as an absence marker.
Note that commit messages do not render markdown.
| ?"filter": (has(state.?cursor.last_report_date) && state.cursor.last_report_date.orValue("") != "") ? | ||
| optional.of(["general.reportDate>=\"" + state.cursor.last_report_date + "\""]) | ||
| : | ||
| optional.none(), |
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.
| ?"filter": (has(state.?cursor.last_report_date) && state.cursor.last_report_date.orValue("") != "") ? | |
| optional.of(["general.reportDate>=\"" + state.cursor.last_report_date + "\""]) | |
| : | |
| optional.none(), | |
| ?"filter": state.?cursor.last_report_date.orValue("") != "" ? | |
| optional.of(["general.reportDate>=\"" + state.cursor.last_report_date + "\""]) | |
| : | |
| optional.none(), |
state.cursor.last_report_date.orValue("") is not valid since state.cursor.last_report_date is not an optional type.
| *NOTE* Enabling many sections may impact query processing. | ||
| It is recommended to only enable sections of interest. | ||
| The General section is always included. | ||
| description: "Settings for inventory requests. \n*NOTE* Enabling many sections may impact query processing.\nIt is recommended to only enable sections of interest.\nThe General section is always included.\n" |
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'm not sure this improves things.
|
@efd6, addressed all suggested changes. |
|
💚 Build Succeeded
History
cc @ShourieG |
efd6
left a comment
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.
Thanks.
Please make sure the line wraps are sane in the final commit message.
| *NOTE* Enabling many sections may impact query processing. | ||
| It is recommended to only enable sections of interest. | ||
| The General section is always included. | ||
| description: "Settings for inventory requests. \n*NOTE* Enabling many sections may impact query processing.\nIt is recommended to only enable sections of interest.\nThe General section is always included.\n" |
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 it reflects a bug in the yaml implementation and it makes the code harder to read, but I won't push.
|
Package jamf_pro - 0.5.1 containing this change is available at https://epr.elastic.co/package/jamf_pro/0.5.1/ |
…r Jamf Pro inventory data stream (#13329) The current cursor handling assumes that state.cursor.last_report_date is either absent or a valid cursor. However, previously stored cursor values may include an empty string for this value to indicate an absence. The outcome of this is that an invalid filter parameter was being sent in those cases. This changes the logic to correctly handle cursors that have used an empty string as an absence marker.
…r Jamf Pro inventory data stream (#13329) The current cursor handling assumes that state.cursor.last_report_date is either absent or a valid cursor. However, previously stored cursor values may include an empty string for this value to indicate an absence. The outcome of this is that an invalid filter parameter was being sent in those cases. This changes the logic to correctly handle cursors that have used an empty string as an absence marker.
…r Jamf Pro inventory data stream (#13329) The current cursor handling assumes that state.cursor.last_report_date is either absent or a valid cursor. However, previously stored cursor values may include an empty string for this value to indicate an absence. The outcome of this is that an invalid filter parameter was being sent in those cases. This changes the logic to correctly handle cursors that have used an empty string as an absence marker.




Type of change
Proposed commit message
WHAT: Fixed empty string issue for date query param in filter for Jamf Pro inventory data stream.
WHY: Recently there was a commit changing how the filter works detailed here. The issue is that this change does not take into account the fact that due to the previously existing cursor logic, there could be scenarios where the
cursor.last_report_dateis an empty string.Sending the date in the filter as an empty string causes the API to respond with a status_code: 400 leading to failures. The fix in this PR tries to address this specific issue along with some minor cleanup.
Commit Message:
The current cursor handling assumes that state.cursor.last_report_date is either absent or a valid cursor. However, previously stored cursor values may include an empty string for this value to indicate an absence. The outcome of this is that an invalid filter parameter was being sent in those cases. This changes the logic to correctly handle cursors that have used an empty string as an absence marker.NOTE
Some minor cleanup and additions are included since they are all + changes. Some are just elastic-package format behaviour.
Checklist
changelog.ymlfile.Author's Checklist
How to test this PR locally
Related issues
Screenshots