Skip to content

Cus-11200 added support to decode strings with urls - #356

Merged
ManojTestsigma merged 4 commits into
devfrom
CUS-11200
Mar 17, 2026
Merged

ManojTestsigma merged 4 commits into
devfrom
CUS-11200

Conversation

@ManojTestsigma

@ManojTestsigma ManojTestsigma commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

please review this addon and publish as PUBLIC

Addon name : base64_converter
Addon accont: https://jarvis.testsigma.com/ui/tenants/2817/addons
Jira: https://testsigma.atlassian.net/browse/CUS-11200

fix

added support to detect and decode "URL-safe Base64 encoding"

Summary by CodeRabbit

Release Notes

  • New Features

    • Improved Base64 decoding with intelligent detection of URL-safe format variants and automatic fallback handling.
  • Improvements

    • Clarified display names and descriptions for Base64 conversion functions.
  • Chores

    • Updated project version to 1.0.3.
    • Added new library dependency for enhanced functionality.

@coderabbitai

coderabbitai Bot commented Mar 16, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR updates the base64_converter addon with a version bump to 1.0.3, adds the Apache Commons Lang 3 dependency, updates annotation documentation text, and enhances the decode functionality with URL-safe Base64 detection and fallback logic.

Changes

Cohort / File(s) Summary
Project Configuration & Dependencies
base64_converter/pom.xml
Version bumped from 1.0.0 to 1.0.3; added org.apache.commons:commons-lang3 version 3.19.0 as compile/runtime dependency.
Annotation Documentation Updates
base64_converter/src/main/java/com/testsigma/addons/generators/Base64Converter.java, base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java
Display names and descriptions updated from "test-data" terminology to "input string" for clarity in TestDataFunction annotations.
Decoding Logic Enhancement
base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java
Implemented URL-safe Base64 detection by checking for URL-safe indicators ('-', '_') versus standard indicators ('+', '/'); falls back to URL-safe decoder on IllegalArgumentException during standard decoding; added logging for execution flow tracking.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • vigneshtestsigma
  • Ganesh-Testsigma

Poem

🐰 A Base64 hop, now URL-safe and sound,
With fallback logic, no errors abound,
From test-data whispers to input strings clear,
This addon's enhanced—decoding's no fear! 🔄✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions 'decode strings with urls' but the actual change is about detecting and decoding URL-safe Base64 encoded strings, which is a more specific technical implementation detail not fully captured by the title.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch CUS-11200
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can suggest fixes for GitHub Check annotations.

Configure the reviews.tools.github-checks setting to adjust the time to wait for GitHub Checks to complete.

@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: 1

🧹 Nitpick comments (2)
base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java (1)

27-33: Specify charset when constructing String from bytes.

Using new String(byte[]) relies on the platform's default charset, which can vary across systems and lead to inconsistent behavior. Explicitly specify StandardCharsets.UTF_8 for predictable results.

♻️ Proposed fix

Add import:

import java.nio.charset.StandardCharsets;

Then update the String constructors:

