Skip to content

Fix high-severity CodeQL alerts - #169

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:codeql-high-fixes
Sep 18, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:codeql-high-fixes

Conversation

@vharseko

Copy link
Copy Markdown
Member

Fixes four of the six open high code scanning alerts.

Alert Rule Location Change
#1 java/insufficient-key-size JwtSessionManager.java Temporary RSA key pair (used when no keystore is configured) is now generated with 2048 bits instead of 1024.
#3 java/zipslip UiAdminHttpApplication.java Extraction of openig-ui.jar moved into unpackJar(InputStream, File); an entry whose canonical path resolves outside the unpack directory now fails with IOException.
#5 java/sensitive-log TypoglycemiaDetector.java False positive on variable name: the logged value is a word from the scanned prompt, not a credential. Renamed token/tokens → word/words in scan().
#7 java/sensitive-log TokenTransformationFilter.java The trace log on cache hit no longer writes the issued STS token, only its length.

Tests added:

  • JwtSessionManagerTest.shouldGenerateAtLeast2048BitKeyPairWhenNoKeystoreIsConfigured
  • UiAdminHttpApplicationTest.shouldRejectJarEntryEscapingUnpackDirectory (jar with index.html followed by ../evil.txt) and shouldUnpackRegularJarEntryIntoUnpackDirectory

Not changed in this PR, to be dismissed in the code scanning UI:

  • fix CVE-2019-10744 lodash #2 java/weak-cryptographic-algorithm in DesKeyGenHandler — Won't fix: the DES key is required for interop with OpenAM ReplayPasswd (password capture & replay), which uses SecretKeySpec(key, "DES").
  • reorganize commons build artifacts #6 java/sensitive-log in TokenTransformationFilter.java:147 — False positive: the logged idToken is an Expression<String> whose toString() returns the expression template, not the evaluated token.

- 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 vharseko added security Security fixes and CVE / vulnerability updates java Pull requests that update Java code tests Adds or updates tests ai AI / LLM proxy features (openig-ai) labels Sep 18, 2026
@vharseko
vharseko merged commit 0a8b912 into OpenIdentityPlatform:master Sep 18, 2026
14 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai AI / LLM proxy features (openig-ai) java Pull requests that update Java code security Security fixes and CVE / vulnerability updates tests Adds or updates tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant