From 3459364cae22c6d3c235aa0d49c14e7fc84cd6ef Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:02:15 +0530 Subject: [PATCH 1/8] policy-scan.yml From ff6447d92c2370bf6285e034cd632b02c74db02e Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:02:22 +0530 Subject: [PATCH 2/8] issues-jira.yml From dc9e4beb0ad070655b0bb58a1e8a973b222aa739 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:02:23 +0530 Subject: [PATCH 3/8] secrets-scan.yml --- .github/workflows/secrets-scan.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/secrets-scan.yml diff --git a/.github/workflows/secrets-scan.yml b/.github/workflows/secrets-scan.yml new file mode 100644 index 00000000..049c02f4 --- /dev/null +++ b/.github/workflows/secrets-scan.yml @@ -0,0 +1,29 @@ +name: Secrets Scan +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + security-secrets: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '2' + ref: '${{ github.event.pull_request.head.ref }}' + - run: | + git reset --soft HEAD~1 + - name: Install Talisman + run: | + # Download Talisman + wget https://github.com/thoughtworks/talisman/releases/download/v1.37.0/talisman_linux_amd64 -O talisman + + # Checksum verification + checksum=$(sha256sum ./talisman | awk '{print $1}') + if [ "$checksum" != "8e0ae8bb7b160bf10c4fa1448beb04a32a35e63505b3dddff74a092bccaaa7e4" ]; then exit 1; fi + + # Make it executable + chmod +x talisman + - name: Run talisman + run: | + # Run Talisman with the pre-commit hook + ./talisman --githook pre-commit \ No newline at end of file From 244226bf1be3eb91807ab6d0ed77a5abb2eead56 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 22:02:27 +0530 Subject: [PATCH 4/8] Updated codeowners From 361b81f0d92e8bc76afe2e10b8d3dcbf1ac18603 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 5 May 2025 23:32:39 +0530 Subject: [PATCH 5/8] talismanrc file updated From 02a355d3a5a9ec5672fe7dd71e8c6f1e031dbd1f Mon Sep 17 00:00:00 2001 From: "harshitha.d" Date: Fri, 16 May 2025 13:48:52 +0530 Subject: [PATCH 6/8] Update branch restrictions in PR workflow and add Talisman configuration --- .github/workflows/check-branch.yml | 8 ++++---- .talismanrc | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check-branch.yml b/.github/workflows/check-branch.yml index 4c087e59..2332f0d0 100644 --- a/.github/workflows/check-branch.yml +++ b/.github/workflows/check-branch.yml @@ -8,13 +8,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Comment PR - if: github.base_ref == 'master' && github.head_ref != 'next' + if: github.base_ref == 'master' && github.head_ref != 'staging' uses: thollander/actions-comment-pull-request@v2 with: message: | - We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch. + We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch. - name: Check branch - if: github.base_ref == 'master' && github.head_ref != 'next' + if: github.base_ref == 'master' && github.head_ref != 'staging' run: | - echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch." + echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch." exit 1 diff --git a/.talismanrc b/.talismanrc index 7cd3cd8c..c7edb88f 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1 +1,5 @@ threshold: medium +fileignoreconfig: +- filename: .github/workflows/secrets-scan.yml + checksum: d79ec3f3288964f7d117b9ad319a54c0ebc152e35f69be8fde95522034fdfb2a +version: "1.0" \ No newline at end of file From c362498d66bbbd24893bf6eefbe56b48444e0931 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Mon, 19 May 2025 18:29:07 +0530 Subject: [PATCH 7/8] Add java-dotenv dependency and refactor Credentials class to use dotenv for environment variables --- pom.xml | 6 +++ .../com/contentstack/sdk/Credentials.java | 38 +++++++++---------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/pom.xml b/pom.xml index 579e0db1..bfd42d89 100644 --- a/pom.xml +++ b/pom.xml @@ -201,6 +201,12 @@ slf4j-simple 1.7.36 + + + io.github.cdimascio + java-dotenv + 5.2.2 + diff --git a/src/test/java/com/contentstack/sdk/Credentials.java b/src/test/java/com/contentstack/sdk/Credentials.java index e6dce57f..ea26750e 100644 --- a/src/test/java/com/contentstack/sdk/Credentials.java +++ b/src/test/java/com/contentstack/sdk/Credentials.java @@ -1,13 +1,12 @@ package com.contentstack.sdk; -import java.io.FileInputStream; -import java.io.IOException; import java.rmi.AccessException; import java.util.Arrays; -import java.util.Properties; +import io.github.cdimascio.dotenv.Dotenv; public class Credentials { - private static final Properties properties = new Properties(); + + static Dotenv env = getEnv(); private static String envChecker() { String githubActions = System.getenv("GITHUB_ACTIONS"); @@ -18,24 +17,25 @@ private static String envChecker() { } } - static { - try (FileInputStream inputStream = new FileInputStream("src/test/resources/test-config.properties")) { - properties.load(inputStream); - } catch (IOException e) { - System.err.println("Error loading properties file: " + e.getMessage()); - } - } + public static Dotenv getEnv() { + env = Dotenv.configure() + .directory("src/test/resources") + .filename("env") // instead of '.env', use 'env' + .load(); + + return Dotenv.load(); + } - public static final String HOST = properties.getProperty("HOST", "cdn.contentstack.io"); - public static final String API_KEY = properties.getProperty("API_KEY", ""); - public static final String DELIVERY_TOKEN = properties.getProperty("DELIVERY_TOKEN", ""); - public static final String ENVIRONMENT = properties.getProperty("ENVIRONMENT", "env1"); - public static final String CONTENT_TYPE = properties.getProperty("contentType", "product"); - public static final String ENTRY_UID = properties.getProperty("assetUid", ""); - public static final String VARIANT_UID = properties.getProperty("variantUid", ""); + public static final String HOST = env.get("HOST", "cdn.contentstack.io"); + public static final String API_KEY = env.get("API_KEY", ""); + public static final String DELIVERY_TOKEN = env.get("DELIVERY_TOKEN", ""); + public static final String ENVIRONMENT = env.get("ENVIRONMENT", "env1"); + public static final String CONTENT_TYPE = env.get("contentType", "product"); + public static final String ENTRY_UID = env.get("assetUid", ""); + public static final String VARIANT_UID = env.get("variantUid", ""); public final static String[] VARIANTS_UID; static { - String variantsUidString = properties.getProperty("variantsUid"); + String variantsUidString = env.get("variantsUid"); if (variantsUidString != null && !variantsUidString.trim().isEmpty()) { VARIANTS_UID = Arrays.stream(variantsUidString.split(",")) From 5f1fc3f7143f0acda39d7fe040e0651599ede821 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Mon, 19 May 2025 18:40:34 +0530 Subject: [PATCH 8/8] Add Kotlin standard library dependency to dependency management --- pom.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bfd42d89..7068efe5 100644 --- a/pom.xml +++ b/pom.xml @@ -209,7 +209,16 @@ - + + + + + org.jetbrains.kotlin + kotlin-stdlib + 2.1.0 + + +