Skip to content

Commit

Permalink
fix: remove target="_blank" from html sources [IDE-677] (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch authored Oct 1, 2024
1 parent 6bbcc14 commit 7bfcf91
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions infrastructure/code/template/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ <h2 class="severity-title">{{.IssueTitle}}</h2>
{{if gt (len .CWEs) 0}}
<span class="delimiter">|</span>
{{range $index, $cwe := .CWEs}}
<a class="cwe styled-link" target="_blank" rel="noopener noreferrer"
<a class="cwe styled-link" rel="noopener noreferrer"
href="https://cwe.mitre.org/data/definitions/{{trimCWEPrefix $cwe}}.html">{{$cwe}}</a>
{{if ne $index (idxMinusOne (len $.CWEs))}}<span class="delimiter"></span>{{end}}
{{end}}
Expand All @@ -739,7 +739,7 @@ <h2 class="severity-title">{{.IssueTitle}}</h2>
<div class="lesson-icon">
{{.LessonIcon}}
</div>
<a class="lesson-link styled-link is-external" target="_blank" rel="noopener noreferrer" href="{{.LessonUrl}}">
<a class="lesson-link styled-link is-external" rel="noopener noreferrer" href="{{.LessonUrl}}">
Learn about this vulnerability
{{.ExternalIcon}}
</a>
Expand Down Expand Up @@ -782,7 +782,7 @@ <h2 class="severity-title">{{.IssueTitle}}</h2>
<div class="ignore-next-step-text">
Ignores are currently managed in the Snyk web app.
To edit or remove the ignore please go to:
<a class="styled-link" href="{{.SnykWebUrl}}" target="_blank"
<a class="styled-link" href="{{.SnykWebUrl}}"
rel="noopener noreferrer">{{.SnykWebUrl}}</a>.
</div>
</div>
Expand Down Expand Up @@ -938,7 +938,7 @@ <h2 class="example-fixes-header">Fixed Code Examples</h2>
<div id="current-example" class="repo clickable">
{{.GitHubIcon}}
<span id="example-link" class="example-repo-link">
<a id="example-repo-anchor" href="{{(index .ExampleCommitFixes 0).RepoLink}}" target="_blank"
<a id="example-repo-anchor" href="{{(index .ExampleCommitFixes 0).RepoLink}}"
rel="noopener noreferrer">
{{(index .ExampleCommitFixes 0).RepoName}}
</a>
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/iac/iac_html_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func Test_IaC_Html_getIacHtml(t *testing.T) {
assert.Contains(t, iacPanelHtml, `<div class="severity-container">`, "HTML should contain the severity icon container")

// Reference section
assert.Contains(t, iacPanelHtml, `<a class="styled-link" target="_blank" rel="noopener noreferrer" href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/">https://kubernetes.io/docs/reference/access-authn-authz/rbac/</a>`, "HTML should contain the first reference")
assert.Contains(t, iacPanelHtml, `<a class="styled-link" target="_blank" rel="noopener noreferrer" href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole">https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole</a>`, "HTML should contain the second reference")
assert.Contains(t, iacPanelHtml, `<a class="styled-link" rel="noopener noreferrer" href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/">https://kubernetes.io/docs/reference/access-authn-authz/rbac/</a>`, "HTML should contain the first reference")
assert.Contains(t, iacPanelHtml, `<a class="styled-link" rel="noopener noreferrer" href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole">https://kubernetes.io/docs/reference/access-authn-authz/rbac/#role-and-clusterrole</a>`, "HTML should contain the second reference")
}

func createIacIssueSample() snyk.Issue {
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/iac/template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h2 class="severity-title">{{.Issue.AdditionalData.Title}}</h2>
<div class="severity-type-container">
<div class="severity-type">Issue</div>
<span class="delimiter"></span>
<a class="styled-link" target="_blank" rel="noopener noreferrer"
<a class="styled-link" rel="noopener noreferrer"
href="{{.Issue.AdditionalData.Documentation}}">{{.Issue.ID}}</a>
</header>
<section class="delimiter-top summary">
Expand Down Expand Up @@ -78,7 +78,7 @@ <h2>Remediation</h2>
<h2>References</h2>
<div class="summary-items">
{{range .Issue.AdditionalData.References}}
<a class="styled-link" target="_blank" rel="noopener noreferrer" href="{{.}}">{{.}}</a>
<a class="styled-link" rel="noopener noreferrer" href="{{.}}">{{.}}</a>
{{end}}
</div>
</section>
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/oss/template/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
{{if gt (len .CVEs) 0}}
<span class="delimiter"> </span>
{{range $index, $cve := .CVEs}}
<a class="cve styled-link" target="_blank" rel="noopener noreferrer"
<a class="cve styled-link" rel="noopener noreferrer"
href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=$cve">{{$cve}}</a>
{{if ne $index (idxMinusOne (len $.CVEs))}}<span class="delimiter"></span>{{end}}
{{end}}
Expand All @@ -184,19 +184,19 @@
{{if gt (len .CWEs) 0}}
<span class="delimiter"> </span>
{{range $index, $cwe := .CWEs}}
<a class="cwe styled-link" target="_blank" rel="noopener noreferrer"
<a class="cwe styled-link" rel="noopener noreferrer"
href="https://cwe.mitre.org/data/definitions/{{trimCWEPrefix $cwe}}.html">{{$cwe}}</a>
{{if ne $index (idxMinusOne (len $.CWEs))}}<span class="delimiter"></span>{{end}}
{{end}}
{{end}}

{{if gt (len .CvssScore) 0}}
<span class="delimiter"> </span>
<a class="cvssscore styled-link" target="_blank" rel="noopener noreferrer" href="https://www.first.org/cvss/calculator/3.1#{{.CVSSv3}}">CVSS {{.CvssScore}}</a>
<a class="cvssscore styled-link" rel="noopener noreferrer" href="https://www.first.org/cvss/calculator/3.1#{{.CVSSv3}}">CVSS {{.CvssScore}}</a>
{{end}}

<span class="delimiter"> </span>
<a class="styled-link" target="_blank" rel="noopener noreferrer"
<a class="styled-link" rel="noopener noreferrer"
href="https://snyk.io/vuln/{{.IssueId}}">{{.IssueId}}</a>
</div>
{{ if .LessonUrl }}
Expand Down

0 comments on commit 7bfcf91

Please sign in to comment.