Skip to content

Fix CodeQL note-level correctness findings - #211

Open
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-codeql-notes-correctness
Open

vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-codeql-notes-correctness

Conversation

@vharseko

Copy link
Copy Markdown
Member

Summary

First of the note-level CodeQL batches — the findings that touch correctness: uncaught-number-format-exception (39), ignored-error-status-of-call (5), call-to-object-tostring (2), print-array (1), local-shadows-field (3). 38 fixed here, 12 dismissed as false positives.

Request input that turned into a 500 (bug)

Alerts File Change
#685 TableQueries A non-numeric value for a ${int:…} query parameter is now a BadRequestException naming the parameter and the value, instead of an unhandled NumberFormatException.
#672, #675, #682 GenericTableHandler, MappedTableHandler, MSSQLTableHandler A non-numeric _rev on update is a PreconditionFailedException (it can never match the stored revision) via a shared parseRevision.
#691, #692 TaskInstanceResource, TaskInstanceHistoryResource Non-numeric priority query filter → IllegalArgumentException naming the parameter (mapped by the existing handler).

Configuration and boot properties: fail with the setting's name

Alerts File Change
#655–#658 ClusterConfig Numeric settings accept a JSON number or a numeric string; anything else is a JsonValueException with the JSON pointer (previously Long.parseLong(value.asString()) also rejected genuine numbers with "Expecting a java.lang.String").
#659–#665 InstanceState One timestamp(map, key, default) helper; a corrupt persisted value names the field.
#690 ConfigMacroUtil.getTimePeriod The error names the offending ${Time.now + …} token.
#688, #689 CryptoUtil "Malformed obfuscated/encrypted value" instead of a radix-36/16 parse error.
#654, #666, #667, #686, #687 ClientCertAuthModule, HealthService, RepoJobStore, TaskScannerService, smartevent.Name Boot properties are validated with a message naming the property. Name did the parse in a static initialiser, where a typo surfaced as an ExceptionInInitializerError with no hint of the cause.

Other

Alerts File Change
#693, #696, #697 ignored-error-status-of-callbug UpdateManagerImpl, ProcessInstanceResource, ProcessDefinitionResource InputStream.read(buf) / new byte[is.available()] can return a partial read; the licence file and the process diagrams are now read with Files.readAllBytes / readAllBytes().
#694, #695 RemoteCommandScope (CLI) Failed renameTo / mkdir are reported on the console instead of being ignored.
#683, #684 DBHelper Double.parseDouble(System.getProperty("java.specification.version"))Runtime.version().feature().
#698, #699, #700 Link, TargetSyncOperation, DBHelper Link gets a toString() (the recon log lines printed Link@1a2b3c); the index-property array is printed with Arrays.toString.
#701–#703 local-shadows-field ClusterManager, SyncOperation, SchedulerConfig Locals renamed.

Dismissed as false positives (12): #668–#671, #673, #674, #676–#681 — the paging parameters parsed in renderQueryFilter are produced by TableQueries.query() via String.valueOf(int) from the typed QueryRequest accessors (which also overwrite any same-named additional parameter).

Test plan

  • New TableQueriesTest, GenericTableHandlerTest, ClusterConfigTest (incl. InstanceState), ConfigMacroUtilTest; CryptoUtilTest +1 — all failed before the change (wrong exception type, missing name in the message, or did not compile)
  • Suites of the 13 touched modules: repo-jdbc 4, cluster 6, util 53, authnfilter 37, quartz-fragment 8, scheduler 44, smartevent 2, workflow-activiti 1, maintenance 115, shell 8, core 79, repo-orientdb 31 — 0 failures; infoservice compiles (no tests)
  • CodeQL on this PR closes #654–#667, #672, #675, #682–#703

- Report bad request input as 400/412 instead of a NumberFormatException
  500: the ${int:...} query parameter (TableQueries), the update revision
  (Generic/Mapped/MSSQL table handlers) and the Activiti priority filter
- Report bad numeric configuration by name: ClusterConfig (also accepts
  JSON numbers), InstanceState, ConfigMacroUtil time tokens, CryptoUtil
  values and the boot properties read by ClientCertAuthModule,
  HealthService, RepoJobStore, TaskScannerService and smartevent Name
- Read the licence file and the Activiti diagrams completely instead of
  trusting a single read()/available()
- RemoteCommandScope: report failed rename/mkdir on the console
- DBHelper: use Runtime.version(); Link: add toString() for the sync logs;
  print arrays with Arrays.toString
- Rename locals that shadowed fields in ClusterManager, SyncOperation and
  SchedulerConfig

Resolves CodeQL alerts #654-#667, #672, #675, #682-#703.
@vharseko vharseko added java Pull requests that update Java code test Tests and test infrastructure (unit, e2e, smoke) bug Something isn't working repo Storage / repository layer (OrientDB, JDBC, HSQLDB) workflow Activiti workflow engine / scripting labels Sep 18, 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 java Pull requests that update Java code repo Storage / repository layer (OrientDB, JDBC, HSQLDB) test Tests and test infrastructure (unit, e2e, smoke) workflow Activiti workflow engine / scripting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant