Dependabot error with Bitbucket server Clients::Bitbucket::NotFound - bitbucket

I have tried dependabot-script with Azure devops and had no big hurdles (I noticed Dependabot throws error repo not found when the I used user access token rather than system access token in ADO), but now trying with enterprise Bitbucket server I only see this error.
Has anyone experienced this error?
docker run --rm -v "$(pwd):/home/dependabot/dependabot-script" -w /home/dependabot/dependabot-script -e BITBUCKET_ACCESS_TOKEN=$BITBUCKET_ACCESS_TOKEN -e GITHUB_ACCESS_TOKEN=$GITHUB_ACCESS_TOKEN -e PACKAGE_MANAGER=npm_and_yarn -e PROJECT_PATH=projects/project_name/repos/repo_name bundle exec ruby ./generic-update-script.rb
Error
/home/dependabot/dependabot-script/vendor/ruby/2.7.0/gems/dependabot-common-0.142.0/lib/dependabot/clients/bitbucket.rb:170:in `Clients::Bitbucket::NotFound)

I think the problem is in:
PROJECT_PATH=projects/project_name/repos/repo_name
You have to use
PROJECT_PATH=project_name/repo_name

At the moment what you try to achieve seems not be implemented in dependabot.
I guess by the code at dependabot-core that bitbucket enterprise (by which I mean bitbucket installed in your company and not cloud) is not supported.
Right at the bottom of the file it reads
def base_url
# TODO: Make this configurable when we support enterprise Bitbucket
"https://api.bitbucket.org/2.0/repositories/"
end
Unfortunately I did not find further hints if this is really true.
The description of dependabot-script implies that you can set an api url and hostname via BITBUCKET_API_URL and BITBUCKET_HOSTNAME. The defaults there (api 2.0 and bitbucket.org show that they default to the bit bucket cloud API which I believe differs from the enterprise API (at least by the version).
I even tried some of the URLs that are assembled in the dependabot code and half of them work alright on the enterprise bitbucket and some don't (for example ../pullrequests which is used in the code does not work for me because the correct URL would be ../pull-requests on enterprise bitbucket)
I also checked with wireshark since I also tried to get this working and found that dependabot-script does send requests to bitbucket.org but not my enterprise bitbucket even when I set BITBUCKET_API_URL and BITBUCKET_HOSTNAME.

Related

Authorizing client libraries without access to a web browser - gcloud auth application-default login

When I use to run either command:
gcloud auth application-default login
OR for a specific docker container
docker exec -it 822c4c491383 /home/astro/google-cloud-sdk/bin/gcloud auth application-default login.
My command line would give me a link to a google response page where I'd copy the code they gave me and write it in the command line.
For some reason now, whenever I try to do either command I'm getting the follow error, saying I don't have access to web browser.
You are authorizing client libraries without access to a web browser. Please run the following command on a machine with a web browser and
copy its output back here. Make sure the installed gcloud version is
372.0.0 or newer.
gcloud auth application-default login --remote-bootstrap="https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=764086051850-6qr4p6gpi6hn506pt8ejuq83di341hur.apps.googleusercontent.com&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&state=FmMFY6gvpOa9xndMXmWiNG3W1jDrCe&access_type=offline&code_challenge=zUI4n_pnYE5V7p0diDQLmL0X0Sk8XpTDzhz_vwtukOo&code_challenge_method=S256&token_usage=remote"
I've tried copying the link that's inside of this and place it in my web browser but I get a page saying.
Error 400: invalid request Missing required parameter: redirect uri
Edit: Though not sure why this is happening now, I added the option "--no-launch-browser" to the end of both commands and it gives me the link to place in my browser now manually and copy code.
On versions of gcloud >= 383.0.0 (26 Apr 2022), Google have removed support for the --console-only and --no-launch-browser flags on their CLI. As far as I can see, they do not give a reason for this, but it is likely security related.
The new intended method for authenticating on a machine without a web browser, is to use the --no-browser flag and copy the command it gives you onto a machine that has both gcloud >= 372.0 and a web browser installed. In other words, it is no longer possible to do this purely on a machine with no browser. See the following steps copied directly from their documentation:
Follow these steps:
Copy the long command that begins with gcloud auth login --remote-bootstrap=".
Paste and run this command on the command line of a different, trusted machine that has local installations of both a web browser and the gcloud CLI version 372.0 or later.
Copy the long URL output from the machine with the web browser.
Paste the long URL back to the first machine under the prompt, Enter the output of the above command, and press Enter to complete the authorization.
Use gcloud init --console-only
"--console-only" below still works even though it's deprecated:
gcloud init --console-only
And "--no-launch-browser" below still works even though it's deprecated:
gcloud init --no-launch-browser
"--no-browser" below doesn't work yet but "--no-browser" will replace "--console-only" and "--no-launch-browser" so in the future, "--no-browser" will work while "--console-only" and "--no-launch-browser" won't work in the future:
gcloud init --no-browser
Because the redirect uri does not contain the whole URL, this can happen. This can be fixed by adjusting the Custom URL Base.
The result will look like this:
https://my_company_artifactory:444/artifactory
You should also double-check that the Custom URL Base and /api/oauth2/loginResponse are included in your Google OAuth settings page's Authorized redirect URIs.
Reviewing for more information, you can add your localhost URL to the redirect URL, it would say it's not possible at this time. When setting the redirect URL before hitting the create button, it accepts it just fine.

Hyperledger Composer Multiple user mode for REST server throws 401 error

I have been following the tutorials which are provided in Hyperledger Composer docs, but I am not getting the results that they are supposed to I should be getting. Specifically, when I try to enable the multiple user mode for the REST server and I try to call one of the business network REST API operations using the REST API explorer I always get a HTTP 401 Authorization Required. According to the Tutorial, I if get this error is due to I have not authenticated correctly to the REST API, but it does not mention why this error occurs or how I may fix it.
It is very important for application development to be able to authenticate each user who wants to make requests to the API.
What version of Hyperledger Composer are you using?
The tutorial/document you refer to is correct for v0.15.0 and works a little differently for prior versions.
Are you seeing an Access token at the top of the Browser Window - this indicates that you have successfully authenticated and can continue with the steps for the Wallet.
If you are not seeing an Access token displayed, then make sure you hit your REST server with a URL similar to http://localhost:3000/auth/github again and login.
If you are still experiencing problems I would suggest going back to just using authentication without multiuser mode and verify that the authentication works properly from there.
After some research, I found a solution and worked for me.
If you already enable Github authentication then ignore. Otherwise first enable authentication following this tutorial Enaling Authentication.
Before start rest server you will export your admin card from the network by using this command:
composer card export -n admin#sample-network -f admincard.card
Now start rest server with authentication using this command:
composer-rest-server -c admin#sample-network -p 3000 -a true -m true
After some time rest server will start.
Now First, go this link for authentication: http://localhost:3000/auth/github
After successful authentication, you will get an access token and also you will see a Wallet options below.
Now you need to import a card that you already export from your network.
That's it, you can able to add anything to your network.
In my case, I have two missed steps:
enabling authentication for the REST server
https://hyperledger.github.io/composer/v0.19/integrating/enabling-rest-authentication.html
composer-rest-server -c admin#you_project -a true, I just execute composer-rest-server but did not specify the identity "admin#you_project" before.

Sitespeed.io with NTLM

I have an IIS site with NTLM and sitespeed.io, run via Docker, seems to be unable to get past the NTLM Part.
I'm very new to sitespeed.io but have searched their documentation and found nothing to say it does, or does not, specifically support NTLM.
The script I have been running on a Windows 10 machine is:
docker run --rm -v "%cd%":/sitespeed.io sitespeedio/sitespeed.io http://intranet.company.com/Pages/default.aspx#/
The configuration docs indicate that only Basic auth is supported, and this issue comment confirms that NTLM is not supported. (Generally, I'd assume that if something's docs don't affirmatively say the tool supports NTLM auth, it probably doesn't support NTLM.)
You'll need to disable auth entirely, enable Basic auth on IIS, or route your requests through a NTLM proxy (which is not ideal since it necessarily affacts the timings you're trying to measure).

Deploy a Rails app to Openshift: rhc - Username or password is not correct

Our company wants to build a Rails-based backend website and we chose the OpenShift platform to host and deploy. To connect the two, all the guides lead to the installation of the ruby rhc gem and then setup it.
I'm fresh to OpenShift and I'm trying to setup the rhc toolkit on a remote Ubuntu server. Now I ran gem install rhc and everything went fine. Since I have to configure rhc through rhc setup, I ran this command afterwards and just after asking which server I want to use (I left it blank to use openshift.redhat.com) it comes to the login part.
At this moment, OpenShift Online allows you to login only with your GitHub account, so I gave in the GitHub credentials and... voilĂ ! Username or password is not correct. Tried this both on PuTTy and ConEmu.
I swear I checked the login data more than 1000 times, and I'm totally lost.
Thank you a lot in advance
If you want to use OpenShift Online NextGen Developer Preview, you do not use the rhc client. You need to use the oc client. So anything you read where it says rhc is the wrong documentation.
Once you are logged in through the new web console, select on the '?' in circle top right and select command line tools. It will give you links to the 'oc' tools to download, plus the command you need to run to login from the command line using a session access token.
The link to that page should be:
https://console.preview.openshift.com/console/command-line
Also suggest you get down and use the free eBook for the new platform at:
https://www.openshift.com/promotions/for-developers.html
It uses a VM, but ignore the client login step from that and use that from page above instead and then follow examples in the book against the Online NextGen Developer Preview instead.

SSH and unattended processes

I have an Ant build that will sometimes execute a 'git push' within a directory on my server. I can do this fine interactively because it asks for the passphrase for my key, but this becomes problematic if you set up a cron job to run the build unattended.
Are there options for me beyond not using a passphrase? I've heard of using ssh-agent, but I've also heard for unattended processes that route won't work. Does anyone have any recommendations for this, and perhaps an example of how to implement it?
I saw that someone suggested to run the cron as a daemon here:
Accessing SSH key from bash script running via a cron job -- but I'm not sure how I could do that or put in my passphrase without compromising it by putting it in plain text, etc.
Any help greatly appreciated.
First, set yourself up for password-less login.
Use ssh-keygen to generate a public/private key pair with no password. Append the public key to ~/.ssh/authorized_keys on the server.
Then run ssh -i /path/to/private_key server to confirm that the password-less login is working.
Finally, configure git to use that ssh -i ... command.
As #mah suggests, you might want to create a specific git account on the server. You add the public key to ~git/.ssh/authorized_keys to enable the password-less login.
authorized_keys also has options to restrict what commands the incoming connection can run. If you are interested in those features, read the SSH documentation.
And of course, you want to keep the private key file readable only by you.
I would solve this by creating a restricted account on the git server and have the ant client use a keyless cert to that restricted account.

Resources