Skip to content

1. Add Go playground server and handlers#3109

Merged
anish-sahoo merged 3 commits into
cog-playgroundfrom
playground/1-cli
Jul 14, 2026
Merged

1. Add Go playground server and handlers#3109
anish-sahoo merged 3 commits into
cog-playgroundfrom
playground/1-cli

Conversation

@anish-sahoo

@anish-sahoo anish-sahoo commented Jul 14, 2026

Copy link
Copy Markdown
Member

@anish-sahoo
anish-sahoo requested a review from a team as a code owner July 14, 2026 18:26

@ask-bonk ask-bonk Bot left a comment

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.

I'm Bonk, and I've done a quick review of your PR.

This PR adds the internal playground command, static server, reverse proxy, webhook relay, and lifecycle handling with comprehensive tests. Overall the code is well-structured and secure.

Issue found:

  1. Protocol-relative redirects are not stripped in the proxy (medium severity). The ModifyResponse hook strips absolute redirects to prevent pivoting the browser to unintended hosts, but protocol-relative redirects (e.g. //169.254.169.254/...) bypass the check because url.Parse sets IsAbs() to false when the scheme is empty. These should also be stripped.

A suggestion comment with the fix and an updated test is posted below.

Comment thread pkg/cli/playground.go Outdated
Comment thread pkg/cli/playground_test.go Outdated
@ask-bonk

ask-bonk Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Posted a review on PR #3109. Found one actionable issue: protocol-relative redirects (e.g. //169.254.169.254/...) bypass the absolute-redirect check in the proxy because url.Parse returns IsAbs() == false when the scheme is empty. Suggested adding || parsed.Host != "" to the condition and provided an updated table-driven test covering both absolute and protocol-relative cases.

github run

@markphelps markphelps 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.

what bonk said

@ask-bonk

ask-bonk Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@anish-sahoo
anish-sahoo merged commit b3cb9f8 into cog-playground Jul 14, 2026
41 checks passed
@anish-sahoo
anish-sahoo deleted the playground/1-cli branch July 14, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants