From 0414166d5f9fb81bf307a6f8c7abbc3b83b1a7b5 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:09:07 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20escape=20channel=20repo?= =?UTF-8?q?=20names=20in=20the=20agent=20channels=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #15907 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/fixed-agent-channel-repos-esc.md | 1 + .../dashboard/agent_channels_repos_esc_test.go | 16 ++++++++++++++++ src/pkg/dashboard/static-src/js/config-agent.js | 2 +- src/pkg/dashboard/static/index.html | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fixed-agent-channel-repos-esc.md create mode 100644 src/pkg/dashboard/agent_channels_repos_esc_test.go diff --git a/changelog.d/fixed-agent-channel-repos-esc.md b/changelog.d/fixed-agent-channel-repos-esc.md new file mode 100644 index 0000000000..cf88363662 --- /dev/null +++ b/changelog.d/fixed-agent-channel-repos-esc.md @@ -0,0 +1 @@ +- The agent channels list now escapes repository names before rendering them, matching the other channel fields ([#15907](https://github.com/hivecommons/hive/issues/15907)). diff --git a/src/pkg/dashboard/agent_channels_repos_esc_test.go b/src/pkg/dashboard/agent_channels_repos_esc_test.go new file mode 100644 index 0000000000..8d45b3493f --- /dev/null +++ b/src/pkg/dashboard/agent_channels_repos_esc_test.go @@ -0,0 +1,16 @@ +package dashboard + +import ( + "strings" + "testing" +) + +func TestAgentChannelsReposEscaped(t *testing.T) { + html := indexHTML(t) + if !strings.Contains(html, "ch.repos.map(esc).join(', ')") { + t.Fatal("channel repos must be escaped before rendering") + } + if strings.Contains(html, "ch.repos.join(', ')") { + t.Fatal("channel repos must not be joined without esc()") + } +} diff --git a/src/pkg/dashboard/static-src/js/config-agent.js b/src/pkg/dashboard/static-src/js/config-agent.js index ad63d03826..862066edd3 100644 --- a/src/pkg/dashboard/static-src/js/config-agent.js +++ b/src/pkg/dashboard/static-src/js/config-agent.js @@ -631,7 +631,7 @@ if (ch.patterns && ch.patterns.length) html += 'patterns: '+ch.patterns.map(p => ''+esc(p)+'').join(', '); if (ch.schedule) html += 'schedule: '+esc(ch.schedule)+''; if (ch.match) html += 'match: '+Object.entries(ch.match).map(([k,v]) => ''+esc(k)+'='+esc(v)+'').join(', '); - if (ch.repos && ch.repos.length) html += ' (repos: '+ch.repos.join(', ')+')'; + if (ch.repos && ch.repos.length) html += ' (repos: '+ch.repos.map(esc).join(', ')+')'; html += ''; html += ''; html += ''; diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index d0fd0e460c..dcbf5d13fa 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -53788,7 +53788,7 @@

Hub settings

if (ch.patterns && ch.patterns.length) html += 'patterns: '+ch.patterns.map(p => ''+esc(p)+'').join(', '); if (ch.schedule) html += 'schedule: '+esc(ch.schedule)+''; if (ch.match) html += 'match: '+Object.entries(ch.match).map(([k,v]) => ''+esc(k)+'='+esc(v)+'').join(', '); - if (ch.repos && ch.repos.length) html += ' (repos: '+ch.repos.join(', ')+')'; + if (ch.repos && ch.repos.length) html += ' (repos: '+ch.repos.map(esc).join(', ')+')'; html += ''; html += ''; html += '';