Skip to content

Fix genuine bugs found while cleaning up java/unused-parameter alerts - #141

Open
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:unused-parameter
Open

vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:unused-parameter

Conversation

@vharseko

Copy link
Copy Markdown
Member

Summary

Investigated all 49 open java/unused-parameter CodeQL alerts. 40 were dismissed on GitHub as false positive/won't-fix (interface/abstract method declarations, uniform dispatch signatures, TestNG DataProvider/Factory injection, Procrun stop(String[] args) convention, and public extensibility hooks). The remaining 9 pointed at real problems, fixed here:

  • ADUserAccountControl: the private constructor assigned uac to both the uac and msDSUac fields instead of keeping them separate, so isAccountLockOut()/isPasswordExpired() never read the real value of AD's ms-DS-User-Account-Control-Computed attribute.
  • JavaScriptExecutorFactory: accepted a ClassLoader but never applied it (unlike its Groovy sibling, which passes it into GroovyShell). JS scripts always ran under the ambient thread context classloader instead of the one the caller requested. Fixed by scoping the thread context classloader around eval().
  • OpenICFWebSocketCreator.unauthorized(): dropped the specific message it was passed and always sent the same generic rejection reason.

Also removes genuinely dead OperationOptions/typeName parameters from private helpers and updates their call sites: ActiveDirectoryChangeLogSyncStrategy.handleEvents, SchemaApiOpTests.getTestPropertyOrFail, CSVFileConnector.findAccount/doDelete/doUpdate.

Test plan

  • New unit tests: ADUserAccountControlTests, JavaScriptExecutorFactoryTests, UnauthorizedResponseTest — RED before the fix, GREEN after.
  • mvn install on connector-framework-internal, connector-framework-contract, connector-server-jetty, OpenICF-ldap-connector, OpenICF-csvfile-connector (incl. their existing test suites) — all green.

- ADUserAccountControl's private constructor assigned uac to both fields,
  so isAccountLockOut()/isPasswordExpired() never read the real msDSUac
  value from AD's ms-DS-User-Account-Control-Computed attribute.
- JavaScriptExecutorFactory accepted a ClassLoader but never applied it,
  unlike its Groovy sibling; JS scripts always ran under the ambient
  thread context classloader instead of the one requested by the caller.
- OpenICFWebSocketCreator.unauthorized() dropped the specific reason it
  was passed and always sent the same generic explanation.

Also removes dead OperationOptions/typeName parameters from private
helpers (ActiveDirectoryChangeLogSyncStrategy.handleEvents,
SchemaApiOpTests.getTestPropertyOrFail, CSVFileConnector
findAccount/doDelete/doUpdate) and updates their call sites.
@vharseko vharseko added java Pull requests that update java code framework OpenICF-java-framework connector:ldap LDAP connector connector:csvfile CSV file connector tests Test additions or fixes bug Something isn't working labels Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working connector:csvfile CSV file connector connector:ldap LDAP connector framework OpenICF-java-framework java Pull requests that update java code tests Test additions or fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant