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

iAPI: Enforce correct namespaces in all places (directives, functions…) that accept a namespace #63749

Open
2 tasks done
luisherranz opened this issue Jul 19, 2024 · 0 comments
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Packages] Interactivity /packages/interactivity [Type] Bug An existing feature does not function as intended

Comments

@luisherranz
Copy link
Member

Description

Namespaces can only contain alphanumeric characters, hyphens, underscores, and forward slashes, but as of today, we're not ensuring that namespaces have the correct format in all places that accept a namespace (directives, functions…) which could result in some confusion/bugs.

We should review all the code and ensure that an error message is displayed whenever a namespace is not correctly formatted.

In the runtime, to avoid increasing the bundle size, we could perform this check only in development (when the constant SCRIPT_DEBUG is true).


Reported by @gziolo in Slack.

Step-by-step reproduction instructions

  1. Try to pass a namespace that does not comply with the format to the store() function in JavaScript or wp_interactivity_state() in PHP.
  2. An error should be displayed.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@luisherranz luisherranz added [Type] Bug An existing feature does not function as intended [Feature] Interactivity API API to add frontend interactivity to blocks. [Packages] Interactivity /packages/interactivity labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Interactivity API API to add frontend interactivity to blocks. [Packages] Interactivity /packages/interactivity [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant