Skip to content

feat/CUS-11412-Added class to store environment value in runtime variable - #359

Merged
akhil-testsigma merged 1 commit into
devfrom
feat/CUS-11412-Added-class-to-store-environment-value-in-runtime-variable
Mar 23, 2026
Merged

akhil-testsigma merged 1 commit into
devfrom
feat/CUS-11412-Added-class-to-store-environment-value-in-runtime-variable

Conversation

@akhil-testsigma

@akhil-testsigma akhil-testsigma commented Mar 23, 2026 •

Copy link
Copy Markdown
Contributor

Publish this addon as PUBLIC

Addon Name: Store Environment Value
Jarvis Link: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira : https://testsigma.atlassian.net/browse/CUS-11412
Added class to store environment value in runtime variable

Summary by CodeRabbit

  • New Features
    • Store Environment Value action: New action now available across Web, Mobile Web, Android, iOS, REST API, Salesforce, and Windows platforms. Enables tests to capture and store environment information into runtime variables for use throughout test execution.

@coderabbitai

coderabbitai Bot commented Mar 23, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Added a new Maven module store_environment_value containing custom Testsigma addon actions for seven platforms (Android, iOS, web, mobile web, REST API, Salesforce, Windows). Each action extracts a test case ID, queries the Testsigma API for test case results, parses the environment name, and stores it in a runtime variable.

Changes

Cohort / File(s) Summary
Project Configuration
store_environment_value/pom.xml
Maven module definition with Java 11 target, Testsigma SDK dependencies, and build plugins for shading and source attachment.
Platform-Specific Actions
store_environment_value/src/main/java/com/testsigma/addons/android/StoreEnvironmentValue.java, store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java, store_environment_value/src/main/java/com/testsigma/addons/mobileweb/StoreEnvironmentValue.java, store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java, store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java, store_environment_value/src/main/java/com/testsigma/addons/web/StoreEnvironmentValue.java, store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java
Seven platform-specific StoreEnvironmentValue action classes that implement identical logic: extract test case ID from test machine result, call Testsigma API /api/v1/test_case_results, parse JSON response to extract environment name from nested environmentResult.executionResult.environment.name, and store in runtime variable. Each extends appropriate platform base class and includes error handling for missing data and API failures.
Configuration Properties
store_environment_value/src/main/resources/testsigma-sdk.properties
Single-line configuration file containing Testsigma SDK API key property.

Sequence Diagram

sequenceDiagram
    actor Action as Platform Action
    participant TM as TestMachineResult
    participant API as Testsigma API
    participant RT as RunTimeData
    
    Action->>TM: Extract testCaseId from<br/>first suite/case result
    alt testCaseId Present
        Action->>API: GET /api/v1/test_case_results<br/>with testCaseId query & Bearer token
        alt HTTP 200 Response
            API-->>Action: JSON with test case result
            Action->>Action: Parse response &<br/>extract environment.name<br/>from content[0]
            alt Environment Name Found
                Action->>RT: Set key=variableName<br/>value=envName
                Action->>Action: Return SUCCESS
            else Name Not Found
                Action->>Action: Return FAILED with error
            end
        else Non-200 Status
            Action->>Action: Return FAILED with error
        end
    else No testCaseId
        Action->>Action: Return FAILED with error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • Ganesh-Testsigma
  • vigneshtestsigma

Poem

🐰 Seven actions hop in line,
Each platform stores a value fine,
From API calls, the env takes flight,
Into runtime variables, snug and tight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a class to store environment value in a runtime variable, which is the primary objective of this PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/CUS-11412-Added-class-to-store-environment-value-in-runtime-variable

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

♻️ Duplicate comments (4)
store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java (1)

59-67: ⚠️ Potential issue | 🟠 Major

HTTP client lacks timeout configuration.

Same issue as other platform implementations - add connection and request timeouts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java`
around lines 59 - 67, The HttpClient in StoreEnvironmentValue currently has no
timeouts; update the HttpClient.newBuilder() call to set a connection timeout
(e.g., connectTimeout(Duration.ofSeconds(...))) and set a request timeout on the
HttpRequest (HttpRequest.newBuilder().timeout(Duration.ofSeconds(...))) before
sending; import java.time.Duration and pick the same timeout values used by
other platform implementations to keep behavior consistent, and ensure the
variables client and request are created with these timeout configurations prior
to client.send(...).
store_environment_value/src/main/java/com/testsigma/addons/mobileweb/StoreEnvironmentValue.java (1)

59-67: ⚠️ Potential issue | 🟠 Major

HTTP client lacks timeout configuration.

Same issue as other platform implementations - add connection and request timeouts to prevent indefinite hangs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/mobileweb/StoreEnvironmentValue.java`
around lines 59 - 67, The HttpClient in StoreEnvironmentValue (the HttpClient
client and HttpRequest request creation) has no timeouts and can hang; update
the HttpClient.newBuilder() to set a connect timeout (e.g., via
connectTimeout(Duration.ofSeconds(...))) and set a per-request timeout on the
HttpRequest.Builder (via timeout(Duration.ofSeconds(...))) so both connection
and request timeouts are enforced; add the necessary java.time.Duration import
and choose sensible timeout values consistent with other platform
implementations.
store_environment_value/src/main/java/com/testsigma/addons/android/StoreEnvironmentValue.java (1)

59-67: ⚠️ Potential issue | 🟠 Major

HTTP client lacks timeout configuration.

Same issue as other platform implementations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/android/StoreEnvironmentValue.java`
around lines 59 - 67, The HttpClient in StoreEnvironmentValue is created without
any timeout, so replace the HttpClient.newBuilder().build() usage to configure
timeouts (e.g., set connectTimeout on HttpClient via
HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(...)).build()) and
also add a request-level timeout on the HttpRequest (use
HttpRequest.newBuilder().timeout(Duration.ofSeconds(...)) on the same request
being sent) so both connection and overall request timeouts are enforced; update
any imports for java.time.Duration and ensure the configured durations are
chosen consistently with other platform implementations.
store_environment_value/src/main/java/com/testsigma/addons/web/StoreEnvironmentValue.java (1)

59-67: ⚠️ Potential issue | 🟠 Major

HTTP client lacks timeout configuration.

Same issue as other platform implementations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/web/StoreEnvironmentValue.java`
around lines 59 - 67, The HTTP client is created without any timeout which can
hang requests; update the HttpClient and/or HttpRequest creation to include
explicit timeouts by calling
HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(...)) and/or
HttpRequest.newBuilder().timeout(Duration.ofSeconds(...)) so the call in
StoreEnvironmentValue that builds the client (HttpClient client =
HttpClient.newBuilder().build()) and the request
(HttpRequest.newBuilder()...GET().build()) use a reasonable timeout value to
prevent indefinite blocking.
🧹 Nitpick comments (7)
store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java (2)

8-8: Unused import: WebAction.

This class extends IOSAction, not WebAction.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java`
at line 8, The import com.testsigma.sdk.WebAction is unused in the
StoreEnvironmentValue class (which extends IOSAction); remove that import
statement to clean up unused dependencies and avoid compiler warnings—look for
the import line referencing WebAction in StoreEnvironmentValue.java and delete
it.

16-16: Unused and suspicious import: org.openqa.selenium.devtools.v135.io.IO.

This import is unused and references a specific Chrome DevTools version (v135). This appears to be a copy-paste artifact and should be removed.

Proposed fix
-import org.openqa.selenium.devtools.v135.io.IO;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java`
at line 16, Remove the unused, versioned DevTools import
org.openqa.selenium.devtools.v135.io.IO from StoreEnvironmentValue.java; locate
the import statement near the top of the StoreEnvironmentValue class and delete
it so the file no longer references a hard-coded Chrome DevTools version and to
avoid unused-import compilation warnings, then recompile to verify no other
references to IO remain.
store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java (1)

7-8: Unused import: WebAction.

WebAction is imported but not used; this class extends SalesforceAction.

Proposed fix
 import com.testsigma.sdk.SalesforceAction;
-import com.testsigma.sdk.WebAction;
 import com.testsigma.sdk.annotation.Action;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java`
around lines 7 - 8, Remove the unused import of WebAction from the
StoreEnvironmentValue class: update the import block that currently includes
com.testsigma.sdk.WebAction so only com.testsigma.sdk.SalesforceAction remains,
ensuring no other references to WebAction exist in methods or fields of
StoreEnvironmentValue.
store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java (1)

7-8: Unused import: WebAction.

This class extends WindowsAction, not WebAction.

Proposed fix
 import com.testsigma.sdk.Result;
-import com.testsigma.sdk.WebAction;
 import com.testsigma.sdk.WindowsAction;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java`
around lines 7 - 8, The import com.testsigma.sdk.WebAction is unused in the
StoreEnvironmentValue class (which extends WindowsAction); remove that unused
import from StoreEnvironmentValue.java so only com.testsigma.sdk.WindowsAction
remains, and recompile to ensure no references to WebAction exist in methods of
StoreEnvironmentValue.
store_environment_value/pom.xml (2)

42-46: Missing test scope for TestNG dependency.

TestNG is a testing framework and should be scoped to test to avoid bundling it into the production shaded JAR.

Proposed fix
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <version>6.14.3</version>
+            <scope>test</scope>
         </dependency>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@store_environment_value/pom.xml` around lines 42 - 46, The TestNG dependency
(groupId org.testng, artifactId testng, version 6.14.3) is missing a test scope
and is being included in the production shaded JAR; update the dependency block
to add a <scope>test</scope> element so TestNG is only used for testing and not
packaged with the production artifact.

36-41: Consider upgrading from JUnit 5.8.0-M1 milestone release to a stable version.

The current version 5.8.0-M1 is a pre-release milestone. The latest stable release is 6.0.3. Upgrade to a stable version for production code.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@store_environment_value/pom.xml` around lines 36 - 41, Update the JUnit
dependency from the milestone release to the stable 6.0.3 by changing the
junit-jupiter-api version referenced by the ${junit.jupiter.version} property to
6.0.3; also ensure any related JUnit artifacts in the POM (e.g.,
junit-jupiter-engine, junit-platform-*) use the same stable version and adjust
build plugins (Surefire/Failsafe) if needed to remain compatible with JUnit 6.
store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java (1)

29-34: Validate required test data early for clearer failures.

variableName and bearerToken are dereferenced later without upfront guards; missing input currently degrades to generic exception flow.

