Allow package subpath plugin entries in serverless.yml - #455
Merged
Conversation
Plugin entries such as '@scope/package/lib/plugin' are valid require specifiers (package exports subpaths) and loaded fine before the 4.0 validation, which now rejects them with INVALID_PLUGIN_NAME. Validate the package name and the subpath separately for configured entries. Subpath segments must be non-empty and must not be '.' or '..'. 'plugin install' and 'plugin uninstall' stay package-name only.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This supersedes #454 by @jimmyn, whose commit is carried over unchanged so they keep authorship.
Plugin entries such as
@scope/package/lib/pluginare valid require specifiers, typically packageexportssubpaths, and loaded fine before the 4.0 validation, which now rejects them withINVALID_PLUGIN_NAMEbecause the configured-entry check reuses the bare npm package name pattern. That leaves a shared library that ships its plugin as a subpath export unusable on 4.x without a per-service./shim.The package name and the subpath are now validated separately for configured entries. The package name goes through the unchanged
validatePluginName, while subpath segments must be non-empty and must not be.or.., otherwise the entry fails withINVALID_PLUGIN_REFERENCE. Versioned specs are still rejected, absolute paths and traversal still fail, andplugin installandplugin uninstallremain package-name only. On top of the original change, the not-found error now suggests installing the package name rather than the full subpath entry, since the install command would reject the latter, and the upgrade guide wording is tidied.