From 85e7be0dab0824a7da597428c64511521e414014 Mon Sep 17 00:00:00 2001 From: Julius Lauterbach Date: Fri, 12 Jul 2024 10:56:27 +0200 Subject: [PATCH 1/5] SDC-325, tradeID using hyphen instead of underscore --- src/main/java/net/finmath/smartcontract/util/TradeUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/finmath/smartcontract/util/TradeUtils.java b/src/main/java/net/finmath/smartcontract/util/TradeUtils.java index 77f5e129..740c1c18 100644 --- a/src/main/java/net/finmath/smartcontract/util/TradeUtils.java +++ b/src/main/java/net/finmath/smartcontract/util/TradeUtils.java @@ -12,6 +12,6 @@ private TradeUtils(){} */ public static String getUniqueTradeId(){ String uniqueID = UUID.randomUUID().toString().replace("-", "").substring(0, 17); - return "ID_" + uniqueID; + return "ID-" + uniqueID; } } From a0812d510680885756d8f63ad4ea83295c8c42a7 Mon Sep 17 00:00:00 2001 From: Julius Lauterbach Date: Fri, 12 Jul 2024 12:09:43 +0200 Subject: [PATCH 2/5] SDC-325, TradeUtilsTest adjusted --- .../java/net/finmath/smartcontract/util/TradeUtilsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java b/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java index 1b52de9b..d5d4b194 100644 --- a/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java +++ b/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java @@ -22,7 +22,7 @@ void getUniqueTradeId() { assertEquals(20, id.length()); //id only contains letters and numbers (and the leading underscore) - assertTrue(Pattern.matches("ID_[a-zA-Z0-9]+", id)); + assertTrue(Pattern.matches("ID-[a-zA-Z0-9]+", id)); //check on uniqueness assertFalse(ids.contains(id)); From d9059a79f7e7d1da63535679124f03097dd2cdcc Mon Sep 17 00:00:00 2001 From: Julius Lauterbach Date: Fri, 12 Jul 2024 12:18:14 +0200 Subject: [PATCH 3/5] SDC-325, TradeUtilsTest adjusted --- .../net/finmath/smartcontract/util/TradeUtilsTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java b/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java index d5d4b194..4abec6ac 100644 --- a/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java +++ b/src/test/java/net/finmath/smartcontract/util/TradeUtilsTest.java @@ -12,17 +12,18 @@ class TradeUtilsTest { @Test void getUniqueTradeId() { + String idPrefix = "ID-"; List ids = new ArrayList<>(); - for (int i = 1; i <= 200 ; i++){ + for (int i = 1; i <= 200; i++) { String id = TradeUtils.getUniqueTradeId(); - System.out.println(i + ". " +id); - assertTrue(id.contains("ID_")); + System.out.println(i + ". " + id); + assertTrue(id.contains(idPrefix)); //max length 20 assertEquals(20, id.length()); //id only contains letters and numbers (and the leading underscore) - assertTrue(Pattern.matches("ID-[a-zA-Z0-9]+", id)); + assertTrue(Pattern.matches(idPrefix + "[a-zA-Z0-9]+", id)); //check on uniqueness assertFalse(ids.contains(id)); From d5ddffdc2628725850002a8c2f454b8fbab6ad50 Mon Sep 17 00:00:00 2001 From: Julius Lauterbach Date: Fri, 12 Jul 2024 12:24:40 +0200 Subject: [PATCH 4/5] SDC-325, security adjustment of github actions checkout --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e75fb80..8c891cce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: name: Java 17 build and unit testing runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Java uses: actions/setup-java@v1 with: From c93a42cdb52a61c4e35dc629e1af192b2b96a801 Mon Sep 17 00:00:00 2001 From: Julius Lauterbach Date: Fri, 12 Jul 2024 12:27:54 +0200 Subject: [PATCH 5/5] SDC-325, security adjustment of github actions checkout --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c891cce..5fee5cb5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,8 +9,9 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Java - uses: actions/setup-java@v1 + uses: actions/setup-java@v2 with: + distribution: 'zulu' java-version: 17 - name: Build with Maven run: mvn -B package --file pom.xml