Skip to content

fix(components): add missing user validation in ComponentHandler#3972

Open
mahmoud-40 wants to merge 2 commits intoeclipse-sw360:mainfrom
mahmoud-40:fix/components-missing-user-validation
Open

fix(components): add missing user validation in ComponentHandler#3972
mahmoud-40 wants to merge 2 commits intoeclipse-sw360:mainfrom
mahmoud-40:fix/components-missing-user-validation

Conversation

@mahmoud-40
Copy link
Contributor

Adds missing user validation to methods in ComponentHandler.java that accepted a User parameter without validating it before delegating to the database handler layer, allowing null or malformed users to propagate silently into the database handler.

Suggest Reviewer

@GMishx @amritkv @rudra-superrr @bibhuti230185

How To Test?

The fix is a defensive validation addition with no business logic changes. To verify:

  1. Confirm that calling any of the affected methods with a null User now fails fast with a clear validation error rather than propagating into the handler layer.
  2. Run the existing component-related unit tests; no changes to expected behavior, all existing tests should pass as-is.

Affected methods:

  • Added assertUser(user): getRecentReleasesWithAccessibility, getReleaseIdsFromComponentId, getAccessibleReleasesFromVendorIds, getUsingComponentsWithAccessibilityForRelease, getUsingComponentsWithAccessibilityForComponent, getRecentComponentsSummaryWithPagination, refineSearchWithAccessibility, getAccessibleRecentComponentsSummary, searchAccessibleReleases
  • Added null-safe guard returning Collections.emptyMap(): refineSearchAccessibleComponents, searchComponentByNamePrefixPaginated, searchComponentByExactNamePaginated these declare no throws clause so assertUser cannot be used directly.

No additional tests implemented; the change is purely defensive input validation consistent with the existing pattern throughout the class.

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@mahmoud-40 mahmoud-40 changed the title fix: add missing User validation in ComponentHandler fix(components): add missing user validation in ComponentHandler Mar 23, 2026
@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing user validation in several ComponentHandler methods

2 participants