[
https://issues.apache.org/jira/browse/KNOX-3442?focusedWorklogId=1040420&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1040420
]
ASF GitHub Bot logged work on KNOX-3442:
----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Sep/26 07:30
Start Date: 09/Sep/26 07:30
Worklog Time Spent: 10m
Work Description: smolnar82 merged PR #1383:
URL: https://github.com/apache/knox/pull/1383
Issue Time Tracking
-------------------
Worklog Id: (was: 1040420)
Time Spent: 0.5h (was: 20m)
> Harden H2 JDBC URL construction against connection-string injection via
> gateway.database.name
> ---------------------------------------------------------------------------------------------
>
> Key: KNOX-3442
> URL: https://issues.apache.org/jira/browse/KNOX-3442
> Project: Apache Knox
> Issue Type: Improvement
> Components: Server
> Affects Versions: 3.1.0
> Reporter: Sandor Molnar
> Assignee: Sandor Molnar
> Priority: Major
> Fix For: 3.1.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> KNOX-3401 added H2. H2DataSourceFactory builds the URL by raw concatenation:
> {noformat}
> String url = "jdbc:h2:" + gatewayConfig.getDatabaseName(); // :49
> {noformat}
> {{gateway.database.name}} comes straight from {{gateway-site.xml}},
> unvalidated. H2 URLs are an RCE sink: an appended {{;INIT=RUNSCRIPT FROM
> 'http://…'}} (or CREATE ALIAS …) runs arbitrary code at datasource creation.
> The embedded path is safe ({{{}EmbeddedH2Database{}}} sets a trusted
> {{securityDir}} file path), but a manually-configured non-embedded H2
> deployment flows the raw value into the URL. Operator-controlled/trusted
> config, so low severity, but cheap defense-in-depth.
> Fix: reject H2 code-execution tokens ({{{}INIT/RUNSCRIPT/ALIAS{}}},
> case-insensitive) in the name at URL construction, fail-fast. Not a blanket
> {{';'}} ban, because valid H2 settings exist (e.g.
> {{{}mem:knox;DB_CLOSE_DELAY=-1{}}}).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)