-
Notifications
You must be signed in to change notification settings - Fork 2
Add wb-data-scrub.js from Engine branch #8
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
base: main
Are you sure you want to change the base?
Conversation
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>
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit 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 |
Co-authored-by: JaclynCodes <218383634+JaclynCodes@users.noreply.github.com>
Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>
There was a problem hiding this 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'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'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: | |
There was a problem hiding this comment.
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'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>
There was a problem hiding this 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.
| // 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; |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
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.
| // 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); |
| if (this.sanitizeHtml) { | ||
| result = result.replace(this._htmlTagRegex, ''); |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
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.
| 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. |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
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.
| // - Listen to 'dataScrubbed' event to get the result | ||
| // | ||
| // Example: | ||
| // var scrubber = entity.script.wbDataScrumb; |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Misfit <218383634+JaclynCodes@users.noreply.github.com>
There was a problem hiding this 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 "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.</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 |
There was a problem hiding this comment.
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 "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.</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>
Adds the
wb-data-scrumb.jsPlayCanvas script from commit 6993291.Changes
scripts/utils/wb-data-scrumb.js- Data sanitization utility scriptUsage
Configurable Options
removeNullValues- Strip null/undefined valuesremoveEmptyStrings- Strip empty stringstrimStrings- Trim whitespace from stringsremoveEmptyArrays- Strip empty arrayssanitizeHtml- Strip HTML tags from stringsmaxDepth- Recursion depth limit (prevents infinite loops)Original prompt
✨ 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.
Written for commit 75df634. Summary will update automatically on new commits.