Forums

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

How to get the Jira issue ID from the attachment ID

Abhijeet Kale May 31, 2021

Is there any way we can find out the jira issue id from the attachment id,

We having a public Jira projects for customers and if there is any attachments are added which having sensitive data in it which should not be visible to customer.

Our security team are identifying such attachments and providing the direct links as shown below :

https://i<jira-base-url>/secure/attachment/1234321/server.log?

It does not showing which issue this attachment is belongs to so that Jira admins can update the same.

3 answers

1 accepted

0 votes
Answer accepted
Sagar Mahajan
Community Champion
June 2, 2021

@Abhijeet Kale You can try the below steps to get the issue-key from attachment id

  • Identify the issue-id from the attachment-id from the database
SELECT * FROM fileattachment where id = '12471219'

You will get an issue-id from the query result like below

Capture 2021-06-02 at 15.26.35.png

Then find the issue-key using issue-id, you will get the details as shown in screenshot below

https://<basr-url>/rest/api/2/issue/12929342/

Capture 2021-06-02 at 15.30.43.png

Let me know in case of any issues.

Abhijeet Kale June 7, 2021

Thanks @Sagar I am able to get the issue-key from attachment id from above steps.

Payne
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.
June 8, 2021

If you go this route, use some joins to go ahead and get all the information from the database.

select a.id as attachmentId,concat(p.pkey,'-',issuenum) as issueNum, filename
from fileattachment a
left join jiraissue i on i.id = a.issueid
left join project p on p.id = i.project
where a.id in (30604,26718,30700)

1 vote
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.
May 31, 2021

There is no way to know what issue a file is attached to from just its id.  The id is a simple unique number which has no relationship to the issue.

Your security team should be looking at attachments visibility by checking the issues, not the direct urls, otherwise they're just wasting your time and theirs.

0 votes
Payne
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.
June 1, 2021

If you have direct database access or a scripting app such as ScriptRunner you could tackle it from that angle.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events