Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we convert a text field to password field type ?

Maru Sravan January 2, 2024

"Is it possible to convert a text field to a password field type using ScriptRunner Behaviours?"

3 answers

3 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 3, 2024

Hi Maru,

I assume you mean a field that you can type something into, but the browser never displays the content, traditionally just showing a number of stars unrelated to the actual string length.

As @Rebekka Heilmann _viadee_ points out, it's insecure, you should never be storing passwords in Jira (or anywhere other than a highly secured password safe).  At a minimum, you should be storing the salt and hash of a password so that the actual password is never sent over the network.

Anyway, you can do something like that with Behaviours, changing the display text to *s, but do not bother.  You have a series of problems with it:

  • The user will have the plain text on-screen while creating or editing the issue, albeit if you're really clever with the code, you could obscure it after they move off the field (which is complex because the script would also have to remember the plain text and know to replace the ****** when you commit)
  • The HTML your browser receives is going to contain the raw password.  So you could use the developer tools to look at it.  Also, Behaviours usually kicks in after the screen has been rendered by plain Jira.  This means the plain text will appear for a short time before Behaviours can kick in and obscure it.
  • The password will still be sent in plain text (so if, for some reason, you are not using httpS for your Jira, you've just announced the password to the whole world.  Https should always be used for any system you have any form of write access for.  Http is only suitable for static read-only services)
  • The password is visible, plain text, in the database

What you need to do is find a secured password field type.  I wrote one for Jira 3 once, but only for a "password reset" process done within Jira - the password entered was never stored or sent (the salt and hash were sent over a secured local route to another system), the code threw the plain-text away before the issue got written to.   Looked odd in the database - "this custom field is used in these projects, but there are no values for it anywhere"

If you really do want to store passwords in Jira properly, you'll need to add code to that field so that it stores the salt and hash of what is entered and then write more code to let Jira act as a password checker.

The basic process of that is:

  • Jira has a hashed password somewhere (let's say it's stored on issue ABC-123)
  • Another system that someone is trying to log into is given the plain password on logon
  • The other system hashes what was entered
  • The other system contacts Jira and says, "hey, for issue ABC-123, someone has given me this hash"
  • Jira can then check the two hashes match and respond with "nope" or "yes valid"

Again, you could do this with Scriptrunner, but I really recommend that you look for software designed to store passwords securely - Jira isn't the right place.

0 votes
Answer accepted
John Funk
Community Champion
January 3, 2024

Hi Maru,

No, you cannot change the types of fields in Jira. You will need to create a new field with the new type and migrate any data to the new field. 

0 votes
Answer accepted
Rebekka Heilmann (viadee)
Community Champion
January 3, 2024

Why do you need a password field in Jira? I wouldn't recommend saving data like passwords in Jira, so hence the question.

Maru Sravan January 3, 2024

@Rebekka Heilmann _viadee_ 
To meet the requirements of my use case, I require a custom field type specifically designed for passwords.
If a custom field type specifically designed for passwords is not available, an alternative solution would be to hide the values entered by end-user.

Rebekka Heilmann (viadee)
Community Champion
January 3, 2024

Should be doable with ScriptRunner. @Nic Brough -Adaptavist- and colleagues should be able to help with that.

Still. Highly recommend NOT to save passwords in Jira. Custom Fields are not encrypted. Especially as you still seem to be on a Server License and with recent Security Issues.... With EoL approaching it is to be expected that more Vulnerabilities will pop up.

Maru Sravan January 3, 2024

@Nic Brough -Adaptavist-Could you please recommend an approach for me?

Thanks in advance.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events