Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
fix(codeql): fixed potentially unsafe external link vulnerabilities
Browse files Browse the repository at this point in the history
fix #20
  • Loading branch information
victor-pogor committed Nov 30, 2020
1 parent 8de0022 commit e1e63d8
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion assets/js/theme.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/theme.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ ignoreErrors = ["error-remote-getjson"]
icp = ""
# license info (HTML format is supported)
# 许可协议信息 (支持 HTML 格式)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
license= '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'

# Section (all posts) page config
# Section (所有文章) 页面配置
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ Please open the code block below to view the complete sample configuration :(far
# ICP info only in China (HTML format is supported)
icp = ""
# license info (HTML format is supported)
license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'

# {{< version 0.2.0 >}} Section (all posts) page config
[params.section]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ Please open the code block below to view the complete sample configuration :(far
# ICP info only in China (HTML format is supported)
icp = ""
# license info (HTML format is supported)
license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'

# {{< version 0.2.0 >}} Section (all posts) page config
[params.section]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ hugo
# ICP 备案信息,仅在中国使用 (支持 HTML 格式)
icp = ""
# 许可协议信息 (支持 HTML 格式)
license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'

# {{< version 0.2.0 >}} Section (所有文章) 页面配置
[params.section]
Expand Down
6 changes: 3 additions & 3 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
{{- /* Hugo and LoveIt */ -}}
{{- if ne .Site.Params.footer.hugo false -}}
<div class="footer-line">
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo %v">Hugo</a>` hugo.Version -}}
{{- $theme := .Scratch.Get "version" | printf `<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt %v"><i class="far fa-kiss-wink-heart fa-fw"></i> LoveIt</a>` -}}
{{- $hugo := printf `<a href="https://gohugo.io/" target="_blank" rel="noopener noreferrer" title="Hugo %v">Hugo</a>` hugo.Version -}}
{{- $theme := .Scratch.Get "version" | printf `<a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreferrer" title="LoveIt %v"><i class="far fa-kiss-wink-heart fa-fw"></i> LoveIt</a>` -}}
{{- dict "Hugo" $hugo "Theme" $theme | T "poweredBySome" | safeHTML }}
</div>
{{- end -}}
Expand All @@ -32,7 +32,7 @@

{{- /* Author */ -}}
{{- if ne .Site.Params.footer.author false -}}
<span class="author" itemprop="copyrightHolder">&nbsp;<a href="{{ $.Site.Author.link | default .Site.Home.RelPermalink }}" target="_blank">{{ .Site.Author.name }}</a></span>
<span class="author" itemprop="copyrightHolder">&nbsp;<a href="{{ $.Site.Author.link | default .Site.Home.RelPermalink }}" target="_blank" rel="noopener noreferrer">{{ .Site.Author.name }}</a></span>
{{- end -}}

{{- /* License */ -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
<a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
</a>
{{- end -}}
Expand Down Expand Up @@ -142,7 +142,7 @@
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a class="menu-item" href="{{ $url }}" title="{{ .Title }}"{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
<a class="menu-item" href="{{ $url }}" title="{{ .Title }}"{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
{{- .Pre | safeHTML }}{{ .Name }}{{ .Post | safeHTML -}}
</a>
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/home/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreffer" target="_blank"{{ end }}>
<a href="{{ $url }}"{{ with .Title | default .Name }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
{{- dict "Src" $avatar | partial "plugin/image.html" -}}
</a>
{{- else -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/plugin/link.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $rel := "" -}}
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreffer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{ with .Class }} class="{{ . }}"{{ end }}>
<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse .Destination).Host | or .Newtab }}{{ $rel = "noopener noreferrer" }} target="_blank"{{ end }} rel="{{ $rel }}{{ with .Rel }} {{ . }}{{ end }}"{{ with .Class }} class="{{ . }}"{{ end }}>
{{- with .Icon -}}
{{- partial "plugin/icon.html" . -}}
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/single/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{- dict "Date" . | T "updatedOnDate" -}}
{{- if $.Site.Params.gitRepo -}}
{{- with $.GitInfo -}}
&nbsp;<a class="git-hash" href="{{ printf `%v/commit/%v` $.Site.Params.gitRepo .Hash }}" target="_blank" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
&nbsp;<a class="git-hash" href="{{ printf `%v/commit/%v` $.Site.Params.gitRepo .Hash }}" target="_blank" rel="noopener noreferrer" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
<i class="fas fa-hashtag fa-fw"></i>{{- .AbbreviatedHash -}}
</a>
{{- end -}}
Expand All @@ -30,7 +30,7 @@
{{- if $params.linktomarkdown -}}
{{- with .OutputFormats.Get "markdown" -}}
<span>
<a class="link-to-markdown" href="{{ .RelPermalink }}" target="_blank">
<a class="link-to-markdown" href="{{ .RelPermalink }}" target="_blank" rel="noopener noreferrer">
{{- T "readMarkdown" -}}
</a>
</span>
Expand Down
2 changes: 1 addition & 1 deletion layouts/shortcodes/version.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
{{- $resource := resources.Get "svg/version.template.svg" -}}
{{- $resource = $resource | resources.ExecuteAsTemplate $path (dict "version" $version "label" $label "color" $color) | minify -}}
{{- $alt := printf "LoveIt %v | %v" $label $version -}}
<a href="{{ $url }}" rel="noopener noreffer" target="_blank">
<a href="{{ $url }}" rel="noopener noreferrer" target="_blank">
{{- dict "Src" $resource.RelPermalink "Alt" $alt "Class" "version" | partial "plugin/image.html" -}}
</a>
2 changes: 1 addition & 1 deletion src/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class Theme {
icon: '',
href: 'https://lunrjs.com/',
};
return `<div class="search-footer">Search by <a href="${href}" rel="noopener noreffer" target="_blank">${icon} ${searchType}</a></div>`;},
return `<div class="search-footer">Search by <a href="${href}" rel="noopener noreferrer" target="_blank">${icon} ${searchType}</a></div>`;},
},
});
autosearch.on('autocomplete:selected', (_event, suggestion, _dataset, _context) => {
Expand Down

0 comments on commit e1e63d8

Please sign in to comment.