feat: derive AgentSuffix from build origin#11341
Open
lidel wants to merge 2 commits into
Open
Conversation
Fork builds previously announced as plain `kubo/<ver>/<commit>`, indistinguishable from upstream in ecosystem dashboards. When `Version.AgentSuffix` and `--agent-version-suffix` are both unset, kubo now derives a default from the build origin so fork traffic self-identifies in the swarm. - mk/git.mk, cmd/ipfs/Rules.mk: normalize `git remote get-url origin` to `host/org/repo` and inject as `buildOrigin` ldflag - version.go: ImplicitAgentSuffix prefers buildOrigin, falls back to debug.ReadBuildInfo Main.Path; suffixFromForkPath strips known forges (github, gitlab, codeberg, bitbucket) and trailing `/kubo` - cmd/ipfs/kubo/daemon.go: use as fallback when explicit values empty - AGENTS.md: state builds must use `make build` so ldflags are set - docs/config.md: document the implicit-suffix behavior
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.
Problem
Fork builds announce themselves as plain
kubo/<ver>/<commit>over libp2p identify and HTTP user-agent, indistinguishable from upstream. A fork running old code with hand-applied CVE patches looks identical in swarm traces to a current upstream release, sending maintainer debugging down the wrong path.Version.AgentSuffixexists but operators rarely set it.Fix
When
Version.AgentSuffixand--agent-version-suffixare both unset, kubo derives a default from the build origin so forks self-identify.mk/git.mk+cmd/ipfs/Rules.mkinject the normalizedgit remote get-url originas abuildOriginldflag.ImplicitAgentSuffixinversion.goprefersbuildOrigin, falls back todebug.ReadBuildInfo().Main.Pathforgo install;suffixFromForkPathstrips known forges (github.com,gitlab.com,codeberg.org,bitbucket.org) and a trailing/kubo.daemon.goplumbs it as the final fallback (Version.AgentSuffix > --agent-version-suffix > implicit).A
make buildofgithub.com/myorg/kuboreportskubo/<ver>/<commit>/myorg; explicit config or CLI flag overrides it.