Skip to content

Conversation

@harp-intel
Copy link
Contributor

@harp-intel harp-intel commented Jan 6, 2026

This pull request introduces improvements to the logic for determining which targets are eligible for data collection, particularly focusing on privilege requirements and table applicability. The main changes ensure that targets which cannot run all required scripts due to privilege constraints are skipped, and only relevant targets are processed.

Eligibility and filtering logic improvements:

  • Added a check in isTableForTarget to skip tables where all scripts require superuser privileges if the target cannot elevate privileges.
  • Implemented allTableScriptsRequireSuperuser to determine if every script in a table requires superuser privileges.
  • Added numTablesForTarget to count how many tables are applicable for a given target, used for filtering.
  • Updated the Run method in ReportingCommand to remove targets with no applicable tables, providing a status update for skipped targets.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel requested a review from Copilot January 6, 2026 20:44
Copy link
Contributor

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 implements enhanced privilege and target applicability checks to improve the workflow efficiency. The changes add stricter privilege validation and skip targets that have no collectable data, preventing unnecessary processing overhead.

Key changes:

  • Added utility functions for checking privilege requirements and counting applicable tables per target
  • Implemented early target filtering to skip targets with no collectable data
  • Refactored privilege checking logic for better code organization

Reviewed changes

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

File Description
internal/workflow/workflow.go Added logic to filter out targets with zero applicable tables before data collection
internal/workflow/collection.go Refactored privilege checking with new utility functions and added privilege-based filtering in isTableForTarget

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
The refactored function was using tableRequiresElevatedPrivileges which
checks if ALL scripts require superuser. This changed the semantics from
"any script needs elevation" to "any table has all scripts needing elevation".

- Restored the original logic in elevatedPrivilegesRequired to check if
  ANY script requires superuser
- Renamed tableRequiresElevatedPrivileges to allTableScriptsRequireSuperuser
  for clarity about its behavior
@harp-intel harp-intel merged commit ee6ce0e into main Jan 7, 2026
5 checks passed
@harp-intel harp-intel deleted the skip-if-no-scripts branch January 7, 2026 00:06
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.

2 participants