Repository navigation
Fix high-severity CodeQL alerts - #169
Merged
Merged
Conversation
- JwtSessionManager: generate the temporary RSA key pair with 2048 bits instead of 1024 (java/insufficient-key-size) - UiAdminHttpApplication: reject jar entries that resolve outside the unpack directory when extracting openig-ui.jar (java/zipslip) - TokenTransformationFilter: do not write the cached issued token to the trace log (java/sensitive-log) - TypoglycemiaDetector: rename the scanned prompt word from `token` to `word` so it is not mistaken for a credential (java/sensitive-log)
vharseko
added a commit
that referenced
this pull request
Oct 15, 2026
Closes the remaining `warning`-level code scanning alerts #33, #40, #44, #45, #61, #62. No behavior change except for the resource lookup, which now also works for subclasses. | Alert | Rule | File | Change | |---|---|---|---| | #61 | `java/unsafe-get-resource` | `WelcomeHandler.java` | `getClass().getResourceAsStream("welcome.html")` → `WelcomeHandler.class.…` | | #62 | `java/unsafe-get-resource` | `OpenIGInitializer.java` | `getClass().getResource("logback.xml")` → `OpenIGInitializer.class.…` | | #33 | `java/random-used-once` | `JwtSessionManager.java` | one shared `private static final SecureRandom` for the temporary key pair and the temporary shared secret, instead of two `new SecureRandom()`; the field sits next to `keyPair` in the outer class so that it does not overlap with the hunks of #169 in the same file | | #40 | `java/useless-null-check` | `StaticRequestFilter.java` | drop `this.form != null` (final field, always initialized) | | #44 | `java/non-null-boxed-variable` | `websocket/Filter.java` | `Boolean upgrade` → `boolean` | | #45 | `java/non-null-boxed-variable` | `websocket/Principal.java` | `Long ttl` → `long` | Test added: `WelcomeHandlerSubclassTest` — deliberately in another package, with an anonymous subclass of `WelcomeHandler`. Before the fix it failed with an NPE (`this.trunk.in is null`) because the page was looked up relative to the subclass's package; after it the page is served. `OpenIGInitializer.findLogBackXml()` is private and the class is instantiated by the servlet container, so #62 has no equivalent test; the change mirrors #61. Not touched: note #50 (`Long.parseLong` of the `org.openidentityplatform.openig.websocket.ttl` system property without a catch in `Principal`) — handling a malformed value would change behavior and is a separate question. Headers: `Principal.java` had no license header; it was created in 2022 by 3A Systems, so a CDDL header with `Copyright 2022-2026 3A Systems, LLC.` is added.
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.
Fixes four of the six open
highcode scanning alerts.java/insufficient-key-sizeJwtSessionManager.javakeystoreis configured) is now generated with 2048 bits instead of 1024.java/zipslipUiAdminHttpApplication.javaopenig-ui.jarmoved intounpackJar(InputStream, File); an entry whose canonical path resolves outside the unpack directory now fails withIOException.java/sensitive-logTypoglycemiaDetector.javatoken/tokens→word/wordsinscan().java/sensitive-logTokenTransformationFilter.javaTests added:
JwtSessionManagerTest.shouldGenerateAtLeast2048BitKeyPairWhenNoKeystoreIsConfiguredUiAdminHttpApplicationTest.shouldRejectJarEntryEscapingUnpackDirectory(jar withindex.htmlfollowed by../evil.txt) andshouldUnpackRegularJarEntryIntoUnpackDirectoryNot changed in this PR, to be dismissed in the code scanning UI:
java/weak-cryptographic-algorithminDesKeyGenHandler— Won't fix: the DES key is required for interop with OpenAMReplayPasswd(password capture & replay), which usesSecretKeySpec(key, "DES").java/sensitive-loginTokenTransformationFilter.java:147— False positive: the loggedidTokenis anExpression<String>whosetoString()returns the expression template, not the evaluated token.