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

Potential fix for code scanning alert no. 197: Unvalidated dynamic method call #100533

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

Conversation

alshakero
Copy link
Member

@alshakero alshakero commented Feb 26, 2025

Potential fix for https://github.com/Automattic/wp-calypso/security/code-scanning/197

To fix the problem, we need to ensure that the flowLoader is a valid function before invoking it. This can be achieved by adding a check to confirm that flowLoader is a function. If it is not, we should handle the error gracefully, such as by redirecting to the default flow.

  1. Add a check to verify that flowLoader is a function before calling it.
  2. If flowLoader is not a function, redirect to the default flow or handle the error appropriately.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

@ciampo, check this out! AI caught this. I thought it was wrong and almost dismissed it but it's actually right. You can see the bug if you visit https://wordpress.com/setup/__proto__

…thod call

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@alshakero alshakero requested a review from ciampo February 26, 2025 23:59
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 26, 2025
@alshakero alshakero marked this pull request as ready for review February 27, 2025 00:01
@alshakero alshakero requested a review from a team as a code owner February 27, 2025 00:01
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~11 bytes added 📈 [gzipped])

name           parsed_size           gzip_size
entry-stepper        +22 B  (+0.0%)      +11 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug alert-autofix-197 on your sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants