Conversation
…g, clone - ReconciliationService: drop the unreachable ScheduledThreadPoolExecutor branches (it is a ThreadPoolExecutor) - Fix SLF4J placeholder/argument mismatches in ClusterManager, ConnectorInfoProviderService, Id, GenericTableHandler, MappedTableHandler and PostgreSQLMappedTableHandler - ExplicitResultSetMapper: the "total" guard compared a String against a List<ColumnMapping> and never matched; check the mapped DB column names - AbstractScriptedService: synchronize on a dedicated lock instead of the (possibly null) registration field, make it volatile and clear it after unregistering; the old code threw NPE on every REGISTERED script event - JsonUser / ChecksumFile: override clone() so the copy keeps its type (and, for JsonUser, its CryptoService) - OrientDBRepoService: back off between pool-acquire retries outside the pool lock - Remove the write-only containers in OperationHelperImpl and RepoJobStore Resolves CodeQL alerts #470-#486, #490-#494, #497-#499.
- ObjectMapping: a SynchronizationException raised before the operation was set up was silently swallowed and then dereferenced a null audit event; report it like any other failure and guard the audit block - DateUtil.getDateDifferenceInDays: reject missing dates explicitly instead of failing with an unboxing NullPointerException - JsonUser / JsonGroup: implement Externalizable so the Serializable contract inherited from Activiti's User/Group actually works - Close the readers/streams leaked in SourceGenerator, ConnectorInfoProviderService and JSONConfigInstaller - ManagedObjectSet: short-circuit the name validation; Link: drop the reference comparison of strings - Add default branches to the SyncOperation and RepoJobStore switches - Remove the null guards that could never trigger (and misled the analysis), the field shadowing ServiceTracker.context, and use AuditServiceImpl.class for the resource lookup Resolves CodeQL alerts #469, #487-#489, #495, #496, #500-#509, #511-#514, #516, #517, #708, #709.
2 tasks
This was referenced Sep 19, 2026
…correctness Brings in the JsonUser.clone() override from OpenIdentityPlatform#205 so the error-level CodeQL alert java/missing-clone-method no longer fires on the class declaration line this branch touches. # Conflicts: # openidm-workflow-activiti/src/main/java/org/forgerock/openidm/workflow/activiti/impl/JsonUser.java
try-with-resources closes only the resource variable, so an IOException from the JarInputStream constructor (it reads and parses the manifest) left the FileInputStream open - CodeQL alert #503 survived the change and was re-reported on the new line as #925. Declare both streams as resources, the way JSONConfigInstaller already does in this branch, and drop the explicit close that try-with-resources makes redundant.
…rService A jar whose manifest entry is truncated makes the JarInputStream constructor fail. The test lists it ten times and checks through UnixOperatingSystemMXBean that no file descriptor stays open; it is skipped on JVMs that do not expose the count (Windows). Before 5417702 it failed with one leaked descriptor per call (OpenIdentityPlatform#220).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First of the warning-level CodeQL batches: the Java findings that touch correctness (null dereferences, resource leaks, switch coverage, equality, serialization). 18 alerts fixed here; #510 (
ConnectorReference) was dismissed as a false positive (StringUtil.isBlank(null)handles the null before the dereference), and #515/#518 (AbstractScriptedService) are already fixed by #205.Three of these are real bugs (bug below); the rest are cleanups that also remove the guards which misled the analysis.
dereferenced-value-may-be-null— bugObjectMappingSynchronizationExceptionwas raised beforeop/eventwere created (e.g. badparams), theop != null && …guard meant it was neither logged nor rethrown, andsetLogEntryMessage(null, se)then threw an NPE. Nowop == null || op.action != EXCEPTIONreports it like any other failure, and the audit block requires bothopandevent.dereferenced-value-may-be-null— bugDateUtil.getDateDifferenceInDaysInteger result = null; … return result;unboxed to an NPE when either date was null. Now an explicitIllegalArgumentException, computed asintthroughout.missing-no-arg-constructor-on-serializable— bugJsonUser,JsonGroupSerializablethrough Activiti'sUser/Group, butJsonValuehas no no-arg constructor, so Java deserialization failed withInvalidClassException: no valid constructor. They now implementExternalizable(the JSON map is written/read);JsonUser.cryptoServiceistransient(it is an OSGi service — re-attach withsetCryptoService). CodeQL keeps flagging the fixed classes (#926/#927): the query only looks for a no-arg constructor on the non-serializable super-class, whileExternalizabledeserialization uses the class's own public no-arg constructor — dismissed as a false positive.input-resource-leakSourceGeneratorBufferedReaders over classpath resources → onereadResource()helper with try-with-resources.input/output-resource-leakConnectorInfoProviderService,JSONConfigInstallerJarInputStreamandFileOutputStreamare now closed on every path, including the one where theJarInputStreamconstructor itself fails while parsing the manifest — the underlyingFileInputStreamis a resource of its own.non-short-circuit-evaluationManagedObjectSet|→||in the name validation.reference-equality-on-stringsLink.targetEqualsnormalizedTargetId == normalizedCompIdis justnormalizedCompId == null; written that way.missing-case-in-switchSyncOperation,RepoJobStoredefault:for the inner action switch (only reachable for the outer cases) and forCUSTOMcluster events (debug log).dereferenced-value-may-be-null/useless-null-checkJSONConfigInstaller,SyncOperation,ConnectorUtil,ObjectClassResourceProvider,IdentityProviderServicepid,sourceClass = source.getClass(), afinalmap field) and made thereauthCreds != null ↔ runAsAttributescorrelation explicit.field-masks-super-fieldServiceTrackerNotifiercontextfield that shadowedServiceTracker's ownprotected final context.unsafe-get-resourceAuditServiceImplgetClass().getResourceAsStream→AuditServiceImpl.class.getResourceAsStream.Note:
fix-codeql-error-alerts(#205) is merged into this branch, so the error-leveljava/missing-clone-methodalert onJsonUser(master #491, re-reported here as #928 because this PR touches the class declaration) is fixed here as well. Its commits drop out of this diff as soon as #205 lands on master.The four CodeQL alerts raised on this PR (#925–#928) are analysed and dispositioned in #220.
Test plan
DateUtilTest+2 (missing start / end →IllegalArgumentException; failed with NPE before)ActivitiIdentitySerializationTest—JsonUserandJsonGroupsurvive anObjectOutputStream/ObjectInputStreamround trip (failed withInvalidClassException/NotSerializableExceptionbefore)ConnectorInfoProviderServiceJarListingTest— listing a jar with a truncated manifest (theJarInputStreamconstructor fails) leaves no open file descriptor, measured throughUnixOperatingSystemMXBeanand skipped on Windows JVMs; before 5417702 it leaked one descriptor per callcustom-scripted-connector-bundlercompiles (no tests)mvn -pl openidm-workflow-activiti,openidm-provisioner-openicf -am test -Dtest=JsonUserTest,ActivitiIdentitySerializationTest— 4/4 pass (clone()and the serialization round trip), both modules recompile