Skip to content

Commit 67da4c1

Browse files
h3xxsilverwind
andauthored
Set type="password" on all auth_token fields (#22175)
Set `type="password"` on all `auth_token` fields Seen when migrating from other hosting platforms. 1. Prevents exposing the token to screen capture/cameras/eyeballs. 2. Prevents the browser from saving the value in its autocomplete dictionary, which often is not secure. ![exposed auth token](https://user-images.githubusercontent.com/615684/208541005-e2c9c6b0-3c6c-4a56-95d9-357b987aa0c8.png) Closes #22174 --------- Signed-off-by: Dan Church <amphetamachine@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
1 parent b3e849d commit 67da4c1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

templates/repo/migrate/gitea.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<div class="inline field {{if .Err_Auth}}error{{end}}">
2222
<label for="auth_token">{{.locale.Tr "access_token"}}</label>
23-
<input id="auth_token" name="auth_token" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}>
23+
<input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}>
2424
<a target="_blank" href="https://docs.gitea.io/en-us/api-usage">{{svg "octicon-question"}}</a>
2525
</div>
2626

templates/repo/migrate/github.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<div class="inline field {{if .Err_Auth}}error{{end}}">
2222
<label for="auth_token">{{.locale.Tr "access_token"}}</label>
23-
<input id="auth_token" name="auth_token" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}>
23+
<input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}>
2424
<a target="_blank" href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">{{svg "octicon-question"}}</a>
2525
<span class="help">
2626
{{.locale.Tr "repo.migrate.github_token_desc"}}

templates/repo/migrate/gitlab.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<div class="inline field {{if .Err_Auth}}error{{end}}">
2222
<label for="auth_token">{{.locale.Tr "access_token"}}</label>
23-
<input id="auth_token" name="auth_token" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}>
23+
<input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}}data-need-clear="true"{{end}}>
2424
<a target="_blank" href="https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html">{{svg "octicon-question"}}</a>
2525
</div>
2626

templates/repo/migrate/gogs.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
<div class="inline field {{if .Err_Auth}}error{{end}}">
2222
<label for="auth_token">{{.locale.Tr "access_token"}}</label>
23-
<input id="auth_token" name="auth_token" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}>
23+
<input id="auth_token" name="auth_token" type="password" autocomplete="new-password" value="{{.auth_token}}" {{if not .auth_token}} data-need-clear="true" {{end}}>
2424
<!-- <a target="_blank" href="https://docs.gitea.io/en-us/api-usage">{{svg "octicon-question"}}</a> -->
2525
</div>
2626

0 commit comments

Comments
 (0)