Skip to content

ExtensionService does not validate the content of addins files #1415

@CharliePoole

Description

@CharliePoole

Currently, we assume that every entry in the file, once blank lines and comments are removed, is either a pattern or a valid path. Patterns are expanded to paths while we are searching for extensions but paths are used directly.

Error handling for patterns seems pretty good: if no file is found matching it we log that fact but otherwise ignore it. For paths without wild cards, we throw if the directory or file is not found.

The error message given when a path is not found can be cryptic. For example, a file containing a comment in C# format (leading double slash) gave the message "Directory '' not found." Figuring this out took an inordinate amount of time, since the message didn't clearly point to the addins file.

Proposed resolution:

  1. Check each non-pattern (entries with without *) for validity as a path. If an invallid entry is found, throw an exception immediately so that the extension may be removed or the file fixed.
  2. Optionally, check each pattern as well by replacing each * with a valid name and validate that as a path. In this case, we may want to simply issue a warning, as the error won't necessarily lead to an exception. If possible, we should try to discriminate between errors which will cause an exception and those which will not.

Comments please?

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions