Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pawvan
Copy link

@pawvan pawvan commented Jul 29, 2024

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:

  • This pull request introduces several key updates to improve the functionality and security of script execution on the page. The new features include dynamic script injection, enhanced error handling, and content verification for better control and safety.

Related Issue:

  • No specific issue is referenced for this PR.

Motivation:

  • The primary motivation behind these changes is to provide a robust mechanism for injecting and executing scripts within the page, with added security measures to prevent XSS attacks. Additionally, verifying content dynamically ensures that the page behaves as expected.

Dependencies:

  • No new dependencies are introduced with this change.

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • This change is a documentation update

How Has This Been Tested?

  • The changes are backward compatible.
  • Tested on major browsers (Chrome, Firefox, Safari, IE).
  • Tested in a consumer application(s).

Additional Notes

  • Ensure that the security implications of script injection and error handling are reviewed to confirm that there are no vulnerabilities introduced.

Checklist

  • Add Jira ID(s) in PR title and in the description (if applicable).
  • Self-review of the code completed.
  • Code commented, particularly in hard-to-understand areas.
  • Code follows the project’s TypeScript and coding standards.
  • Relevant documentation added/updated.
  • Commit messages are clear and follow the project's conventions.
  • No external libraries added.
  • No new runtime errors or warnings introduced.
  • All relevant unit tests have been added/updated.
  • Screenshots (mobile & desktop) provided if required.
  • Manual development testing done on beta/functional environment.
  • Reviewer added (SLA 2 days).

Reviewer Checklist

  • Sufficient QA/Dev-Testing completed with proof (test cases list).
  • Bundle size change falls within acceptable range.

Example Title:

feat: Add dynamic script injection with sanitization and error handling

…ndling

- Added  function to dynamically inject and execute script logic within a page context.
- Included basic sanitization and error handling within the script execution to mitigate XSS risks.
- Added  function to verify the text content of a div element against expected values.
- Enhanced error messages for better debugging and improved code clarity.
~
Copy link

changeset-bot bot commented Jul 29, 2024

⚠️ No Changeset found

Latest commit: 265703d

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

@pawvan
Copy link
Author

pawvan commented Jul 29, 2024

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.

@pawvan pawvan closed this Jul 29, 2024
@pawvan pawvan reopened this Jul 29, 2024
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