What scopes are available using the proxy at localhost:29418?
Asked by Amit Edelshtein:

I am writing a pipe that creates a report using commit/{id}/reports endpoint. I also want to create a build status reflecting the status of the report (passing/failing). The report endpoint works with the proxy on port 29418, but the request to commit/{id}/statuses/build returns status code Forbidden with the following error in body:

```
{"data": {"key": "INSUFFICIENT_RIGHTS"}, "type": "error", "error": {"message": "Access denied. You must have write or admin access.", "data": {"key": "INSUFFICIENT_RIGHTS"}}}
```

There is no proper documentation regarding the proxy anywhere... What scopes are available through the proxy? Is my only option to create a OAuth consumer and use it instead of the proxy?


Answers:
author: Halyna Berezovska
body: [@Amit Edelshtein](/t5/user/viewprofilepage/user-id/1216953) there are two possible reasons:

- api endpoint you're using is not allowed to use with proxy

- user is not recognized when going through proxy. check user's permissions. Also, what authentication are you using? Check out how reports sub endpoints are used in one of our pipes (<https://bitbucket.org/atlassian/checkstyle-report/src/66bc4e4048df4dd57cb111813871c992d0656ad5/src/main/java/com/atlassian/bitbucket/pipelines/checkstyle/report/Main.java#lines-136>,

<https://bitbucket.org/atlassian/checkstyle-report/src/66bc4e4048df4dd57cb111813871c992d0656ad5/src/main/java/com/atlassian/bitbucket/pipelines/checkstyle/report/Main.java#lines-134>)

If you want actually to integrate with bitbucket code-insights where report is pushed, you may follow this way, like in our pipe <https://bitbucket.org/atlassian/git-secrets-scan/src/69461ac7e1a17e14023a6fede3d9f9a51d64deec/pipe/pipe.py#lines-34>

Also, check out if report plugin is turned on in your repo.

I guess, that perhaps it is that you want because reports url in official bitbucket api does not officially declare POST request <https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/commit/%7Bcommit%7D/reports>

Cheers, Galyna

comments: author: Amit Edelshtein
body: I appreciate your answer [@Halyna Berezovska](/t5/user/viewprofilepage/user-id/3865505) .

However, the report and annotations endpoints work fine for me using the proxy. The error I am getting is from commit/{id}/statuses/build endpoint when using the proxy.

So I assume the proxy is somehow limited, but I could not find documentation detailing what are the limits of the proxy - is it certain scopes? Certain APIs?


author: Dani Asztalos
body: Hi [@Amit Edelshtein](/t5/user/viewprofilepage/user-id/1216953)

while debugging a similar issue I came across your post. It turns out only the Reports API can be used through the proxy. [It is written in the docs](https://support.atlassian.com/bitbucket-cloud/docs/code-insights/#Authentication:~:text=Using%20Bitbucket%20Pipelines%20allows%20you%20to%20use%20the%20Reports%2DAPI%20without%20extra%20authentication.), although one could argue it is not the most clearly written information there...
> Using Bitbucket Pipelines allows you to use the Reports-API without extra authentication.

I also found feature request [BCLOUD-21842](https://jira.atlassian.com/browse/BCLOUD-21842) where you can vote for the issue.


Tags: bitbucket-pipelines

proxy