encoded keys in the app vs datastore viewer

64 views
Skip to first unread message

dir Ls

unread,
Mar 20, 2019, 11:15:32 AM3/20/19
to Google App Engine
The app keys in my app look like Egw... while in the datastore viewer they look like agtk... . Seems like they are two different encoding schemes. Is there a way to force the datastore viewer to use the newer encoding scheme?

George (Cloud Platform Support)

unread,
Apr 7, 2019, 6:16:05 PM4/7/19
to Google App Engine
The string representation of a key looks cryptic, but is not encrypted. If you don't want to expose this data to your users, you may consider encrypting these strings. 

How do your app keys look like in your app, and why do you consider these keys encrypted? A screen capture, with personal data highlighted out, would help in this case, as for Datastore viewer. You may refer to the "Key Class" documentation page for related information.  

Joshua Fox

unread,
Apr 8, 2019, 8:04:35 AM4/8/19
to google-a...@googlegroups.com
These are plaintext keys built of Kind and Id or name.  These "URL Safe" keys  are Base64 encoded which is why they look illegible.

>  they are two different encoding schemes. Is there a way to force the datastore viewer to use the newer encoding scheme?

I don't know the cause of your problem, but note this ticket. Google App Engine API and Google Cloud API have different incompable  formats for URL Safe keys, and the bug has remained open for a while.



On Mon, Apr 8, 2019 at 1:16 AM 'George (Cloud Platform Support)' via Google App Engine <google-a...@googlegroups.com> wrote:
The string representation of a key looks cryptic, but is not encrypted. If you don't want to expose this data to your users, you may consider encrypting these strings. 

How do your app keys look like in your app, and why do you consider these keys encrypted? A screen capture, with personal data highlighted out, would help in this case, as for Datastore viewer. You may refer to the "Key Class" documentation page for related information.  

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/455216df-805c-4143-a5be-a4b5ed0d8327%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
 

JOSHUA FOX
Director, Software Architecture | Freightos



T (Israel): +972-545691165 | T (US):  +1-3123400953  
Smooth shipping.



dir Ls

unread,
Apr 9, 2019, 12:27:16 PM4/9/19
to Google App Engine
I took the key in the datastore viewer and used the google.appengine.ext.ndb.Key(urlsafe=) api and I see it reconstructs the key properly with the kind and id. In addition, I see an app field for the key. But in the golang representation the Key struct doesn't have an app field. So if an app has multiple micro services one in golang and another in Python, and the encoded value is generated in one microservice and passed to another, will there be a problem? Is it possible to make them all use the same encoding?

Joshua Fox

unread,
Apr 10, 2019, 4:19:21 AM4/10/19
to google-a...@googlegroups.com
I don't know how to make them use the same encoding.

To parse the different formats, either use various Google libraries -- see for example this Pull Request https://github.com/googleapis/google-cloud-python/pull/3491  -- or else write your own code. For this, the Protobuf "proto" file is needed, so either dig that up from some source code, like this, or else "roll your own" (not easy) by  reverse-engineering the Protobuf binaries. Not easy.

Note that  project-id, though part of this URL-safe string, is not really relevant to the Key itself.  For example, if you copy objects between GAE projects, you want to access the "same" object in the two projects using the same query, ignoring the project.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages