jira.atlassian.com Open in urlscan Pro
185.166.143.24  Public Scan

URL: https://jira.atlassian.com/browse/BSERV-14425
Submission: On November 22 via manual from DE — Scanned from NL

Form analysis 2 forms found in the DOM

GET /secure/QuickSearch.jspa

<form action="/secure/QuickSearch.jspa" method="get" id="quicksearch" class="aui-quicksearch dont-default-focus ajs-dirty-warning-exempt" role="search">
  <input id="quickSearchInput" autocomplete="off" class="search" type="text" title="Search ( Type '/' )" placeholder="Search" name="searchString" accesskey="q">
  <div class="quick-search-spinner"></div>
  <input type="submit" class="hidden" value="Search">
</form>

<form id="jira_request_timing_info" class="dont-default-focus">
  <fieldset class="parameters hidden">
    <input type="hidden" title="jira.request.start.millis" value="1700644713775">
    <input type="hidden" title="jira.request.server.time" value="90">
    <input type="hidden" title="jira.request.id" value="558x188064992x3">
    <input type="hidden" title="jira.session.expiry.time" value="-">
    <input type="hidden" title="jira.session.expiry.in.mins" value="-">
    <input id="jiraConcurrentRequests" type="hidden" name="jira.request.concurrent.requests" value="4">
    <input type="hidden" title="db.reads.time.in.ms" value="14">
    <input type="hidden" title="db.conns.time.in.ms" value="18">
  </fieldset>
</form>

Text Content

Log inSkip to main contentSkip to sidebar
Linked Applications
 * Atlassian Documentation
 * Atlassian Community
 * Atlassian Support
 * Atlassian Developers
 * Atlassian Marketplace
 * Billing & Licensing
 * Statuspage Jira
 * Advisory Services JIRA
 * Jira
 * Jira
 * Jira
 * Jira Platform Jira
 * Confluence
 * Ecosystem Confluence
 * Fisheye and Crucible
 * Bitbucket - {7ccca8ea-2abb-44b7-a3f8-8d901528979c}

 * Dashboards
   
 * Projects
   
 * Issues
   
   

 * 
 * Give feedback to Atlassian
 * Help
    * Jira Core help
    * Keyboard Shortcuts
    * About Jira
    * Jira Credits

 * Log In
   

IMPORTANT: JAC is a Public system and anyone on the internet will be able to
view the data in the created JAC tickets. Please don’t include Customer or
Sensitive data in the JAC ticket.
BITBUCKET SERVER


 * Issues
 * Reports
 * Components


 1. Bitbucket Server
 2. BSERV-14425


EDITING A FILE VIA THE REST API WITH A REPO HTTP ACCESS TOKEN RETURNS A 500
ERROR


Log In

Closed


Export

nullView workflow
XML
Word
Printable

DETAILS

 * Type: Bug
 * Resolution: Fixed
 * Priority: Medium
 * Fix Version/s: 7.21.18, 8.9.7, 8.11.6, 8.12.4, (3)
   8.13.3, 8.14.2, 8.15.1
 * Affects Version/s: 7.17.0
 * Component/s: Mesh
 * Labels:
    * dob-pr

 * Support reference count:
   1
 * Symptom Severity:
   Severity 3 - Minor
 * Bug Fix Policy:
   View Atlassian Server bug fix policy

DESCRIPTION


ISSUE SUMMARY

This is reproducible on Data Center: yes


STEPS TO REPRODUCE

 1. Edit a file using the edit file endpoint using a repo HTTP access token

Sample curl request below:

 $ curl --location --request PUT 'http://localhost:7990/bitbucket/rest/api/latest/projects/PROJECT_1/repos/rep_1/browse/add_file/add_file.txt' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer MY REPO ACCESS TOKEN' \
--form 'content=@"add/add_file.txt"' \
--form 'message="Yet another change"' \
--form 'branch="thenewbranch1"' \
--form 'sourceCommitId="148a6f1a86d8d9316fb83bc9ef6ea473cf04bbb2"' \
--form 'sourceBranch="master"' 


EXPECTED RESULTS

The new branch is created and a 200 status code is returned. A 4xx error code is
returned indicating that project/repo tokens can't be used to make commits
because they have no associated user.


ACTUAL RESULTS

The below exception is thrown in the mesh log file and a 500 is returned.

java.lang.IllegalArgumentException: A non-blank value is required
   at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.notBlank(DefaultGitProcessBuilder.java:1095)
   at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.withEnvironment(DefaultGitProcessBuilder.java:810)
   at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.author(DefaultGitProcessBuilder.java:282)
   at com.atlassian.bitbucket.mesh.git.builder.DefaultGitProcessBuilder.author(DefaultGitProcessBuilder.java:135)
   at com.atlassian.bitbucket.mesh.git.builder.AbstractGitProcessBuilder.author(AbstractGitProcessBuilder.java:81)
   at com.atlassian.bitbucket.mesh.git.builder.GitProcessBuilderSupport.author(GitProcessBuilderSupport.java:79)
   at com.atlassian.bitbucket.mesh.git.file.DefaultEditFileManager.commit(DefaultEditFileManager.java:167)
   at com.atlassian.bitbucket.mesh.git.file.DefaultEditFileManager.editFile(DefaultEditFileManager.java:107) 


WORKAROUND

Use a personal HTTP access token, or another authentication method for the REST
call. 

ATTACHMENTS



ISSUE LINKS

relates to

BSERV-18835 In Bitbucket 8.x, when a user without an email address edits a file
through the in-browser editor, an error is shown instead of a user-friendly
message

 * 
 * Short Term Backlog

ACTIVITY

[BSERV-14425] Editing a file via the REST API with a repo HTTP access token
returns a 500 error
 * All
 * Comments
 * Work Log
 * History
 * Activity

Newest first

Brent P added a comment - 21/Sep/2023 4:37 AM - edited

The bug is the 500 response code. We need a user to make a commit and a repo
access token doesn't have an associated user (unlike a personal access token).

So the fix is:

 * Don't return a 500. Maybe return a 4xx with a message saying a user is
   required to create a commit
 * Write a test to verify the error code (because we suspect there isn't a 500
   on the non-Mesh codepath and the 500 error code comes from Mesh)
 * Update docs for this REST call to indicate that it can't be used with
   non-user tokens.


Brent P added a comment - 21/Sep/2023 4:37 AM - edited The bug is the 500
response code. We need a user to make a commit and a repo access token doesn't
have an associated user (unlike a personal access token). So the fix is: Don't
return a 500. Maybe return a 4xx with a message saying a user is required to
create a commit Write a test to verify the error code (because we suspect there
isn't a 500 on the non-Mesh codepath and the 500 error code comes from Mesh)
Update docs for this REST call to indicate that it can't be used with non-user
tokens.

PEOPLE

Assignee: David Zhu Reporter: David Jansons
Affected customers: 0 This affects my team Watchers: 4 Start watching this issue

DATES

Created: 14/Sep/2023 6:48 AM Updated: 13/Nov/2023 11:10 PM Resolved: 13/Nov/2023
11:10 PM

 * Atlassian Jira Project Management Software
 * About Jira
 * Report a problem
 * Privacy policy
 * Notice at Collection



Atlassian







This site uses cookies to improve your browsing experience, perform analytics
and research, and conduct advertising. To change your preferences, click Manage
preferences. Otherwise, clicking Accept all cookies indicates you agree to our
use of cookies on your device. Clicking Reject all cookies means you do not
agree to our use of non-strictly necessary cookies on your device.Atlassian
Cookies and Tracking Notice
Manage preferences Reject all cookies Accept all cookies



MANAGE PREFERENCES

When you visit any website, it may store or retrieve information on your
browser, mostly in the form of cookies. This information might be about you,
your preferences or your device and is mostly used to make the site work as you
expect it to. The information does not usually directly identify you, but it can
give you a more personalized web experience. Because we respect your right to
privacy, you can choose not to allow some types of cookies. Click on the
different category headings to find out more and change our default settings.
However, blocking some types of cookies may impact your experience of the site
and the services we are able to offer.
More information
Accept all

STRICTLY NECESSARY COOKIES

Always Active

These cookies are necessary for the website to function and cannot be switched
off in our systems. They are usually only set in response to actions made by you
which amount to a request for services, such as setting your privacy
preferences, logging in or filling in forms. You can set your browser to block
or alert you about these cookies, but some parts of the site will not then work.
These cookies do not store any personally identifiable information.

TARGETING COOKIES

Targeting Cookies

These cookies may be set through our site by our advertising partners. They may
be used by those companies to build a profile of your interests and show you
relevant adverts on other sites. They are based on uniquely identifying your
browser and internet device. If you do not allow these cookies, you will
experience less targeted advertising.

FUNCTIONAL COOKIES

Functional Cookies

These cookies enable the website to provide enhanced functionality and
personalisation. They may be set by us or by third party providers whose
services we have added to our pages. If you do not allow these cookies then some
or all of these services may not function properly.

PERFORMANCE COOKIES

Performance Cookies

These cookies allow us to count visits and traffic sources so we can measure and
improve the performance of our site. They help us to know which pages are the
most and least popular and see how visitors move around the site. If you do not
allow these cookies we will not know when you have visited our site, and will
not be able to monitor its performance.

Back Button


COOKIE LIST



Search Icon
Filter Icon

Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label

Reject all Confirm my choices