Skip to content

Update fork #2

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

Merged
merged 18 commits into from
Aug 26, 2024
Merged

Update fork #2

merged 18 commits into from
Aug 26, 2024

Conversation

dmitriz
Copy link
Owner

@dmitriz dmitriz commented Aug 26, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a CSS layout debugging tool that visually outlines DOM elements with random colored borders.
    • Added scripts for enhanced functionality: harlem-shake-xss.js for DOM manipulation and remove-all-but.js for selective DOM element removal.
    • Enhanced countAngularWatchers function to target specific DOM sections for counting Angular watchers.
  • Bug Fixes

    • Improved the build process with caching and updated Node.js version for better compatibility and performance.
  • Documentation

    • Updated README with new code snippets and improved formatting for clarity.
    • Added a badge for automated release management.
  • Chores

    • Updated versioning strategy to semantic release format across multiple configuration files.

Copy link

coderabbitai bot commented Aug 26, 2024

Walkthrough

The updates involve enhancements to various configuration and script files in a Node.js project. Key changes include modifications to .travis.yml for build optimizations, updates to versioning in bower.json and package.json to align with semantic versioning, the introduction of new JavaScript files for DOM manipulation, and adjustments to linting rules. Overall, these changes improve build efficiency, documentation clarity, and code quality.

Changes

Files Change Summary
.travis.yml Enhanced build process with caching, updated Node.js version, added npm installation, and automated release on success.
README.md Added new code snippets and a semantic-release badge; reformatted existing entries for clarity.
bower.json, package.json Changed versioning to 0.0.0-semantic-release, simplified commit message configuration, and updated dependencies.
css-layout.js, harlem-shake-xss.js, remove-all-but.js Introduced new scripts with specific DOM manipulation functionalities.
ng-count-watchers.js Expanded countAngularWatchers function to accept a start parameter for targeted counting.
utils/.jshintrc Changed esnext option from false to true to allow modern JavaScript features.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BuildSystem
    participant Repository

    User->>BuildSystem: Trigger build
    BuildSystem->>Repository: Fetch code
    BuildSystem->>BuildSystem: Cache node_modules
    BuildSystem->>BuildSystem: Install npm@^2.0.0
    BuildSystem->>BuildSystem: Run tests
    BuildSystem->>BuildSystem: Execute npm run semantic-release
    BuildSystem->>User: Notify build success
Loading

🐇 In a world of code, so bright and bold,
Changes abound, new stories unfold.
With borders of color and releases so neat,
The rabbit hops forth, to dance to the beat!
Semantic winds blow, with snippets galore,
In this land of code, we create and explore! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

guardrails bot commented Aug 26, 2024

⚠️ We detected 1 security issue in this pull request:

Hard-Coded Secrets (1)
Severity Details Docs
Medium Title: Base64 High Entropy String
eval(atob('IWZ1bmN0aW9uKCl7ZnVuY3Rpb24gYSgpe3ZhciBhPWRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImxpbmsiKTthLnNldEF0dHJpYnV0ZSgidHlwZSIsInRleHQvY3NzIiksYS5zZXRBdHRyaWJ1dGUoInJlbCIsInN0eWxlc2hlZXQiKSxhLnNldEF0dHJpYnV0ZSgiaHJlZiIsdyksYS5zZXRBdHRyaWJ1dGUoImNsYXNzIix4KSxkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGEpfWZ1bmN0aW9uIGIoKXtmb3IodmFyIGE9ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSh4KSxiPTA7YjxhLmxlbmd0aDtiKyspZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZChhW2JdKX1mdW5jdGlvbiBjKCl7dmFyIGE9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7YS5zZXRBdHRyaWJ1dGUoImNsYXNzIix2KSxkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGEpLHNldFRpbWVvdXQoZnVuY3Rpb24oKXtkb2N1bWVudC5ib2R5LnJlbW92ZUNoaWxkKGEpfSwxMDApfWZ1bmN0aW9uIGQoYSl7cmV0dXJue2hlaWdodDphLm9mZnNldEhlaWdodCx3aWR0aDph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2lmKGUoRCkmJmkoRCkpe0I9RDticmVha319aWYobnVsbD09PUQpcmV0dXJuIHZvaWQgY29uc29sZS53YXJuKCJDb3VsZCBub3QgZmluZCBhIG5vZGUgb2YgdGhlIHJpZ2h0IHNpemUuIFBsZWFzZSB0cnkgYSBkaWZmZXJlbnQgcGFnZS4iKTthKCksaigpO2Zvcih2YXIgRT1bXSxDPTA7QzxBLmxlbmd0aDtDKyspe3ZhciBEPUFbQ107ZShEKSYmRS5wdXNoKEQpfX0oKSxjb25zb2xlLmxvZygiRGFuY2Ugc2hvdWxkIHN0YXJ0IGFueSBtaW51dGUgbm93IiksaGlzdG9yeS5wdXNoU3RhdGUoe30sInNlY3VyZSIsIi9ub3RoaW5nL3RvL3NlZS9oZXJlLmh0bWwiKTs='));
📚

More info on how to fix Hard-Coded Secrets in General.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/grunt-deps-ok@0.9.0 Transitive: environment, filesystem +10 437 kB bahmutov
npm/grunt-nice-package@0.10.2 Transitive: environment, filesystem +20 310 kB bahmutov
npm/pre-git@3.1.2 environment, filesystem, shell Transitive: eval, network, unsafe +69 7.35 MB bahmutov
npm/semantic-release@4.3.5 environment, filesystem, shell 0 50.5 kB semantic-release

🚮 Removed packages: npm/grunt-deps-ok@0.8.0), npm/grunt-nice-package@0.9.6), npm/pre-git@1.4.0)

View full report↗︎

Copy link

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Git dependency npm/grunt-nice-package@0.10.2 🚫
Install scripts npm/pre-git@3.1.2
  • Install script: postinstall
  • Source: node src/install.js
🚫

View full report↗︎

Next steps

What are git dependencies?

Contains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.

Publish the git dependency to npm or a private package repository and consume it from there.

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/grunt-nice-package@0.10.2
  • @SocketSecurity ignore npm/pre-git@3.1.2

@dmitriz dmitriz merged commit 9099b75 into dmitriz:master Aug 26, 2024
4 of 6 checks passed
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Outside diff range, codebase verification and nitpick comments (2)
remove-all-but.js (1)

1-21: Documentation: Clear and detailed comments

The comments provide a clear and detailed explanation of the function's purpose and usage, which is helpful for understanding the code.

Consider adding an example of the function call in the comments for better clarity.

README.md (1)

11-11: Nitpick: Remove spaces inside link text.

Spaces inside link text should be removed for consistency.

Apply this diff to remove spaces inside link text:

- [![semantic-release][semantic-image] ][semantic-url]
+ [![semantic-release][semantic-image]][semantic-url]
Tools
Markdownlint

11-11: null
Spaces inside link text

(MD039, no-space-in-links)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e4b635a and 713b144.

Files selected for processing (9)
  • .travis.yml (1 hunks)
  • README.md (5 hunks)
  • bower.json (1 hunks)
  • css-layout.js (1 hunks)
  • harlem-shake-xss.js (1 hunks)
  • ng-count-watchers.js (1 hunks)
  • package.json (2 hunks)
  • remove-all-but.js (1 hunks)
  • utils/.jshintrc (1 hunks)
Files skipped from review due to trivial changes (1)
  • css-layout.js
Additional context used
Biome
remove-all-but.js

[error] 23-23: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

ng-count-watchers.js

[error] 55-55: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

harlem-shake-xss.js

[error] 4-5: eval() exposes to security risks and performance issues.

See the MDN web docs for more details.
Refactor the code so that it doesn't need to call eval().

(lint/security/noGlobalEval)

Markdownlint
README.md

11-11: null
Spaces inside link text

(MD039, no-space-in-links)


47-47: null
Link fragments should be valid

(MD051, link-fragments)

LanguageTool
README.md

[uncategorized] ~57-~57: Possible missing article found.
Context: ... * css-layout.js draws boundary around every DOM element for clarity....

(AI_HYDRA_LEO_MISSING_A)


[style] ~102-~102: To form a complete sentence, be sure to include a subject.
Context: ... in the trees with specified selectors. Can be used to quickly clean up the page an...

(MISSING_IT_THERE)


[uncategorized] ~111-~111: Did you mean the adverb “anymore”?
Context: ... Note: the approach below does not work any more, see [the open issue](https://github.co...

(ANY_MORE)

Additional comments not posted (34)
.travis.yml (7)

2-5: Enhancement: Cache node_modules to optimize build times

Caching node_modules will help in reducing build times by reusing previously installed dependencies.

The code changes are approved.


6-7: Improvement: Disable email notifications

Disabling email notifications will streamline communication during the build process.

The code changes are approved.


9-9: Upgrade: Update Node.js version

Updating the Node.js version from 0.12 to 4 reflects a significant upgrade in the runtime environment, ensuring compatibility with newer features.

The code changes are approved.


10-11: Enhancement: Install specific npm version globally

Installing a specific version of npm globally ensures that the build uses a compatible package manager version.

The code changes are approved.


12-13: Enhancement: Add npm prune command

Adding npm prune in the before_script step cleans up unnecessary packages before the main script runs, ensuring a clean environment.

The code changes are approved.


14-15: Enhancement: Automate release process

Adding npm run semantic-release in the after_success section automates the release process, improving the overall development workflow.

The code changes are approved.


17-18: Enhancement: Flexible branch management

Excluding versioned branches that match the regex pattern for semantic versioning allows for more flexible branch management during the CI process.

The code changes are approved.

bower.json (1)

4-4: Update: Shift to semantic versioning

Updating the version to "0.0.0-semantic-release" indicates a shift to semantic versioning, which emphasizes the significance of version numbers in relation to changes made to the codebase.

The code changes are approved.

remove-all-but.js (5)

25-28: Validation: Ensure at least one selector is provided

The code correctly throws an error if no selectors are provided, ensuring proper validation.

The code changes are approved.


30-32: Optimization: Efficiently gather elements to keep

The code efficiently gathers elements to keep using querySelectorAll and reduce.

The code changes are approved.


34-38: Functionality: Correctly determine elements to keep

The shouldKeep function correctly determines whether an element should be kept based on its relationship to the elements in the keep array.

The code changes are approved.


40-48: Functionality: Remove elements not in the keep list

The code correctly removes elements that are not in the keep list, ensuring the desired functionality.

The code changes are approved.


50-50: Logging: Informative log message

The log message provides useful information about the number of elements removed.

The code changes are approved.

utils/.jshintrc (1)

33-33: LGTM!

The change to enable ESNext features is appropriate and will allow the use of modern JavaScript syntax and functionalities.

The code changes are approved.

package.json (9)

4-4: LGTM!

The change to semantic versioning is a good practice and will enhance clarity regarding the nature of changes in future releases.

The code changes are approved.


11-11: LGTM!

The simplification of the commit message validation process is appropriate.

The code changes are approved.


13-14: LGTM!

The simplification of the pre-commit process is appropriate.

The code changes are approved.


15-16: LGTM!

The introduction of the pre-push hook to check the package size is a good practice.

The code changes are approved.


30-39: LGTM!

The updates to the devDependencies are appropriate and ensure that the project uses the latest versions of these dependencies.

The code changes are approved.


44-47: LGTM!

The addition of the files property enhances the clarity of the package structure.

The code changes are approved.


63-63: LGTM!

The update to the repository URL improves accessibility for users cloning the repository.

The code changes are approved.


70-70: LGTM!

The update to the semantic-release script ensures that the release process is automated and streamlined.

The code changes are approved.


71-71: LGTM!

The addition of the size script to check the package size is a good practice.

The code changes are approved.

ng-count-watchers.js (10)

2-9: LGTM!

The usage comments enhance the documentation and usability of the script.

The code changes are approved.


10-10: LGTM!

The addition of the start parameter enhances the functionality of the script by allowing targeted analysis of specific sections of the DOM.

The code changes are approved.


13-18: LGTM!

The allDescendents helper function is correctly implemented and enhances the control flow of the script.

The code changes are approved.


21-24: LGTM!

The variable initialization is appropriate and supports the new functionality.

The code changes are approved.


26-29: LGTM!

The conditional check for the start parameter is appropriate and enhances the functionality of the script.

The code changes are approved.


30-31: LGTM!

The logging enhances the debugging capabilities of the script.

The code changes are approved.


34-34: LGTM!

The addition of the maxWatchersToPrint variable is appropriate and enhances the script's debugging capabilities.

The code changes are approved.


40-47: LGTM!

The countScopeWatchers function is correctly updated and enhances the tracking and reporting of individual watchers.

The code changes are approved.


51-58: LGTM!

The countWatchersInData function is correctly updated and enhances the functionality of the script.

The code changes are approved.

Tools
Biome

[error] 55-55: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


63-71: LGTM!

The main loop is correctly updated and enhances the functionality of the script.

The code changes are approved.

README.md (1)

23-24: LGTM!

The new badge for semantic-release has been added correctly.

The code changes are approved.

hello
*/
(function hideAllBut() {
'use strict';
Copy link

Choose a reason for hiding this comment

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

Remove redundant 'use strict' directive

The 'use strict' directive is redundant in JavaScript modules as they are automatically in strict mode.

Apply this diff to remove the redundant 'use strict' directive:

-  'use strict';
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
'use strict';
Tools
Biome

[error] 23-23: Redundant use strict directive.

The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it.
Safe fix: Remove the redundant use strict directive.

(lint/suspicious/noRedundantUseStrict)

Comment on lines +1 to +5
// ready to dance, from https://github.com/DinisCruz/XSS-Pocs/blob/master/pocs/dance-xss.js
/* jshint -W101 */
/* jshint -W061 */
/* eslint no-eval:0 */
eval(atob('IWZ1bmN0aW9uKCl7ZnVuY3Rpb24gYSgpe3ZhciBhPWRvY3Vt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Lmh0bWwiKTs='));
Copy link

Choose a reason for hiding this comment

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

Avoid the use of eval and decode the base64 string for review.

The use of eval is a security risk and should be avoided. Decode the base64 string and review the code for any potential security issues. Consider refactoring the code to avoid the use of eval.

Apply this diff to decode the base64 string and review the code:

- eval(atob('IWZ1bmN0aW9uKCl7ZnVuY3Rpb24gYSgpe3ZhciBhPWRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImxpbmsiKTthLnNldEF0dHJpYnV0ZSgidHlwZSIsInRleHQvY3NzIiksYS5zZXRBdHRyaWJ1dGUoInJlbCIsInN0eWxlc2hlZXQiKSxhLnNldEF0dHJpYnV0ZSgiaHJlZiIsdyksYS5zZXRBdHRyaWJ1dGUoImNsYXNzIix4KSxkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGEpfWZ1bmN0aW9uIGIoKXtmb3IodmFyIGE9ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeUNsYXNzTmFtZSh4KSxiPTA7YjxhLmxlbmd0aDtiKyspZG9jdW1lbnQuYm9keS5yZW1vdmVDaGlsZChhW2JdKX1mdW5jdGlvbiBjKCl7dmFyIGE9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgiZGl2Iik7YS5zZXRBdHRyaWJ1dGUoImNsYXNzIix2KSxkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGEpLHNldFRpbWVvdXQoZnVuY3Rpb24oKXtkb2N1bWVudC5ib2R5LnJlbW92ZUNoaWxkKGEpfSwxMDApfWZ1bmN0aW9uIGQoYSl7cmV0dXJue2hlaWdodDphLm9mZnNldEhlaWdodCx3aWR0aDphLm9mZnNldFdpZHRofX1mdW5jdGlvbiBlKGEpe3ZhciBiPWQoYSk7cmV0dXJuIGIuaGVpZ2h0Pm4mJmIuaGVpZ2h0PHAmJmIud2lkdGg+byYmYi53aWR0aDxxfWZ1bmN0aW9uIGYoYSl7Zm9yKHZhciBiPWEsYz0wO2I7KWMrPWIub2Zmc2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2Zvcih2YXIgRT1bXSxDPTA7QzxBLmxlbmd0aDtDKyspe3ZhciBEPUFbQ107ZShEKSYmRS5wdXNoKEQpfX0oKSxjb25zb2xlLmxvZygiRGFuY2Ugc2hvdWxkIHN0YXJ0IGFueSBtaW51dGUgbm93IiksaGlzdG9yeS5wdXNoU3RhdGUoe30sInNlY3VyZSIsIi9ub3RoaW5nL3RvL3NlZS9oZXJlLmh0bWwiKTs='));
+ // Decoded base64 string
+ function a() {
+   var a = document.createElement("link");
+   a.setAttribute("type", "text/css");
+   a.setAttribute("rel", "stylesheet");
+   a.setAttribute("href", w);
+   a.setAttribute("class", x);
+   document.body.appendChild(a);
+ }
+ function b() {
+   for (var a = document.getElementsByClassName(x), b = 0; b < a.length; b++)
+     document.body.removeChild(a[b]);
+ }
+ function c() {
+   var a = document.createElement("div");
+   a.setAttribute("class", v);
+   document.body.appendChild(a);
+   setTimeout(function () {
+     document.body.removeChild(a);
+   }, 100);
+ }
+ function d(a) {
+   return { height: a.offsetHeight, width: a.offsetWidth };
+ }
+ function e(a) {
+   var b = d(a);
+   return b.height > n && b.height < p && b.width > o && b.width < q;
+ }
+ function f(a) {
+   for (var b = a, c = 0; b; ) (c += b.offsetTop), (b = b.offsetParent);
+   return c;
+ }
+ function g() {
+   var a = document.documentElement;
+   return window.innerWidth
+     ? window.innerHeight
+     : a && !isNaN(a.clientHeight)
+     ? a.clientHeight
+     : 0;
+ }
+ function h() {
+   return window.pageYOffset
+     ? window.pageYOffset
+     : Math.max(
+         document.documentElement.scrollTop,
+         document.body.scrollTop
+       );
+ }
+ function i(a) {
+   var b = f(a);
+   return b > z && b < y + z;
+ }
+ function j() {
+   var a = document.createElement("audio");
+   a.setAttribute("class", x);
+   a.src = r;
+   a.loop = !1;
+   a.addEventListener(
+     "canplay",
+     function () {
+       setTimeout(function () {
+         k(B);
+       }, 500),
+         setTimeout(function () {
+           m(), c();
+           for (var a = 0; a < E.length; a++) l(E[a]);
+         }, 15500);
+     },
+     !1
+   ),
+     a.addEventListener(
+       "ended",
+       function () {
+         m(), b();
+       },
+       !1
+     ),
+     (a.innerHTML =
+       ' <p>If you are reading this, it is because your browser does not support the audio element. We recommend that you get a new browser.</p>'),
+     document.body.appendChild(a),
+     a.play();
+ }
+ function k(a) {
+   a.className += " " + s + " " + t;
+ }
+ function l(a) {
+   a.className += " " + s + " " + u[Math.floor(Math.random() * u.length)];
+ }
+ function m() {
+   for (
+     var a = document.getElementsByClassName(s), b = new RegExp("\\b" + s + "\\b"), c = 0;
+     c < a.length;
+     c++
+   )
+     a[c].className = a[c].className.replace(b, "");
+ }
+ for (
+   var n = 30,
+     o = 30,
+     p = 350,
+     q = 350,
+     r = "//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake.mp3",
+     s = "mw-harlem_shake_me",
+     t = "im_first",
+     u = ["im_drunk", "im_baked", "im_trippin", "im_blown"],
+     v = "mw-strobe_light",
+     w = "//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake-style.css",
+     x = "mw_added_css",
+     y = g(),
+     z = h(),
+     A = document.getElementsByTagName("*"),
+     B = null,
+     C = 0;
+   C < A.length;
+   C++
+ ) {
+   var D = A[C];
+   if (e(D) && i(D)) {
+     B = D;
+     break;
+   }
+ }
+ if (null === B) return void console.warn("Could not find a node of the right size. Please try a different page.");
+ a(), j();
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
// ready to dance, from https://github.com/DinisCruz/XSS-Pocs/blob/master/pocs/dance-xss.js
/* jshint -W101 */
/* jshint -W061 */
/* eslint no-eval:0 */
eval(atob('IWZ1bmN0aW9uKCl7ZnVuY3Rpb24gYSgpe3ZhciBhPWRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoImxpbmsiKTthLnNldEF0dHJpYnV0ZSgidHlwZSIsInRleHQvY3NzIiksYS5zZXRBdHRyaWJ1dGUoInJlbCIsInN0eW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NdLmNsYXNzTmFtZS5yZXBsYWNlKGIsIiIpfWZvcih2YXIgbj0zMCxvPTMwLHA9MzUwLHE9MzUwLHI9Ii8vczMuYW1hem9uYXdzLmNvbS9tb292d2ViLW1hcmtldGluZy9wbGF5Z3JvdW5kL2hhcmxlbS1zaGFrZS5tcDMiLHM9Im13LWhhcmxlbV9zaGFrZV9tZSIsdD0iaW1fZmlyc3QiLHU9WyJpbV9kcnVuayIsImltX2Jha2VkIiwiaW1fdHJpcHBpbiIsImltX2Jsb3duIl0sdj0ibXctc3Ryb2JlX2xpZ2h0Iix3PSIvL3MzLmFtYXpvbmF3cy5jb20vbW9vdndlYi1tYXJrZXRpbmcvcGxheWdyb3VuZC9oYXJsZW0tc2hha2Utc3R5bGUuY3NzIix4PSJtd19hZGRlZF9jc3MiLHk9ZygpLHo9aCgpLEE9ZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoIioiKSxCPW51bGwsQz0wO0M8QS5sZW5ndGg7QysrKXt2YXIgRD1BW0NdO2lmKGUoRCkmJmkoRCkpe0I9RDticmVha319aWYobnVsbD09PUQpcmV0dXJuIHZvaWQgY29uc29sZS53YXJuKCJDb3VsZCBub3QgZmluZCBhIG5vZGUgb2YgdGhlIHJpZ2h0IHNpemUuIFBsZWFzZSB0cnkgYSBkaWZmZXJlbnQgcGFnZS4iKTthKCksaigpO2Zvcih2YXIgRT1bXSxDPTA7QzxBLmxlbmd0aDtDKyspe3ZhciBEPUFbQ107ZShEKSYmRS5wdXNoKEQpfX0oKSxjb25zb2xlLmxvZygiRGFuY2Ugc2hvdWxkIHN0YXJ0IGFueSBtaW51dGUgbm93IiksaGlzdG9yeS5wdXNoU3RhdGUoe30sInNlY3VyZSIsIi9ub3RoaW5nL3RvL3NlZS9oZXJlLmh0bWwiKTs='));
// ready to dance, from https://github.com/DinisCruz/XSS-Pocs/blob/master/pocs/dance-xss.js
/* jshint -W101 */
/* jshint -W061 */
/* eslint no-eval:0 */
// Decoded base64 string
function a() {
var a = document.createElement("link");
a.setAttribute("type", "text/css");
a.setAttribute("rel", "stylesheet");
a.setAttribute("href", w);
a.setAttribute("class", x);
document.body.appendChild(a);
}
function b() {
for (var a = document.getElementsByClassName(x), b = 0; b < a.length; b++)
document.body.removeChild(a[b]);
}
function c() {
var a = document.createElement("div");
a.setAttribute("class", v);
document.body.appendChild(a);
setTimeout(function () {
document.body.removeChild(a);
}, 100);
}
function d(a) {
return { height: a.offsetHeight, width: a.offsetWidth };
}
function e(a) {
var b = d(a);
return b.height > n && b.height < p && b.width > o && b.width < q;
}
function f(a) {
for (var b = a, c = 0; b; ) (c += b.offsetTop), (b = b.offsetParent);
return c;
}
function g() {
var a = document.documentElement;
return window.innerWidth
? window.innerHeight
: a && !isNaN(a.clientHeight)
? a.clientHeight
: 0;
}
function h() {
return window.pageYOffset
? window.pageYOffset
: Math.max(
document.documentElement.scrollTop,
document.body.scrollTop
);
}
function i(a) {
var b = f(a);
return b > z && b < y + z;
}
function j() {
var a = document.createElement("audio");
a.setAttribute("class", x);
a.src = r;
a.loop = !1;
a.addEventListener(
"canplay",
function () {
setTimeout(function () {
k(B);
}, 500),
setTimeout(function () {
m(), c();
for (var a = 0; a < E.length; a++) l(E[a]);
}, 15500);
},
!1
),
a.addEventListener(
"ended",
function () {
m(), b();
},
!1
),
(a.innerHTML =
' <p>If you are reading this, it is because your browser does not support the audio element. We recommend that you get a new browser.</p>'),
document.body.appendChild(a),
a.play();
}
function k(a) {
a.className += " " + s + " " + t;
}
function l(a) {
a.className += " " + s + " " + u[Math.floor(Math.random() * u.length)];
}
function m() {
for (
var a = document.getElementsByClassName(s), b = new RegExp("\\b" + s + "\\b"), c = 0;
c < a.length;
c++
)
a[c].className = a[c].className.replace(b, "");
}
for (
var n = 30,
o = 30,
p = 350,
q = 350,
r = "//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake.mp3",
s = "mw-harlem_shake_me",
t = "im_first",
u = ["im_drunk", "im_baked", "im_trippin", "im_blown"],
v = "mw-strobe_light",
w = "//s3.amazonaws.com/moovweb-marketing/playground/harlem-shake-style.css",
x = "mw_added_css",
y = g(),
z = h(),
A = document.getElementsByTagName("*"),
B = null,
C = 0;
C < A.length;
C++
) {
var D = A[C];
if (e(D) && i(D)) {
B = D;
break;
}
}
if (null === B) return void console.warn("Could not find a node of the right size. Please try a different page.");
a(), j();
Tools
Biome

[error] 4-5: eval() exposes to security risks and performance issues.

See the MDN web docs for more details.
Refactor the code so that it doesn't need to call eval().

(lint/security/noGlobalEval)

Comment on lines +41 to +42
* [harlem-shake-xss.js](harlem-shake-xss.js) - little XSS script that injects
[Harlem Shake music](https://github.com/DinisCruz/XSS-Pocs/blob/master/pocs/dance-xss.js)
Copy link

Choose a reason for hiding this comment

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

Typographical issue: Add missing article.

Add the missing article "the" for grammatical correctness.

Apply this diff to add the missing article:

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.

3 participants