Suggested refactor
   public Result execute() throws NoSuchElementException {
     Result result = Result.SUCCESS;
     logger.info("Initiating execution");
     try {
+      if (variableName == null || variableName.getValue() == null || variableName.getValue().toString().isBlank()) {
+        setErrorMessage("Runtime variable name is required");
+        return Result.FAILED;
+      }
+      if (bearerToken == null || bearerToken.getValue() == null || bearerToken.getValue().toString().isBlank()) {
+        setErrorMessage("Bearer token is required");
+        return Result.FAILED;
+      }
+
       Long testCaseId = null;

Also applies to: 63-64, 84-85

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java`
around lines 29 - 34, Add upfront validation for the required TestData fields in
StoreEnvironmentValue: check that variableName and bearerToken are not null (and
not empty when reading string values) at the start of the action's execution
(e.g., in the execute/run method of StoreEnvironmentValue) and fail fast with a
clear TestsigmaException or set the action result to failed with a descriptive
message (e.g., "missing required test data: variable-name" or "missing required
test data: token") before any dereference occurs; update all places using
variableName and bearerToken (the spots referenced around lines 63-64 and 84-85)
to rely on this early guard so later code can assume non-null values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java`:
- Around line 1-108: The StoreEnvironmentValue class duplicates logic present
across platforms; extract the shared HTTP/JSON/testCaseId parsing logic into a
common helper (e.g., EnvironmentValueExtractor) and make StoreEnvironmentValue a
thin wrapper that calls it from execute(), passing testMachineResult and
bearerToken.getValue(), then only set
runTimeData.setKey(variableName.getValue().toString()) and
runTimeData.setValue(envName) and handle Result and messages there; refactor
references in execute(), and move JSON parsing/HttpClient call/exception
handling into the new utility so other platform classes
(Android/Web/MobileWeb/Windows/Salesforce/REST) can reuse it.

In
`@store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java`:
- Around line 80-86: The code currently uses envNode.path("name").asText()
without checking if "name" exists, so empty strings get stored and success is
reported; update StoreEnvironmentValue to first verify the presence and
non-empty value of envNode.get("name") (or envNode.has("name") &&
!envNode.path("name").asText().isEmpty()) before setting envName/runTimeData; if
the "name" field is missing or empty, do not call runTimeData.setValue or
setSuccessMessage — instead call setErrorMessage (or the task-failure mechanism
used in this class) with a clear error and return/throw to mark the step failed;
references: envNode, envName, runTimeData, variableName, setSuccessMessage.
- Around line 60-67: The HttpClient and HttpRequest are created without timeouts
which can cause indefinite blocking; update the HttpClient builder used to
create "client" to include a connect timeout (e.g., via
HttpClient.newBuilder().connectTimeout(...)) and set a request-level timeout on
the HttpRequest built into "request" (e.g.,
HttpRequest.newBuilder()....timeout(...)) so that the client.send(...) call will
fail fast on network issues; adjust the timeout durations to sensible values for
your environment and ensure any InterruptedException/IOException handling
remains correct around the send call.

In
`@store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java`:
- Around line 102-104: Fix the typo in the error messages inside
StoreEnvironmentValue where "Error Occured" is used: update the messages passed
to logger.warn(...) and setErrorMessage(...) to read "Error Occurred" (e.g.,
change the string in the logger.warn call that currently concatenates
ExceptionUtils.getStackTrace(e) and the string passed to setErrorMessage that
uses ExceptionUtils.getMessage(e)); ensure both places are updated so the log
and the UI error text are consistent.
- Around line 59-67: The HttpClient in StoreEnvironmentValue is built without
timeouts and can hang; update the HttpClient and HttpRequest creation to include
explicit timeouts (e.g., use
HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(30)) and set a
per-request timeout on HttpRequest via .timeout(Duration.ofSeconds(30))) so
requests will fail fast; locate the HttpClient client and HttpRequest request
instantiations in StoreEnvironmentValue and add the Duration-based connect and
request timeouts accordingly.
- Around line 79-85: envName may be empty because JsonNode.path(...).asText()
returns "" when missing; add a guard after extracting envName (the variable
envName from envNode) that checks if envName.trim().isEmpty(), and if so do not
call runTimeData.setValue(...) or setSuccessMessage(...); instead call the
action's error reporting (e.g., setErrorMessage or appropriate failure method)
with a clear message referencing the envNode and variableName.getValue(), and
return/exit the method early; otherwise continue with the existing
runTimeData.setKey(...)/setValue(...) and setSuccessMessage(...) flow.
- Around line 22-33: The actionText uses the placeholder "api-key" but the
bearer token TestData is annotated as reference = "token", causing a UI
mismatch; update the TestData reference for the bearerToken field (in class
StoreEnvironmentValue) to match the actionText placeholder (change reference =
"token" to reference = "api-key") or alternatively update actionText to use
"token"—pick one consistent naming and apply it to the `@TestData` on the
bearerToken field so the UI and code reference the same key.

In `@store_environment_value/src/main/resources/testsigma-sdk.properties`:
- Line 1: The committed testsigma-sdk.properties contains a hardcoded JWT API
key which must be removed: delete this file from the repo, remove it from future
commits (use git rm --cached if already committed) and add its name/pattern to
.gitignore; rotate/revoke the exposed API key immediately outside the codebase;
replace usage of the file in code by reading the credential from a secure source
(e.g., environment variable like TESTSIGMA_API_KEY or a secrets manager)
wherever the testsigma-sdk.api.key value was referenced so functions/classes
that previously relied on testsigma-sdk.properties now read
process/environment-backed configuration.

---

Duplicate comments:
In
`@store_environment_value/src/main/java/com/testsigma/addons/android/StoreEnvironmentValue.java`:
- Around line 59-67: The HttpClient in StoreEnvironmentValue is created without
any timeout, so replace the HttpClient.newBuilder().build() usage to configure
timeouts (e.g., set connectTimeout on HttpClient via
HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(...)).build()) and
also add a request-level timeout on the HttpRequest (use
HttpRequest.newBuilder().timeout(Duration.ofSeconds(...)) on the same request
being sent) so both connection and overall request timeouts are enforced; update
any imports for java.time.Duration and ensure the configured durations are
chosen consistently with other platform implementations.

In
`@store_environment_value/src/main/java/com/testsigma/addons/mobileweb/StoreEnvironmentValue.java`:
- Around line 59-67: The HttpClient in StoreEnvironmentValue (the HttpClient
client and HttpRequest request creation) has no timeouts and can hang; update
the HttpClient.newBuilder() to set a connect timeout (e.g., via
connectTimeout(Duration.ofSeconds(...))) and set a per-request timeout on the
HttpRequest.Builder (via timeout(Duration.ofSeconds(...))) so both connection
and request timeouts are enforced; add the necessary java.time.Duration import
and choose sensible timeout values consistent with other platform
implementations.

In
`@store_environment_value/src/main/java/com/testsigma/addons/web/StoreEnvironmentValue.java`:
- Around line 59-67: The HTTP client is created without any timeout which can
hang requests; update the HttpClient and/or HttpRequest creation to include
explicit timeouts by calling
HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(...)) and/or
HttpRequest.newBuilder().timeout(Duration.ofSeconds(...)) so the call in
StoreEnvironmentValue that builds the client (HttpClient client =
HttpClient.newBuilder().build()) and the request
(HttpRequest.newBuilder()...GET().build()) use a reasonable timeout value to
prevent indefinite blocking.

In
`@store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java`:
- Around line 59-67: The HttpClient in StoreEnvironmentValue currently has no
timeouts; update the HttpClient.newBuilder() call to set a connection timeout
(e.g., connectTimeout(Duration.ofSeconds(...))) and set a request timeout on the
HttpRequest (HttpRequest.newBuilder().timeout(Duration.ofSeconds(...))) before
sending; import java.time.Duration and pick the same timeout values used by
other platform implementations to keep behavior consistent, and ensure the
variables client and request are created with these timeout configurations prior
to client.send(...).

---

Nitpick comments:
In `@store_environment_value/pom.xml`:
- Around line 42-46: The TestNG dependency (groupId org.testng, artifactId
testng, version 6.14.3) is missing a test scope and is being included in the
production shaded JAR; update the dependency block to add a <scope>test</scope>
element so TestNG is only used for testing and not packaged with the production
artifact.
- Around line 36-41: Update the JUnit dependency from the milestone release to
the stable 6.0.3 by changing the junit-jupiter-api version referenced by the
${junit.jupiter.version} property to 6.0.3; also ensure any related JUnit
artifacts in the POM (e.g., junit-jupiter-engine, junit-platform-*) use the same
stable version and adjust build plugins (Surefire/Failsafe) if needed to remain
compatible with JUnit 6.

In
`@store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java`:
- Line 8: The import com.testsigma.sdk.WebAction is unused in the
StoreEnvironmentValue class (which extends IOSAction); remove that import
statement to clean up unused dependencies and avoid compiler warnings—look for
the import line referencing WebAction in StoreEnvironmentValue.java and delete
it.
- Line 16: Remove the unused, versioned DevTools import
org.openqa.selenium.devtools.v135.io.IO from StoreEnvironmentValue.java; locate
the import statement near the top of the StoreEnvironmentValue class and delete
it so the file no longer references a hard-coded Chrome DevTools version and to
avoid unused-import compilation warnings, then recompile to verify no other
references to IO remain.