-      decodedString = new String(Base64.getUrlDecoder().decode(input));
+      decodedString = new String(Base64.getUrlDecoder().decode(input), StandardCharsets.UTF_8);
-        decodedString = new String(Base64.getDecoder().decode(input));
+        decodedString = new String(Base64.getDecoder().decode(input), StandardCharsets.UTF_8);
-        decodedString = new String(Base64.getUrlDecoder().decode(input));
+        decodedString = new String(Base64.getUrlDecoder().decode(input), StandardCharsets.UTF_8);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java`
around lines 27 - 33, In DecodeStringToBase64 update the places where
decodedString is constructed from decoded bytes to specify the charset: replace
new String(Base64.getUrlDecoder().decode(input)) and new
String(Base64.getDecoder().decode(input)) with new String(...,
StandardCharsets.UTF_8); add the import for java.nio.charset.StandardCharsets so
both the normal and fallback (URL-safe) decoding branches use UTF-8 explicitly.
base64_converter/src/main/java/com/testsigma/addons/generators/Base64Converter.java (1)

22-22: Consider specifying charset for consistency.

While not changed in this PR, getBytes() without a charset argument uses platform default encoding. For consistency with the recommended changes in DecodeStringToBase64, consider using StandardCharsets.UTF_8:

String base64String = Base64.getEncoder().encodeToString(string.getValue().toString().getBytes(StandardCharsets.UTF_8));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@base64_converter/src/main/java/com/testsigma/addons/generators/Base64Converter.java`
at line 22, The Base64 conversion uses string.getValue().toString().getBytes()
without a charset which relies on platform default; update the encode call in
Base64Converter (the line creating base64String) to pass StandardCharsets.UTF_8
to getBytes and add the corresponding import for
java.nio.charset.StandardCharsets so the Base64.getEncoder().encodeToString(...)
consistently uses UTF-8.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java`:
- Around line 10-11: Update the `@TestDataFunction` annotation on the
DecodeStringToBase64 class/function: change displayName to "Decode the base64
input string" and change description to "Decodes a base64 encoded string to
plain text" so the annotation accurately reflects that the function decodes from
Base64 to a plain string (refer to the
`@com.testsigma.sdk.annotation.TestDataFunction` on DecodeStringToBase64).

---

Nitpick comments:
In
`@base64_converter/src/main/java/com/testsigma/addons/generators/Base64Converter.java`:
- Line 22: The Base64 conversion uses string.getValue().toString().getBytes()
without a charset which relies on platform default; update the encode call in
Base64Converter (the line creating base64String) to pass StandardCharsets.UTF_8
to getBytes and add the corresponding import for
java.nio.charset.StandardCharsets so the Base64.getEncoder().encodeToString(...)
consistently uses UTF-8.

In
`@base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java`:
- Around line 27-33: In DecodeStringToBase64 update the places where
decodedString is constructed from decoded bytes to specify the charset: replace
new String(Base64.getUrlDecoder().decode(input)) and new
String(Base64.getDecoder().decode(input)) with new String(...,
StandardCharsets.UTF_8); add the import for java.nio.charset.StandardCharsets so
both the normal and fallback (URL-safe) decoding branches use UTF-8 explicitly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1563987e-2e0e-4187-8b42-223b90beea11

📥 Commits

Reviewing files that changed from the base of the PR and between a975be9 and 4c20df2.

📒 Files selected for processing (3)
  • base64_converter/pom.xml
  • base64_converter/src/main/java/com/testsigma/addons/generators/Base64Converter.java
  • base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java

Comment on lines +10 to +11
@com.testsigma.sdk.annotation.TestDataFunction(displayName = "Decode the input string to base64",
description = "Decodes the input string to base64")

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

Incorrect terminology in annotation text.

The displayName and description say "Decode the input string to base64", but this function decodes from Base64 to a plain string. Consider updating to:

  • displayName: "Decode the base64 input string"
  • description: "Decodes a base64 encoded string to plain text"
📝 Proposed fix
-@com.testsigma.sdk.annotation.TestDataFunction(displayName = "Decode the input string to base64",
-        description = "Decodes the input string to base64")
+@com.testsigma.sdk.annotation.TestDataFunction(displayName = "Decode the base64 input string",
+        description = "Decodes a base64 encoded string to plain text")
📝 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
@com.testsigma.sdk.annotation.TestDataFunction(displayName = "Decode the input string to base64",
description = "Decodes the input string to base64")
`@com.testsigma.sdk.annotation.TestDataFunction`(displayName = "Decode the base64 input string",
description = "Decodes a base64 encoded string to plain text")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@base64_converter/src/main/java/com/testsigma/addons/generators/DecodeStringToBase64.java`
around lines 10 - 11, Update the `@TestDataFunction` annotation on the
DecodeStringToBase64 class/function: change displayName to "Decode the base64
input string" and change description to "Decodes a base64 encoded string to
plain text" so the annotation accurately reflects that the function decodes from
Base64 to a plain string (refer to the
`@com.testsigma.sdk.annotation.TestDataFunction` on DecodeStringToBase64).

@ManojTestsigma
ManojTestsigma merged commit 38e8750 into dev Mar 17, 2026
1 check passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 17, 2026
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