Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ceae27c
build: remove redundant flexmark-util-options 0.64.0 dep (fixes #8)
hongwei1 Jun 22, 2026
2270998
build: replace tools.jackson 3.x yaml dep with com.fasterxml 2.x (#7)
hongwei1 Jun 22, 2026
7a5f620
build: fix stale comment plural after flexmark-util-options removal
hongwei1 Jun 22, 2026
633ede5
chore: replace org.everit.json.schema with networknt json-schema-vali…
hongwei1 Jun 22, 2026
6d8a34d
build: remove orphaned commons-beanutils pin; hoist ObjectMapper outs…
hongwei1 Jun 22, 2026
3d478b8
build: replace tools.jackson 3.x yaml dep with com.fasterxml 2.x (#7)
hongwei1 Jun 22, 2026
757db33
build: remove redundant flexmark-util-options 0.64.0 dep (fixes #8)
hongwei1 Jun 22, 2026
1d1ee89
chore: replace org.everit.json.schema with networknt json-schema-vali…
hongwei1 Jun 22, 2026
eed3911
Merge branch 'OpenBankProject:develop' into develop
hongwei1 Jun 23, 2026
3745506
build: remove dispatch-core from production classpath (fixes #9)
hongwei1 Jun 22, 2026
c018fcf
fix: handle parse exceptions in OkHttp onResponse to prevent Promise …
hongwei1 Jun 22, 2026
65b0b9c
Merge pull request #15 from hongwei1/fix/issue-9-http-client
hongwei1 Jun 23, 2026
463a100
build: upgrade avro4s to 4.1.2 and pin avro to 1.11.4 (fixes #17)
hongwei1 Jun 23, 2026
abe0f66
fix: correct byte sign-extension in StringInputStream and clarify avr…
hongwei1 Jun 23, 2026
10774d6
Merge pull request #19 from hongwei1/fix/issue-17-avro-cve
hongwei1 Jun 23, 2026
df13d40
chore: remove httpclient direct dep and scope AHC to test (fixes #18)
hongwei1 Jun 23, 2026
4f5a85a
chore: remove dead imports from OBPAPIDynamicEndpoint
hongwei1 Jun 23, 2026
a1de651
Merge pull request #25 from hongwei1/fix/issue-18-remove-unused-http-…
hongwei1 Jun 23, 2026
a9bb7b4
Merge remote-tracking branch 'OBP/develop' into develop
hongwei1 Jun 24, 2026
ea098f4
fix: use runUpdate in ProjectionDualWrite so projection rows commit
hongwei1 Jun 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 17 additions & 30 deletions obp-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<artifactId>obp-commons</artifactId>
</dependency>

<dependency>
<groupId>com.github.everit-org.json-schema</groupId>
<artifactId>org.everit.json.schema</artifactId>
<version>1.6.1</version>
</dependency>
<!-- Upgraded from 1.4.14 (EOL branch) to 1.5.18. 1.4.x is end-of-life as of
2024; 1.5.x is the supported branch and requires Java 11+ (which we target).
Fixes CVE-2024-12798 (RCE via JaninoEventEvaluator in 1.4.x). -->
Expand All @@ -41,6 +36,7 @@
<groupId>net.databinder.dispatch</groupId>
<artifactId>dispatch-core_${scala.version}</artifactId>
<version>0.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json4s</groupId>
Expand Down Expand Up @@ -121,21 +117,20 @@
<artifactId>protobuf-java</artifactId>
<version>3.25.5</version>
</dependency>
<!-- Pin snappy-java to override the 1.1.1.3 pulled in transitively by avro 1.8.2.
<!-- Pin org.apache.avro:avro to 1.11.4 to override the 1.9.2 pulled in transitively
by avro4s 4.1.2. Fixes CVE-2024-47561 (CVSS 9.8 — RCE via schema parsing). -->
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>${apache.avro.version}</version>
</dependency>
<!-- Pin snappy-java to override older versions pulled in transitively by avro.
Fixes CVE-2023-34453, CVE-2023-34454, CVE-2023-34455, CVE-2023-43642. -->
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.1.10.4</version>
</dependency>
<!-- Pin commons-beanutils to override the 1.9.2 pulled in transitively via
everit json-schema → commons-validator. Fixes CVE-2025-48734, CVE-2019-10086;
1.11.0 adds the Improper-Access-Control fix (GHSA on top of those). -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.11.0</version>
</dependency>
<!-- Pin msal4j to override the older version pulled in transitively by
mssql-jdbc → azure-identity. Fixes CVE-2024-35255 (elevation of
privilege, fixed upstream in 1.15.1). Not used directly in source —
Expand Down Expand Up @@ -177,11 +172,6 @@
<artifactId>cglib</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
Expand Down Expand Up @@ -241,7 +231,7 @@
<dependency>
<groupId>com.sksamuel.avro4s</groupId>
<artifactId>avro4s-core_${scala.version}</artifactId>
<version>${avro.version}</version>
<version>${avro4s.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -312,19 +302,14 @@
<artifactId>json-smart</artifactId>
</dependency>
<!-- ********** flexmark START ********** -->
<!-- Library flexmark-all v0.40.8 is replaced with used modules -->
<!-- Library flexmark-all v0.40.8 is replaced with used module -->
<!-- https://mvnrepository.com/artifact/com.vladsch.flexmark/flexmark-profile-pegdown -->
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-profile-pegdown</artifactId>
<version>0.40.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.vladsch.flexmark/flexmark-util-options -->
<dependency>
<groupId>com.vladsch.flexmark</groupId>
<artifactId>flexmark-util-options</artifactId>
<version>0.64.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.web3j/core -->
<dependency>
<groupId>org.web3j</groupId>
Expand Down Expand Up @@ -422,6 +407,7 @@
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
<version>2.15.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>javax.activation</artifactId>
Expand Down Expand Up @@ -514,11 +500,12 @@
<artifactId>jackson-databind</artifactId>
<!-- version managed by jackson-bom in parent pom -->
</dependency>
<!-- https://mvnrepository.com/artifact/tools.jackson.dataformat/jackson-dataformat-yaml -->
<!-- com.fasterxml YAML module (Jackson 2.x), version managed by jackson-bom in parent pom.
Replaces the incompatible tools.jackson 3.x line so a single Jackson generation is on
the classpath. YAMLUtils uses com.fasterxml.jackson.dataformat.yaml.YAMLFactory. -->
<dependency>
<groupId>tools.jackson.dataformat</groupId>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>3.0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ package code.api.dynamic.endpoint

import APIMethodsDynamicEndpoint.ImplementationsDynamicEndpoint
import code.api.OBPRestHelper
import code.api.dynamic.endpoint.helper.DynamicEndpoints
import code.api.util.{APIUtil, VersionedOBPApis}
import code.api.util.VersionedOBPApis
import code.util.Helper.MdcLoggable
import com.openbankproject.commons.util.{ApiVersion,ApiVersionStatus}
import net.liftweb.common.{Box, Full}
import org.apache.http.HttpStatus

/*
This file defines which endpoints from all the versions are available in v4.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import org.json4s.JsonAST.JObject
/**
* Keeps a record's projection row in sync on the write path (DE_indexing, Phase 3). Guarded by
* `projectionEnabled` and a no-op unless the entity has a `ready` projection — so it changes nothing
* by default. Uses `DoobieUtil.runQuery`, which reuses Lift's request connection, so the projection
* upsert/delete participates in the SAME transaction as the canonical blob write (commit/rollback
* together). Scalar fields only (spatial dual-write is Phase 4).
* by default. Uses `DoobieUtil.runUpdate` so the INSERT is committed even when called outside an
* explicit request-scope transaction (e.g. dynamic-entity POST handlers that don't wrap in
* `withBusinessDBTransaction`). When a request-scope proxy IS present, `runUpdate` still reuses it
* via `transactorFromConnection`. Scalar fields only (spatial dual-write is Phase 4).
*/
object ProjectionDualWrite extends MdcLoggable {

/** Upsert the record's ready indexed scalar columns into the projection (called after the blob save). */
def onSave(bankId: Option[String], entityName: String, dataId: String, body: JObject): Unit =
withReadyScalarFields(bankId, entityName) { (safeTable, fields) =>
val cols = fields.map { case (f, spec) =>
Expand All @@ -24,13 +24,12 @@ object ProjectionDualWrite extends MdcLoggable {
ProjectionDDL.sqlColumnType(spec.fieldType.toString),
ProjectionCoerce.toColumnValue(body \ f, spec.fieldType))
}
DoobieUtil.runQuery(ProjectionStore.upsert(safeTable, dataId, cols))
DoobieUtil.runUpdate(ProjectionStore.upsert(safeTable, dataId, cols))
}

/** Delete the record's projection row (called after the blob delete; FK cascade is a backstop). */
def onDelete(bankId: Option[String], entityName: String, dataId: String): Unit =
withReadyScalarFields(bankId, entityName) { (safeTable, _) =>
DoobieUtil.runQuery(ProjectionStore.delete(safeTable, dataId))
DoobieUtil.runUpdate(ProjectionStore.delete(safeTable, dataId))
}

private def withReadyScalarFields(bankId: Option[String], entityName: String)
Expand Down
22 changes: 0 additions & 22 deletions obp-api/src/main/scala/code/api/util/APIUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1416,34 +1416,12 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
//ended -- Filtering and Paging relevant methods ////////////////////////////


/** Import this object's methods to add signing operators to dispatch.Request */
object OAuth {
import dispatch.{Req => Request}

import scala.collection.Map

case class Consumer(key: String, secret: String)
case class Token(value: String, secret: String)

/** Out-of-band callback code */
val oob = "oob"

/** Add OAuth operators to dispatch.Request */
implicit def Request2RequestSigner(r: Request) = new RequestSigner(r)

class RequestSigner(rb: Request) {
/** sign a request with a consumer and a token, e.g. an OAuth-signed API request */
def <@ (consumer: Consumer, token: Token): Request = {
rb <:< Map("Authorization" -> s"""DirectLogin token="${token.value}"""")
}
def <@ (consumerAndToken: Option[(Consumer,Token)]): Request = {
consumerAndToken match {
case Some((_, token)) =>
rb <:< Map("Authorization" -> s"""DirectLogin token="${token.value}"""")
case None => rb
}
}
}
}

/*
Expand Down
1 change: 0 additions & 1 deletion obp-api/src/main/scala/code/api/util/JwtUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.nimbusds.jose.util.{DefaultResourceRetriever, JSONObjectUtils}
import com.nimbusds.jwt.proc.{BadJWTException, DefaultJWTProcessor}
import com.nimbusds.jwt.{JWTClaimsSet, SignedJWT}
import com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSet
import dispatch.Future
import net.liftweb.common.{Box, Empty, Failure, Full}

object JwtUtil extends MdcLoggable {
Expand Down
33 changes: 15 additions & 18 deletions obp-api/src/main/scala/code/bankconnectors/AvroSerializer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,34 @@ import java.io.{ByteArrayOutputStream, InputStream}
import com.sksamuel.avro4s._

import scala.concurrent.{ExecutionContext, Future}
import scala.util.Try
import scala.util.Success

/**
* Provides generic serialization/deserialization
*/
trait AvroSerializer {

def serialize[T: SchemaFor : ToRecord](event: T)(implicit executionContext: ExecutionContext): String = {
def serialize[T: Encoder](event: T)(implicit executionContext: ExecutionContext): String = {
val baos = new ByteArrayOutputStream()
val output = AvroOutputStream.json[T](baos)
val output = AvroOutputStream.json[T].to(baos).build()
output.write(event)
output.close()
val r = baos.toString("UTF-8")
r
baos.toString("UTF-8")
}

def serializeFuture[T: SchemaFor : ToRecord](event: T)(implicit executionContext: ExecutionContext): Future[String] =
def serializeFuture[T: Encoder](event: T)(implicit executionContext: ExecutionContext): Future[String] =
Future(serialize(event))

def deserializeFuture[T >: Null : SchemaFor : FromRecord](data: String)(implicit executionContext: ExecutionContext): Future[Option[T]] =
def deserializeFuture[T >: Null : Decoder](data: String)(implicit executionContext: ExecutionContext): Future[Option[T]] =
Future(deserialize[T](data))

def deserialize[T >: Null : SchemaFor : FromRecord](data: String)(implicit executionContext: ExecutionContext): Option[T] = {

val input = AvroInputStream.json[T](new StringInputStream(data))
val result: Try[T] = input.singleEntity
result.toOption
def deserialize[T >: Null : Decoder](data: String)(implicit executionContext: ExecutionContext): Option[T] = {
val schema = implicitly[Decoder[T]].schema
val input = AvroInputStream.json[T].from(new StringInputStream(data)).build(schema)
val result = input.tryIterator.collectFirst { case Success(v) => v }
input.close()
result
}

class StringInputStream(s: String) extends InputStream {
private val bytes = s.getBytes
private val bytes = s.getBytes("UTF-8")

private var pos = 0

Expand All @@ -44,7 +41,7 @@ trait AvroSerializer {
} else {
val r = bytes(pos)
pos += 1
r.toInt
r.toInt & 0xFF
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.openbankproject.commons.dto._
import com.openbankproject.commons.model._
import com.openbankproject.commons.model.enums.StrongCustomerAuthenticationStatus.SCAStatus
import com.openbankproject.commons.model.enums.{AccountAttributeType, CardAttributeType, ChallengeType, CustomerAttributeType, ProductAttributeType, StrongCustomerAuthentication, TransactionAttributeType, TransactionRequestStatus}
import com.sksamuel.avro4s.SchemaFor
import net.liftweb.common.{Box, Full}
import com.openbankproject.commons.util.JsonAliases.parse

Expand Down Expand Up @@ -55,8 +54,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
inboundStatus,
inboundAdapterInfoInternal)
),
outboundAvroSchema = Some(parse(SchemaFor[OutBoundGetAdapterInfo]().toString(true))),
inboundAvroSchema = Some(parse(SchemaFor[InBoundGetAdapterInfo]().toString(true))),
outboundAvroSchema = None,
inboundAvroSchema = None,
adapterImplementation = Some(AdapterImplementation("- Core", 1))
)
override def getAdapterInfo(callContext: Option[CallContext]): Future[Box[(InboundAdapterInfoInternal, Option[CallContext])]] = {
Expand All @@ -81,8 +80,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
List(bankCommons)
)
),
outboundAvroSchema = Some(parse(SchemaFor[OutBoundGetBanks]().toString(true))),
inboundAvroSchema = Some(parse(SchemaFor[InBoundGetBanks]().toString(true))),
outboundAvroSchema = None,
inboundAvroSchema = None,
adapterImplementation = Some(AdapterImplementation("- Core", 2))
)

Expand Down Expand Up @@ -110,8 +109,8 @@ object AkkaConnector_vDec2018 extends Connector with AkkaConnectorActorInit {
bankCommons
)
),
outboundAvroSchema = Some(parse(SchemaFor[OutBoundGetBank]().toString(true))),
inboundAvroSchema = Some(parse(SchemaFor[InBoundGetBank]().toString(true))),
outboundAvroSchema = None,
inboundAvroSchema = None,
adapterImplementation = Some(AdapterImplementation("- Core", 5))
)
override def getBank(bankId : BankId, callContext: Option[CallContext]): Future[Box[(Bank, Option[CallContext])]] = {
Expand Down
Loading
Loading