Add safe URL construction rules to agent guides#1100
Merged
Conversation
Contributor
There was a problem hiding this comment.
3 issues found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="contrib/claude/httpclient.md">
<violation number="1" location="contrib/claude/httpclient.md:57">
P2: The “good” example should encode dynamic path segments; raw interpolation into `pathname` can break path structure when values contain reserved characters like `/`.</violation>
</file>
<file name="contrib/claude/go-style.md">
<violation number="1" location="contrib/claude/go-style.md:198">
P2: Escape dynamic path segments in the “Good” example; joining raw `userID` can change URL path semantics.</violation>
<violation number="2" location="contrib/claude/go-style.md:221">
P2: The “Good” example still constructs a URL by concatenating strings; parse the base URL and set `RawQuery` instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="contrib/claude/go-style.md">
<violation number="1" location="contrib/claude/go-style.md:198">
P2: This example double-encodes path segments by putting `url.PathEscape(...)` directly into `url.URL.Path`. Use `Path` with the unescaped value and `RawPath` with the escaped value.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="contrib/claude/go-style.md">
<violation number="1" location="contrib/claude/go-style.md:200">
P2: Do not ignore `url.Parse` errors in the “Good” example; handle and wrap the error consistently.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
codenem
approved these changes
Apr 24, 2026
Add a URL and query parameter construction section to contrib/claude/go-style.md requiring net/url (url.JoinPath, url.Values, url.Parse) instead of fmt.Sprintf or string concatenation. Create contrib/claude/ts-style.md with matching TypeScript rules requiring URL and URLSearchParams instead of template literals or string concatenation. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
cb86d75 to
f82d76b
Compare
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.
Summary
contrib/claude/go-style.mdrequiringnet/url(url.URL,url.Values) instead offmt.Sprintfor string concatenationcontrib/claude/httpclient.mdrequiringURLandURLSearchParamsinstead of template literals or string concatenationTest plan
Summary by cubic
Add safe URL construction rules to the Go style guide and add a new TypeScript style guide. Uses structured URL APIs and fixes Go examples to avoid double-encoding and parse errors.
New Features
net/url(url.URL,url.Values); preferurl.JoinPath; recommendpkg/baseurl.URLBuilder; forbidfmt.Sprintf/concat.contrib/claude/ts-style.md; requireURLandURLSearchParams; escape path segments withencodeURIComponent.AGENTS.mdto note Go rules and linkts-style.md.Bug Fixes
url.Values+RawQueryandurl.JoinPathto avoid double-encoding and query concat errors.url.Parse.Written for commit f82d76b. Summary will update on new commits.