Repository navigation
Conversation
562fffb to
1278790
Compare
|
Somewhat related to #999 - this checks for links from the plugin.json. |
academo
left a comment
There was a problem hiding this comment.
I generally don't like the idea of having marketplace-specific validator and I wonder if you can consider making this a more generic validator. like "sdk function calls" validator where we can define different rules that define specific symbols we want to find inside the binaries and these marketplace licensing ones being one of them.
|
I did more research and it looks like we can use semgrep for this, without a new analyzer. It won't cover any case but it should still be reliable and won't introduce marketplace-specific analyzer. I'll see how it looks like and rework this PR accordingly |
3ff97df to
470a55f
Compare
470a55f to
6bde13d
Compare
|
Removed the dedicated analyzer and reworked to use semgrep instead. PR description has been updated with more details. PTAL. |
Changes
coderulesanalyzer (semgrep) to include marketplace licensing checksThe new semgrep rules checks if a plugin contains marketplace licensing:
or (for apps)
or (nested plugins)
The new semgrep rules checks imports for both
github.com/grafana/grafana-plugin-sdk-go/experimental/marketplace(current package) ANDgithub.com/grafana/grafana-plugin-sdk-go/marketplace: the Gomarketplacepackage will be moved out ofexperimentalsoon, and adding both paths will not require us to update the validator when we movemarketplacepkg out ofexperimentalpkgThese are disabled by default, they have to run only for marketplace plugins. Non-marketplace plugins will fail this check, and there's no way to fix it: it's a marketplace-specific thing.
To support this, the PR adds a system to disable specific semgrep rules via semgrep
metadatafield, which is part of its supported schema and can contain arbitrary data attached to the rule that's consumed by whoever runs semgrep:In the semgrep rules yaml file, a rule can contain:
Then, the rule can be enabled via the validator config:
Note: disabled rules are still evaluated, but their output is filtered out, which is the same behavior when disabling them via config (when they are enabled by default).