Skip to content

feat: add buildtags analyzer - #1052

Merged
xnyo merged 6 commits into
mainfrom
giuseppe/detect-marketplace-dev-mode-new
Oct 22, 2026
Merged

xnyo merged 6 commits into
mainfrom
giuseppe/detect-marketplace-dev-mode-new

Conversation

@xnyo

@xnyo xnyo commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Adds buildtags analyzer. Searches for build tags in Go backend executable. Added a rule that flags plugins with the marketplace_dev build tag, which strips license checks from the executable. This mode is used for developing marketplace plugins locally without a Grafana Enterprise license, see grafana/grafana-plugin-sdk-go#1748

@xnyo xnyo self-assigned this Oct 21, 2026
@xnyo xnyo added the enhancement New feature or request label Oct 21, 2026
@xnyo
xnyo added this pull request to stack #1054 October 21, 2026 15:30
@xnyo xnyo moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Oct 21, 2026
@xnyo
xnyo force-pushed the giuseppe/detect-marketplace-dev-mode-new branch from aba1854 to 00c6f30 Compare October 21, 2026 15:31
@xnyo
xnyo marked this pull request as ready for review October 21, 2026 16:45
@xnyo
xnyo requested a review from a team as a code owner October 21, 2026 16:45
@xnyo
xnyo requested review from academo, andresmgot, s4kh and wbrowne and removed request for a team October 21, 2026 16:45
logme.Debugln("Could not read build info for", binaryPath, err)
return false
}
for _, setting := range info.Settings {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, we can read the binary and extract info from it.

s4kh
s4kh previously approved these changes Oct 21, 2026

@academo academo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to the previous marketplace PR. there's no strong reason to make this a marketplace-specific validator.

This can be a generic validator that checks for specific symbols and have some rules disabled by default

We might want to introduce these checks in non-marketplace plugins in the future and it'll force us to either rewrite this validator or duplicate the logic.

@xnyo xnyo changed the title feat: add marketplacedev analyzer feat: add buildtags analyzer Oct 22, 2026
@xnyo

xnyo commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

similar to the previous marketplace PR. there's no strong reason to make this a marketplace-specific validator.

This can be a generic validator that checks for specific symbols and have some rules disabled by default

We might want to introduce these checks in non-marketplace plugins in the future and it'll force us to either rewrite this validator or duplicate the logic.

@academo refactored to be a buildtags analyzer with a rule for the marketplace_dev tag. This was we can inspect for other build tags in the same analyzer if needed in the future. PTAL. Better now?

@xnyo
xnyo requested review from academo and s4kh October 22, 2026 09:38
Rules: []*analysis.Rule{marketplaceDevBuild},
ReadmeInfo: analysis.ReadmeInfo{
Name: "Build Tags",
Description: "Checks Go backend executables for disallowed build tags. The `marketplace-dev-build` rule rejects `marketplace_dev` and is disabled by default.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to mention specific rules in the readme.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Sorry. Fixed in 5be3667

}
}

for _, check := range buildTagChecks {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do one report per finding instead of combining them into a single one. that's how often we report things in the validator.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 192354a

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked: 2c30859

@xnyo
xnyo requested a review from academo October 22, 2026 12:57
@xnyo
xnyo merged commit 1864c98 into main Oct 22, 2026
13 checks passed
@xnyo
xnyo deleted the giuseppe/detect-marketplace-dev-mode-new branch October 22, 2026 14:30
@github-project-automation github-project-automation Bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

3 participants