0

I have an app deployed to google cloud platform. I downloaded google cloud cli and logged in with gcloud auth login.

Then I tried to download project with the

C:\Users\user\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py -A hello-world download_app hello-world

but it ended up with error

08:27 PM Host: appengine.google.com
08:27 PM Fetching file list...
Error 403: --- begin server output ---
You do not have permission to modify this app

I also checked the permissions in the "Over granted permissions" sidebar , but I do not know what to look for..

I do not have the original source code of java app, I want to download compiled classes to decompile it. I tried it with other test account and there was no problem with download. Maybe because I deployed the app and then downloaded it?

enter image description here

hocikto
  • 871
  • 1
  • 14
  • 29

2 Answers2

2

Okay, so I managed to do it.

First thing, if you want to download the deployed source code, and you have the OWNER account, and it is not working on you computer with gcloud utils, you can do it this way

  1. Log into google cloud console through web browser
  2. Open cloud shell
  3. download the source code with this command inside the web browser shell appcfg.py -A your-project-name download_app folder-where-to-download
  4. optionally tar the file/folder to compress it
  5. COPY THE FILE TO YOUR BUCKET WITH THIS COMMAND gsutil cp filename.tar.gz gs://your-projects-bucket-name/
  6. Visit https://console.cloud.google.com/storage/browser/your-project-name.appspot.com?project=your-project-name
  7. File should be there available to download
hocikto
  • 871
  • 1
  • 14
  • 29
1

Currently, you will not be able to download your code using this method.

In the past it was possible to do it with the method you are using as per referenced in this documentation, however, this is now deprecated and this function is no longer available.

What you could do, if you deployed recently, is to check your project's buckets, since during the deploy, everything is stored in a temporary bucket. Note that this is recycled constantly, so you code might already have been deleted from this bucket. Here is a community post related to the temporary buckets that the code is stores on, that might be of some help.

Ralemos
  • 5,571
  • 2
  • 9
  • 18
  • Hi, I know that code is stored in bucket for 15 days, but this was long time ago, I kinda inherited this project after a deceased guy and nobody has the gerrit credentials. I already sucesfully download test app that was deployed by me, but I am unable to download from other account where this app is stored. I can see the list of classes, and I would like to download them and decompile if possible.. The tool you mentioned still works, just not for this account and I do not know which permission is missing. There is 1600-ish of them – hocikto Feb 17 '20 at 15:21
  • The documentation you linked me to mentions this `Only the authenticated user who deployed the version of the application as well as the users with the project Owner role have the privileges to download files. Other users who attempt to download the application will receive an error message similar to the following` But I am using the OWNER account, it is somehow not working though... – hocikto Feb 17 '20 at 15:23
  • Oh I found this, I'll try and let you know `constraints/appengine.disableCodeDownload` – hocikto Feb 17 '20 at 15:24
  • Indeed, that is what needed to be changed in order for you to get access with the owner account, however, this is the part where the deprecation gets it, you are unable to change this constraint with the owner account due to a missing role that needs to be added but I couldn't find it anywhere. I tried to replicate on my end and was unable to change this, but let me know if it works for you. – Ralemos Feb 17 '20 at 15:27
  • I see. I can't change it through the web app, maybe somehow through CLI. – hocikto Feb 17 '20 at 15:31
  • If you just need to check the code, what you could do, and I am not sure if you would have access, is to use the stackdriver debug function. you might be able to select the classes there and check their code, and copy + paste to a new project. you wouldn't get the project as a whole, but you would get some of the code back and not restart from scratch – Ralemos Feb 17 '20 at 15:34
  • Or you could contact google support and ask them to reset your colleague's account for you... – Ralemos Feb 17 '20 at 15:35
  • Yes I found the stackdriver but I am not sure if the format of classes I am seeing is decompileable, but when I downloaded the other project that worked, I could decompile app no problem – hocikto Feb 17 '20 at 15:40
  • I found a way to do it, it is kinda hacky but works for what I need, check it out! :) – hocikto Feb 17 '20 at 18:43