In
`@store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java`:
- Around line 29-34: Add upfront validation for the required TestData fields in
StoreEnvironmentValue: check that variableName and bearerToken are not null (and
not empty when reading string values) at the start of the action's execution
(e.g., in the execute/run method of StoreEnvironmentValue) and fail fast with a
clear TestsigmaException or set the action result to failed with a descriptive
message (e.g., "missing required test data: variable-name" or "missing required
test data: token") before any dereference occurs; update all places using
variableName and bearerToken (the spots referenced around lines 63-64 and 84-85)
to rely on this early guard so later code can assume non-null values.

In
`@store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java`:
- Around line 7-8: Remove the unused import of WebAction from the
StoreEnvironmentValue class: update the import block that currently includes
com.testsigma.sdk.WebAction so only com.testsigma.sdk.SalesforceAction remains,
ensuring no other references to WebAction exist in methods or fields of
StoreEnvironmentValue.

In
`@store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java`:
- Around line 7-8: The import com.testsigma.sdk.WebAction is unused in the
StoreEnvironmentValue class (which extends WindowsAction); remove that unused
import from StoreEnvironmentValue.java so only com.testsigma.sdk.WindowsAction
remains, and recompile to ensure no references to WebAction exist in methods of
StoreEnvironmentValue.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: caf5bcf0-d7e0-4306-8931-85c3ad963a8f

📥 Commits

Reviewing files that changed from the base of the PR and between 1f8d436 and 2a1a0af.

📒 Files selected for processing (9)
  • store_environment_value/pom.xml
  • store_environment_value/src/main/java/com/testsigma/addons/android/StoreEnvironmentValue.java
  • store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java
  • store_environment_value/src/main/java/com/testsigma/addons/mobileweb/StoreEnvironmentValue.java
  • store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java
  • store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java
  • store_environment_value/src/main/java/com/testsigma/addons/web/StoreEnvironmentValue.java
  • store_environment_value/src/main/java/com/testsigma/addons/windows/StoreEnvironmentValue.java
  • store_environment_value/src/main/resources/testsigma-sdk.properties

Comment on lines +1 to +108
package com.testsigma.addons.ios;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.testsigma.sdk.ApplicationType;
import com.testsigma.sdk.IOSAction;
import com.testsigma.sdk.Result;
import com.testsigma.sdk.WebAction;
import com.testsigma.sdk.annotation.Action;
import com.testsigma.sdk.annotation.RunTimeData;
import com.testsigma.sdk.annotation.TestData;
import com.testsigma.sdk.annotation.TestMachineResult;
import lombok.Data;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.devtools.v135.io.IO;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

@Data
@Action(actionText = "Store environment value using Testsigma API key api-key in runtime variable variable-name",
description = "Stores environment value in runtime variable",
applicationType = ApplicationType.IOS,
useCustomScreenshot = false)
public class StoreEnvironmentValue extends IOSAction {

@TestData(reference = "variable-name", isRuntimeVariable = true)
private com.testsigma.sdk.TestData variableName;

@TestData(reference = "token")
private com.testsigma.sdk.TestData bearerToken;

@RunTimeData
private com.testsigma.sdk.RunTimeData runTimeData;

@TestMachineResult
private com.testsigma.sdk.TestMachineResult testMachineResult;

@Override
public Result execute() throws NoSuchElementException {
Result result = Result.SUCCESS;
logger.info("Initiating execution");
try {
Long testCaseId = null;
if (testMachineResult != null && testMachineResult.getSuiteResults() != null && !testMachineResult.getSuiteResults().isEmpty()) {
com.testsigma.sdk.SuiteResult suiteResult = testMachineResult.getSuiteResults().get(0);
if (suiteResult.getCaseResults() != null && !suiteResult.getCaseResults().isEmpty()) {
com.testsigma.sdk.TestCaseResult caseResult = suiteResult.getCaseResults().get(0);
testCaseId = caseResult.getTestCaseId();
logger.info("Extracted testCaseId: " + testCaseId);
}
}

if (testCaseId != null) {
String url = "https://app.testsigma.com/api/v1/test_case_results?query=testCaseId%3A" + testCaseId + "&sort=createdDate%2Cdesc&page=0&size=1";
logger.info("Calling API: " + url);

HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + bearerToken.getValue())
.GET()
.build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

if (response.statusCode() == 200) {
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(response.body());
JsonNode contentNode = rootNode.path("content");

if (contentNode.isArray() && contentNode.size() > 0) {
JsonNode envNode = contentNode.get(0)
.path("environmentResult")
.path("executionResult")
.path("environment");

String envName = envNode.path("name").asText();
logger.info("Extracted environment name: " + envName);

runTimeData.setValue(envName);
runTimeData.setKey(variableName.getValue().toString());
setSuccessMessage("Successfully stored environment name: '" + envName + "' in runtime variable: " + variableName.getValue());
} else {
logger.warn("No content found in API response");
setErrorMessage("No content found in API response");
result = Result.FAILED;
}
} else {
logger.warn("API call failed with status code: " + response.statusCode());
setErrorMessage("API call failed with status code: " + response.statusCode());
result = Result.FAILED;
}
} else {
logger.warn("testCaseId not found");
setErrorMessage("testCaseId not found");
result = Result.FAILED;
}
} catch (Exception e) {
logger.warn("Error Occurred: " + ExceptionUtils.getStackTrace(e));
setErrorMessage("Error Occured: " + ExceptionUtils.getMessage(e));
result = Result.FAILED;
}
return result;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Severe code duplication across all 7 platform implementations.

This file is nearly identical to the Android, Web, MobileWeb, Windows, Salesforce, and REST API implementations. Only the package name, import, ApplicationType, and parent class differ.

Consider extracting the shared logic into a common utility class or abstract base class to improve maintainability. Currently, any bug fix or enhancement needs to be applied to 7 files.

Example approach - extract common logic
// Common utility class
public class EnvironmentValueExtractor {
    public static String extractEnvironmentName(
            TestMachineResult testMachineResult,
            String bearerToken,
            Logger logger) throws Exception {
        // Shared implementation here
    }
}

// Platform-specific class becomes thin wrapper
public class StoreEnvironmentValue extends IOSAction {
    `@Override`
    public Result execute() {
        try {
            String envName = EnvironmentValueExtractor.extractEnvironmentName(
                testMachineResult, bearerToken.getValue().toString(), logger);
            runTimeData.setKey(variableName.getValue().toString());
            runTimeData.setValue(envName);
            setSuccessMessage("Successfully stored environment name: '" + envName + "'");
            return Result.SUCCESS;
        } catch (Exception e) {
            setErrorMessage(e.getMessage());
            return Result.FAILED;
        }
    }
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/ios/StoreEnvironmentValue.java`
around lines 1 - 108, The StoreEnvironmentValue class duplicates logic present
across platforms; extract the shared HTTP/JSON/testCaseId parsing logic into a
common helper (e.g., EnvironmentValueExtractor) and make StoreEnvironmentValue a
thin wrapper that calls it from execute(), passing testMachineResult and
bearerToken.getValue(), then only set
runTimeData.setKey(variableName.getValue().toString()) and
runTimeData.setValue(envName) and handle Result and messages there; refactor
references in execute(), and move JSON parsing/HttpClient call/exception
handling into the new utility so other platform classes
(Android/Web/MobileWeb/Windows/Salesforce/REST) can reuse it.

Comment on lines +60 to +67
HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + bearerToken.getValue())
.GET()
.build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify timeout usage for outbound Java HTTP calls in this addon module.
rg -nP --type=java 'HttpClient\.newBuilder\(|HttpRequest\.newBuilder\(|connectTimeout\(|\.timeout\(' store_environment_value/src/main/java/com/testsigma/addons

Repository: testsigmahq/testsigma-addons

Length of output: 1795


🌐 Web query:

Java HttpClient HttpRequest timeout configuration best practices

💡 Result:

Java HttpClient (java.net.http.HttpClient since Java 11) supports two main timeout configurations: connect timeout at the client level and overall request timeout at the request level. The connect timeout applies when establishing new connections (reused connections ignore it). The request timeout is the minimum of client connect timeout (if applicable) and request timeout, covering the entire request from send to full response receipt. Best practices: - Set connect timeout on HttpClient: 5-20 seconds typical, e.g., Duration.ofSeconds(10). Use HttpClient.newBuilder.connectTimeout(Duration.ofSeconds(10)).build. - Set request timeout on HttpRequest: 30 seconds to 2 minutes, e.g., Duration.ofSeconds(30). Use HttpRequest.newBuilder.timeout(Duration.ofSeconds(30)).build. This overrides or combines with client timeout. - Handle exceptions: HttpConnectTimeoutException for connect failures, HttpTimeoutException for request timeouts. Use try-catch or CompletableFuture.exceptionally for async. - No separate socket/read timeout; request timeout covers response waiting. - Reuse a single HttpClient instance for efficiency; it's thread-safe. - For production, tune based on service SLAs: shorter for internal APIs (5-10s), longer for external (30-60s). Test with slow networks. - Avoid zero/negative durations; defaults have no timeout (may hang indefinitely). Example: import java.net.http.*; import java.time.Duration; import java.net.URI; HttpClient client = HttpClient.newBuilder .connectTimeout(Duration.ofSeconds(10)) .build; HttpRequest request = HttpRequest.newBuilder .uri(URI.create("https://example.com")) .timeout(Duration.ofSeconds(30)) .GET .build; try { HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString); } catch (HttpConnectTimeoutException e) { // Handle connect timeout } catch (HttpTimeoutException e) { // Handle request timeout } Note: This applies to standard JDK HttpClient, not Apache HttpClient (which has connect/socket/response timeouts via RequestConfig). Confirm usage context if Apache.

Citations:


🏁 Script executed:

#!/bin/bash
# Try to locate and examine the specific file directly from common repository structures
find . -name "StoreEnvironmentValue.java" -type f 2>/dev/null | head -5

Repository: testsigmahq/testsigma-addons

Length of output: 1887


Add HTTP timeouts to prevent indefinite hangs on external API calls.

Lines 60–67 perform a blocking external call without any timeout configuration. The HttpClient is built with no connectTimeout(), and the HttpRequest has no timeout() set. According to Java HTTP best practices, both should be specified to prevent the client from hanging indefinitely during network issues.

Suggested fix
+import java.time.Duration;
...
-        HttpClient client = HttpClient.newBuilder().build();
+        HttpClient client = HttpClient.newBuilder()
+                .connectTimeout(Duration.ofSeconds(10))
+                .build();
         HttpRequest request = HttpRequest.newBuilder()
                 .uri(URI.create(url))
                 .header("Authorization", "Bearer " + bearerToken.getValue())
+                .timeout(Duration.ofSeconds(20))
                 .GET()
                 .build();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + bearerToken.getValue())
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + bearerToken.getValue())
.timeout(Duration.ofSeconds(20))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java`
around lines 60 - 67, The HttpClient and HttpRequest are created without
timeouts which can cause indefinite blocking; update the HttpClient builder used
to create "client" to include a connect timeout (e.g., via
HttpClient.newBuilder().connectTimeout(...)) and set a request-level timeout on
the HttpRequest built into "request" (e.g.,
HttpRequest.newBuilder()....timeout(...)) so that the client.send(...) call will
fail fast on network issues; adjust the timeout durations to sensible values for
your environment and ensure any InterruptedException/IOException handling
remains correct around the send call.

Comment on lines +80 to +86
String envName = envNode.path("name").asText();
logger.info("Extracted environment name: " + envName);

runTimeData.setValue(envName);
runTimeData.setKey(variableName.getValue().toString());
setSuccessMessage("Successfully stored environment name: '" + envName + "' in runtime variable: " + variableName.getValue());
} else {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Fail when environment name is missing instead of storing an empty runtime value.

Line 80 uses asText() without validating presence. If the field is absent, this stores an empty string and still reports success.

Suggested fix
-            String envName = envNode.path("name").asText();
+            String envName = envNode.path("name").asText(null);
+            if (envName == null || envName.isBlank()) {
+              logger.warn("Environment name missing in API response");
+              setErrorMessage("Environment name missing in API response");
+              return Result.FAILED;
+            }
             logger.info("Extracted environment name: " + envName);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/restapi/StoreEnvironmentValue.java`
around lines 80 - 86, The code currently uses envNode.path("name").asText()
without checking if "name" exists, so empty strings get stored and success is
reported; update StoreEnvironmentValue to first verify the presence and
non-empty value of envNode.get("name") (or envNode.has("name") &&
!envNode.path("name").asText().isEmpty()) before setting envName/runTimeData; if
the "name" field is missing or empty, do not call runTimeData.setValue or
setSuccessMessage — instead call setErrorMessage (or the task-failure mechanism
used in this class) with a clear error and return/throw to mark the step failed;
references: envNode, envName, runTimeData, variableName, setSuccessMessage.

Comment on lines +22 to +33
@Data
@Action(actionText = "Store environment value using Testsigma API key api-key in runtime variable variable-name",
description = "Stores environment value in runtime variable",
applicationType = ApplicationType.Salesforce,
useCustomScreenshot = false)
public class StoreEnvironmentValue extends SalesforceAction {

@TestData(reference = "variable-name", isRuntimeVariable = true)
private com.testsigma.sdk.TestData variableName;

@TestData(reference = "token")
private com.testsigma.sdk.TestData bearerToken;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Mismatch between actionText placeholder and TestData reference.

The actionText references api-key but the @TestData annotation uses reference = "token". Users will see "api-key" in the UI but need to provide a value for "token".

Proposed fix - align references
-@Action(actionText = "Store environment value using Testsigma API key api-key in runtime variable variable-name",
+@Action(actionText = "Store environment value using Testsigma API token in runtime variable variable-name",
         description = "Stores environment value in runtime variable",
         applicationType = ApplicationType.Salesforce,
         useCustomScreenshot = false)
 public class StoreEnvironmentValue extends SalesforceAction {
 
   `@TestData`(reference = "variable-name", isRuntimeVariable = true)
   private com.testsigma.sdk.TestData variableName;
   
-  `@TestData`(reference = "token")
+  `@TestData`(reference = "api-token")
   private com.testsigma.sdk.TestData bearerToken;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Data
@Action(actionText = "Store environment value using Testsigma API key api-key in runtime variable variable-name",
description = "Stores environment value in runtime variable",
applicationType = ApplicationType.Salesforce,
useCustomScreenshot = false)
public class StoreEnvironmentValue extends SalesforceAction {
@TestData(reference = "variable-name", isRuntimeVariable = true)
private com.testsigma.sdk.TestData variableName;
@TestData(reference = "token")
private com.testsigma.sdk.TestData bearerToken;
`@Data`
`@Action`(actionText = "Store environment value using Testsigma API token in runtime variable variable-name",
description = "Stores environment value in runtime variable",
applicationType = ApplicationType.Salesforce,
useCustomScreenshot = false)
public class StoreEnvironmentValue extends SalesforceAction {
`@TestData`(reference = "variable-name", isRuntimeVariable = true)
private com.testsigma.sdk.TestData variableName;
`@TestData`(reference = "api-token")
private com.testsigma.sdk.TestData bearerToken;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java`
around lines 22 - 33, The actionText uses the placeholder "api-key" but the
bearer token TestData is annotated as reference = "token", causing a UI
mismatch; update the TestData reference for the bearerToken field (in class
StoreEnvironmentValue) to match the actionText placeholder (change reference =
"token" to reference = "api-key") or alternatively update actionText to use
"token"—pick one consistent naming and apply it to the `@TestData` on the
bearerToken field so the UI and code reference the same key.

Comment on lines +59 to +67

HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + bearerToken.getValue())
.GET()
.build();

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

HTTP client lacks timeout configuration.

The HttpClient is created without connection or request timeouts. If the API is unresponsive, the action will hang indefinitely, potentially blocking test execution.

Proposed fix - add timeout
-        HttpClient client = HttpClient.newBuilder().build();
+        HttpClient client = HttpClient.newBuilder()
+                .connectTimeout(java.time.Duration.ofSeconds(30))
+                .build();
         HttpRequest request = HttpRequest.newBuilder()
                 .uri(URI.create(url))
                 .header("Authorization", "Bearer " + bearerToken.getValue())
+                .timeout(java.time.Duration.ofSeconds(30))
                 .GET()
                 .build();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
HttpClient client = HttpClient.newBuilder().build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + bearerToken.getValue())
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
HttpClient client = HttpClient.newBuilder()
.connectTimeout(java.time.Duration.ofSeconds(30))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer " + bearerToken.getValue())
.timeout(java.time.Duration.ofSeconds(30))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java`
around lines 59 - 67, The HttpClient in StoreEnvironmentValue is built without
timeouts and can hang; update the HttpClient and HttpRequest creation to include
explicit timeouts (e.g., use
HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(30)) and set a
per-request timeout on HttpRequest via .timeout(Duration.ofSeconds(30))) so
requests will fail fast; locate the HttpClient client and HttpRequest request
instantiations in StoreEnvironmentValue and add the Duration-based connect and
request timeouts accordingly.

Comment on lines +79 to +85

String envName = envNode.path("name").asText();
logger.info("Extracted environment name: " + envName);

runTimeData.setValue(envName);
runTimeData.setKey(variableName.getValue().toString());
setSuccessMessage("Successfully stored environment name: '" + envName + "' in runtime variable: " + variableName.getValue());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Empty environment name not validated before reporting success.

JsonNode.path().asText() returns an empty string if the path doesn't exist. The action will store an empty string and report success, which may silently cause downstream failures.

Proposed fix - validate envName
             String envName = envNode.path("name").asText();
+            if (envName == null || envName.isEmpty()) {
+              logger.warn("Environment name is empty or missing");
+              setErrorMessage("Environment name is empty or missing in API response");
+              return Result.FAILED;
+            }
             logger.info("Extracted environment name: " + envName);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java`
around lines 79 - 85, envName may be empty because JsonNode.path(...).asText()
returns "" when missing; add a guard after extracting envName (the variable
envName from envNode) that checks if envName.trim().isEmpty(), and if so do not
call runTimeData.setValue(...) or setSuccessMessage(...); instead call the
action's error reporting (e.g., setErrorMessage or appropriate failure method)
with a clear message referencing the envNode and variableName.getValue(), and
return/exit the method early; otherwise continue with the existing
runTimeData.setKey(...)/setValue(...) and setSuccessMessage(...) flow.

Comment on lines +102 to +104
logger.warn("Error Occurred: " + ExceptionUtils.getStackTrace(e));
setErrorMessage("Error Occured: " + ExceptionUtils.getMessage(e));
result = Result.FAILED;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Typo: "Error Occured" should be "Error Occurred".

Proposed fix
-      setErrorMessage("Error Occured: " + ExceptionUtils.getMessage(e));
+      setErrorMessage("Error Occurred: " + ExceptionUtils.getMessage(e));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logger.warn("Error Occurred: " + ExceptionUtils.getStackTrace(e));
setErrorMessage("Error Occured: " + ExceptionUtils.getMessage(e));
result = Result.FAILED;
logger.warn("Error Occurred: " + ExceptionUtils.getStackTrace(e));
setErrorMessage("Error Occurred: " + ExceptionUtils.getMessage(e));
result = Result.FAILED;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@store_environment_value/src/main/java/com/testsigma/addons/salesforce/StoreEnvironmentValue.java`
around lines 102 - 104, Fix the typo in the error messages inside
StoreEnvironmentValue where "Error Occured" is used: update the messages passed
to logger.warn(...) and setErrorMessage(...) to read "Error Occurred" (e.g.,
change the string in the logger.warn call that currently concatenates
ExceptionUtils.getStackTrace(e) and the string passed to setErrorMessage that
uses ExceptionUtils.getMessage(e)); ensure both places are updated so the log
and the UI error text are consistent.

@@ -0,0 +1 @@
testsigma-sdk.api.key=eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIyMjMyMmM2Ni04NWYzLWIyN2UtN2FiOS0zM2U2M2Q4OWM1MGIiLCJ1bmlxdWVJZCI6IjYwOTAiLCJpZGVudGl0eUFjY291bnRVVUlkIjoiMzUifQ.J7zfur9Wk9NKUzQYtCd8dyjk7_OPBOXFVL33fara9n58ZsjsJhn7VozVi2yRkIQiJTDArqEY07Q_r1ibWj5ljQ No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Hardcoded API key committed to repository.

This JWT token is a secret credential that should never be committed to source control. This addon is being published as PUBLIC per the PR description, which will expose this key to anyone.

Immediate actions required:

  1. Remove this file from the repository
  2. Rotate/revoke this API key immediately as it may already be compromised in git history
  3. Use environment variables or a secure secrets manager to provide the key at runtime
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@store_environment_value/src/main/resources/testsigma-sdk.properties` at line
1, The committed testsigma-sdk.properties contains a hardcoded JWT API key which
must be removed: delete this file from the repo, remove it from future commits
(use git rm --cached if already committed) and add its name/pattern to
.gitignore; rotate/revoke the exposed API key immediately outside the codebase;
replace usage of the file in code by reading the credential from a secure source
(e.g., environment variable like TESTSIGMA_API_KEY or a secrets manager)
wherever the testsigma-sdk.api.key value was referenced so functions/classes
that previously relied on testsigma-sdk.properties now read
process/environment-backed configuration.

@akhil-testsigma
akhil-testsigma merged commit c58301f into dev Mar 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants