Skip to content

Conversation

Copy link

Copilot AI commented Dec 19, 2025

Adds the wb-data-scrumb.js PlayCanvas script from commit 6993291.

Changes

  • New file: scripts/utils/wb-data-scrumb.js - Data sanitization utility script

Usage

var scrubber = entity.script.wbDataScrumb;
var cleanData = scrubber.scrubData(dirtyData);

Configurable Options

  • removeNullValues - Strip null/undefined values
  • removeEmptyStrings - Strip empty strings
  • trimStrings - Trim whitespace from strings
  • removeEmptyArrays - Strip empty arrays
  • sanitizeHtml - Strip HTML tags from strings
  • maxDepth - Recursion depth limit (prevents infinite loops)
Original prompt

6993291


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Summary by cubic

Sync copilot/update-branch-with-latest-commit with main to include recent changes. Adds scripts/utils/wb-data-scrub.js for data sanitization, a world clocks example, CodeQL scanning, a security policy, and small dependency bumps.

  • New Features
    • scripts/utils/wb-data-scrub.js: trims and sanitizes data (removes null/empty values and arrays, optional HTML stripping, depth-limited recursion)
    • World clocks in examples: live multi-timezone clocks (New York, London, Tokyo, Local)

Written for commit 75df634. Summary will update automatically on new commits.

JaclynCodes and others added 10 commits July 29, 2025 10:49
Unified gsplat rendering - changes to sorter job scheduling (playcanvas#7864)
Signed-off-by: JaclynCodes <218383634+JaclynCodes@users.noreply.github.com>
Added a security policy document outlining supported versions and vulnerability reporting.

Signed-off-by: JaclynCodes <218383634+JaclynCodes@users.noreply.github.com>
* Add CodeQL analysis workflow configuration

Signed-off-by: JaclynCodes <218383634+JaclynCodes@users.noreply.github.com>

* Chore(deps-dev): bump js-yaml from 4.1.0 to 4.1.1

Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 4.1.0 to 4.1.1.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@4.1.0...4.1.1)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Chore(deps): bump glob from 10.4.5 to 10.5.0

Bumps [glob](https://github.com/isaacs/node-glob) from 10.4.5 to 10.5.0.
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](isaacs/node-glob@v10.4.5...v10.5.0)

---
updated-dependencies:
- dependency-name: glob
  dependency-version: 10.5.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Chore(deps): bump serialize-javascript from 6.0.1 to 6.0.2 in /examples (#6)

Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/yahoo/serialize-javascript/releases)
- [Commits](yahoo/serialize-javascript@v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: serialize-javascript
  dependency-version: 6.0.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>

* Chore(deps): bump js-yaml from 4.1.0 to 4.1.1 in /examples (#5)

---------

Signed-off-by: JaclynCodes <218383634+JaclynCodes@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


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

Co-authored-by: JaclynCodes <218383634+JaclynCodes@users.noreply.github.com>
Copilot AI changed the title [WIP] Update branch with latest commit changes Add wb-data-scrumb.js from Engine branch Dec 19, 2025
Copilot AI requested a review from JaclynCodes December 19, 2025 01:15
Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>
@JaclynCodes JaclynCodes marked this pull request as ready for review December 19, 2025 04:17
Copilot AI review requested due to automatic review settings December 19, 2025 04:17
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 7 files

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="SECURITY.md">

<violation number="1" location="SECURITY.md:10">
P2: Version numbers in the supported versions table (5.1.x, 5.0.x, 4.0.x) don&#39;t match the actual project version (2.14.0-beta.0). These appear to be placeholder values from a template. Update to reflect actual project versions to avoid confusing users about security support.</violation>
</file>

<file name="examples/src/static/index.html">

<violation number="1" location="examples/src/static/index.html:11">
P2: Tailwind&#39;s Play CDN (`cdn.tailwindcss.com`) is intended for development/prototyping only, not production use. Since this file is deployed to playcanvas.github.io, consider either:
1. Using a proper Tailwind build process with PostCSS
2. Using pre-built Tailwind CSS from a CDN like `https://cdn.jsdelivr.net/npm/tailwindcss@latest/dist/tailwind.min.css`
3. Writing plain CSS for this small widget</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR


| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
Copy link

@cubic-dev-ai cubic-dev-ai bot Dec 19, 2025

Choose a reason for hiding this comment

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

P2: Version numbers in the supported versions table (5.1.x, 5.0.x, 4.0.x) don't match the actual project version (2.14.0-beta.0). These appear to be placeholder values from a template. Update to reflect actual project versions to avoid confusing users about security support.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At SECURITY.md, line 10:

<comment>Version numbers in the supported versions table (5.1.x, 5.0.x, 4.0.x) don&#39;t match the actual project version (2.14.0-beta.0). These appear to be placeholder values from a template. Update to reflect actual project versions to avoid confusing users about security support.</comment>

<file context>
@@ -0,0 +1,21 @@
+
+| Version | Supported          |
+| ------- | ------------------ |
+| 5.1.x   | :white_check_mark: |
+| 5.0.x   | :x:                |
+| 4.0.x   | :white_check_mark: |
</file context>
Fix with Cubic

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new data sanitization utility script (wb-data-scrub.js) from the Engine branch, along with supporting examples, security documentation, and dependency updates.

  • Introduces a PlayCanvas script for scrubbing/sanitizing data objects with configurable options
  • Adds a world clocks example demonstrating multi-timezone display functionality
  • Sets up CodeQL scanning workflow and security policy documentation

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
scripts/utils/wb-data-scrub.js New PlayCanvas script for data sanitization with configurable rules for removing null/empty values, trimming strings, and HTML sanitization
examples/src/static/scripts/main.js World clocks feature displaying time across multiple timezones (New York, London, Tokyo, Local)
examples/src/static/index.html HTML structure for world clocks widget with Tailwind CSS styling
.github/workflows/codeql.yml CodeQL Advanced workflow for automated security scanning of JavaScript/TypeScript and GitHub Actions
SECURITY.md Security policy template defining supported versions and vulnerability reporting process
package-lock.json Dependency updates for glob (10.4.5 → 10.5.0) and js-yaml (4.1.0 → 4.1.1)
examples/package-lock.json Dependency updates including serialize-javascript (6.0.1 → 6.0.2), js-yaml (4.1.0 → 4.1.1), and peer dependency markers
Files not reviewed (1)
  • examples/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +173 to +188
// Check for null/undefined if they should be removed
if (this.removeNullValues && (data === null || data === undefined)) {
return false;
}

// Check for empty strings if they should be removed
if (this.removeEmptyStrings && data === '') {
return false;
}

// Check for empty arrays if they should be removed
if (this.removeEmptyArrays && Array.isArray(data) && data.length === 0) {
return false;
}

return true;
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The validate function only performs shallow validation and doesn't recursively validate nested objects or arrays according to the configured rules. For example, if removeNullValues is true and the data is an object containing null values in nested properties, this validation would pass even though scrubData would remove those values.

Suggested change
// Check for null/undefined if they should be removed
if (this.removeNullValues && (data === null || data === undefined)) {
return false;
}
// Check for empty strings if they should be removed
if (this.removeEmptyStrings && data === '') {
return false;
}
// Check for empty arrays if they should be removed
if (this.removeEmptyArrays && Array.isArray(data) && data.length === 0) {
return false;
}
return true;
var self = this;
/**
* Recursively validates a value according to the configured rules.
* @param {*} value - The value to validate
* @returns {boolean} True if the value (and any nested values) are valid
*/
function validateValue(value) {
// Check for null/undefined if they should be removed
if (self.removeNullValues && (value === null || value === undefined)) {
return false;
}
// Check for empty strings if they should be removed
if (self.removeEmptyStrings && value === '') {
return false;
}
// Check for empty arrays if they should be removed
if (self.removeEmptyArrays && Array.isArray(value) && value.length === 0) {
return false;
}
// Recurse into arrays
if (Array.isArray(value)) {
for (var i = 0; i < value.length; i++) {
if (!validateValue(value[i])) {
return false;
}
}
}
// Recurse into plain objects
else if (value && typeof value === 'object') {
for (var key in value) {
if (Object.prototype.hasOwnProperty.call(value, key)) {
if (!validateValue(value[key])) {
return false;
}
}
}
}
return true;
}
return validateValue(data);

Copilot uses AI. Check for mistakes.
Comment on lines +91 to +92
if (this.sanitizeHtml) {
result = result.replace(this._htmlTagRegex, '');
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The HTML sanitization using a simple regex /<[^>]*>/g is insufficient for security purposes. This regex doesn't handle HTML entities, script content within tags, event handlers, or encoded HTML. If this is intended for security sanitization, consider using a proper HTML sanitization library or documenting that this is only for basic tag stripping and not security purposes.

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +21
Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The security policy contains placeholder/template text that should be customized for this project. The phrases 'Use this section to tell people about...' and 'Tell them where to go, how often they can expect...' should be replaced with actual project-specific instructions for reporting vulnerabilities and supported versions.

Copilot uses AI. Check for mistakes.
// - Listen to 'dataScrubbed' event to get the result
//
// Example:
// var scrubber = entity.script.wbDataScrumb;
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The variable name in the example has a spelling inconsistency. The script is named 'wbDataScrumb' (with 'Scrumb') but should be 'wbDataScrub' (with 'Scrub') to match the actual script name defined on line 10.

Copilot uses AI. Check for mistakes.
cubic-dev-ai[bot] and others added 2 commits December 19, 2025 00:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>
@JaclynCodes JaclynCodes changed the title Add wb-data-scrumb.js from Engine branch Add wb-data-scrub.js from Engine branch Dec 19, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all 1 issue)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="scripts/utils/wb-data-scrub.js">

<violation number="1" location="scripts/utils/wb-data-scrub.js:66">
P2: Documentation claims Date, RegExp, DOM nodes, and non-plain objects are &quot;returned as-is&quot;, but the implementation converts them to plain objects. Since `typeof` returns `&#39;object&#39;` for these types, they enter the object-handling branch which creates a new `{}` and copies only enumerable own properties, losing their prototype chain and methods. Either update the documentation to reflect actual behavior, or add explicit checks (e.g., `instanceof Date`, `instanceof RegExp`, `value.nodeType`) before the generic object handling to return these types unchanged.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

*
* Plain objects and arrays are traversed recursively and their primitive
* properties are scrubbed based on the configured options. Values such as
* functions, Date instances, RegExp objects, DOM nodes, and other non-plain
Copy link

@cubic-dev-ai cubic-dev-ai bot Dec 19, 2025

Choose a reason for hiding this comment

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

P2: Documentation claims Date, RegExp, DOM nodes, and non-plain objects are "returned as-is", but the implementation converts them to plain objects. Since typeof returns 'object' for these types, they enter the object-handling branch which creates a new {} and copies only enumerable own properties, losing their prototype chain and methods. Either update the documentation to reflect actual behavior, or add explicit checks (e.g., instanceof Date, instanceof RegExp, value.nodeType) before the generic object handling to return these types unchanged.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/utils/wb-data-scrub.js, line 66:

<comment>Documentation claims Date, RegExp, DOM nodes, and non-plain objects are &quot;returned as-is&quot;, but the implementation converts them to plain objects. Since `typeof` returns `&#39;object&#39;` for these types, they enter the object-handling branch which creates a new `{}` and copies only enumerable own properties, losing their prototype chain and methods. Either update the documentation to reflect actual behavior, or add explicit checks (e.g., `instanceof Date`, `instanceof RegExp`, `value.nodeType`) before the generic object handling to return these types unchanged.</comment>

<file context>
@@ -59,10 +59,16 @@ WbDataScrumb.prototype.initialize = function () {
+ *
+ * Plain objects and arrays are traversed recursively and their primitive
+ * properties are scrubbed based on the configured options. Values such as
+ * functions, Date instances, RegExp objects, DOM nodes, and other non-plain
+ * objects are not modified and are returned as-is.
+ *
</file context>
Fix with Cubic

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