razorpay / i18nify

One stop solution for all your internationalisation needs.
https://geosmart.razorpay.com/
15 stars 3 forks source link

[200~Implement script injection and assertion functions with error ha… #162

Open pawanNeverDie opened 1 month ago

pawanNeverDie commented 1 month ago

Summary of Changes

What I've Done:

  1. Script Injection Function:

    • Added a function to dynamically inject and execute script logic within a page context. This allows for executing custom JavaScript code within the page.
  2. Sanitization and Error Handling:

    • Included basic sanitization and error handling within the script execution to mitigate Cross-Site Scripting (XSS) risks. This ensures that user input is handled securely and any errors during script execution are managed.
  3. Content Verification Function:

    • Added a function to verify the text content of a div element against expected values. This function checks if the content of a specific element matches what is anticipated.
  4. Error Messages:

    • Enhanced error messages for better debugging and improved code clarity. This provides clearer information when something goes wrong, making it easier to identify and fix issues.

Description

Summary:

Related Issue:

Motivation:

Dependencies:

Changes Made

Title ---
JIRA link NA
Slack thread (if any) NA
Product spec NA
Tech spec/One-pager NA
Bundle Size Difference NA
Fixes Issue NA

Type of Change

How Has This Been Tested?

Additional Notes

Checklist

Reviewer Checklist


Example Title:


feat: Add dynamic script injection with sanitization and error handling
changeset-bot[bot] commented 1 month ago

⚠️ No Changeset found

Latest commit: 265703d243422fad83d7cd60de3e3f1344cf3cf9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

pawanNeverDie commented 1 month ago

I have made the following updates in this PR:

Dynamic Script Injection: Added a function to inject and execute custom script logic within a page context. Sanitization and Error Handling: Implemented basic sanitization and error handling within the script execution to prevent XSS attacks. Content Verification: Introduced a function to verify the text content of a div element against expected values. Enhanced Error Messages: Improved error messages for better debugging and code clarity.