diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 4348b3090..7328843db 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -4,6 +4,6 @@ #### Improvements 🧹 -- prevent `tooltip` to be an URL when `link` is already set. [#888](https://github.com/terrastruct/d2/pull/1091) +- prevent `tooltip` to be an URL when `link` is already set. [#1091](https://github.com/terrastruct/d2/pull/1091) #### Bugfixes ⛑️ diff --git a/d2compiler/compile.go b/d2compiler/compile.go index ccfda366f..06dc6578f 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -367,10 +367,9 @@ func (c *compiler) compileReserved(attrs *d2graph.Attributes, f *d2ir.Field) { if attrs.Link != nil && attrs.Tooltip != nil { _, err := url.ParseRequestURI(attrs.Tooltip.Value) if err == nil { - c.errorf(scalar, "Tooltip cannot be an URL when Link is set") + c.errorf(scalar, "Tooltip cannot be set to URL when link is also set (for security)") } } - } func (c *compiler) compileStyle(attrs *d2graph.Attributes, m *d2ir.Map) { diff --git a/d2compiler/compile_test.go b/d2compiler/compile_test.go index ac30ae7f3..845e0c41a 100644 --- a/d2compiler/compile_test.go +++ b/d2compiler/compile_test.go @@ -1473,7 +1473,7 @@ x -> y: { { name: "no_url_link_and_url_tooltip_concurrently", text: `x: {link: https://not-google.com; tooltip: https://google.com}`, - expErr: `d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2:1:44: Tooltip cannot be an URL when Link is set`, + expErr: `d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2:1:44: Tooltip cannot be set to URL when link is also set (for security)`, }, { name: "url_link_and_not_url_tooltip_concurrently", diff --git a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg index becd23be5..5436e2231 100644 --- a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg @@ -110,7 +110,7 @@ -wintersummertreessnowsun +wintersummertreessnowsun \ No newline at end of file diff --git a/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg b/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg index 52de585df..94d2f4ef0 100644 --- a/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/animated_dark/sketch.exp.svg @@ -108,7 +108,7 @@ -wintersummertreessnowsun +wintersummertreessnowsun \ No newline at end of file diff --git a/e2etests-cli/testdata/TestCLI_E2E/hello_world_png_sketch.exp.png b/e2etests-cli/testdata/TestCLI_E2E/hello_world_png_sketch.exp.png index 8ccb67e8e..687d23c99 100644 Binary files a/e2etests-cli/testdata/TestCLI_E2E/hello_world_png_sketch.exp.png and b/e2etests-cli/testdata/TestCLI_E2E/hello_world_png_sketch.exp.png differ diff --git a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf index d57607674..9186410df 100644 Binary files a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf and b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf differ diff --git a/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json b/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json index d4c16cf4d..289bd8ec8 100644 --- a/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json +++ b/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.exp.json @@ -5,7 +5,7 @@ "errs": [ { "range": "d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2,0:43:43-0:61:61", - "errmsg": "d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2:1:44: Tooltip cannot be an URL when Link is set" + "errmsg": "d2/testdata/d2compiler/TestCompile/no_url_link_and_url_tooltip_concurrently.d2:1:44: Tooltip cannot be set to URL when link is also set (for security)" } ] }