Warning: Missing argument 2 for wpdb::prepare(), called in /home/stromber/public_html/kryptoblog/wp-content/plugins/wp-super-edit/wp-super-edit.core.class.php on line 109 and defined in /home/stromber/public_html/kryptoblog/wp-includes/wp-db.php on line 1222
Hacka Google med Google App Engine » Kryptoblog

Hacka Google med Google App Engine

April 10th, 2008 by Joachim Strömbergson Leave a reply »

För några dagar sedan presenterade Google sin nya tjänst App Engine.

App Engine

Med App Engine erbjuder Google en miljö och utrymme för att köra applikationer hos Google. Google beskriver applikationsmiljön på följande sätt:


The Application Environment
Google App Engine makes it easy to build an application that runs reliably, even under heavy load and with large amounts of data. The environment includes the following features:

  • dynamic web serving, with full support for common web technologies
  • persistent storage with queries, sorting and transactions
  • automatic scaling and load balancing
  • APIs for authenticating users and sending email using Google Accounts
  • a fully featured local development environment that simulates Google App Engine on your computer

Google App Engine applications are implemented using the Python programming language. The runtime environment includes the full Python language and most of the Python standard library.

Although Python is currently the only language supported by Google App Engine, we look forward to supporting more languages in the future.

The Sandbox
Applications run in a secure environment that provides limited access to the underlying operating system. These limitations allow App Engine to distribute web requests for the application across multiple servers, and start and stop servers to meet traffic demands. The sandbox isolates your application in its own secure, reliable environment that is independent of the hardware, operating system and physical location of the web server.

Examples of the limitations of the secure sandbox environment include:

  • An application can only access other computers on the Internet through the provided URL fetch and email services and APIs. Other computers can only connect to the application by making HTTP (or HTTPS) requests on the standard ports.
  • An application cannot write to the file system. An app can read files, but only files uploaded with the application code. The app must use the App Engine datastore for all data that persists between requests.
  • Application code only runs in response to a web request, and must return response data within a few seconds. A request handler cannot spawn a sub-process or execute code after the response has been sent.

Google beskriver även Pythonmiljön närmare:


The Python runtime environment uses Python version 2.5.2.

The environment includes the Python standard library. Of course, calling a library method that violates a sandbox restriction, such as attempting to open a socket or write to a file, will not succeed. For convenience, several modules in the standard library whose core features are not supported by the runtime environment have been disabled, and code that imports them will raise an error.

Application code must be written exclusively in Python. Code with extensions written in C is not supported.

The Python environment provides rich Python APIs for the datastore, Google Accounts, URL fetch and email services. App Engine also provides a simple Python web application framework called webapp to make it easy to start building applications.

For convenience, App Engine also includes the Django web application framework, version 0.96.1. Note that the App Engine datastore is not a relational database, which is required by some Django components. Some components, such as the Django template engine, work as documented, while others require a bit more effort. See the Articles section for tips on using Django with App Engine.

You can upload other third-party libraries with your application, as long as they are implemented in pure Python and do not require any unsupported standard library modules.

Det ser alltså ut som att Google lagt ner mycket arbete på att se till att App Engine-applikationer exekverar i en säker miljö som inte hotar andra applikationer eller Googles egna system. Det har nu inte hindrat folk att försöka. Tvärt om, att döma av maillistor som Dailydave har rätt många börjat stampa på Pythonmiljön för att se om det går att slå hål på sandlådan.

En av de första applikationer som dykt upp i App Engine är ett interaktivt Python-skal. Och den applikationen använts för att undersöka vad som går att göra, bland annat försök att komma åt passwd-filer, och på andra sätt titta och peta i Pythonmiljön och det underliggande systemet. En hel del försök har dock slutat i det här meddelandet:

This Google App Engine application is temporarily over its serving quota. Please try again later.

Jag satt och testade lite själv för att se hur mycket av Pythons standardbibliotek man får med:


Google Apphosting/1.0
Python 2.5.2 (r252:60911, Mar 12 2008, 14:07:58)
[GCC 4.1.0]

>>> import this
>>> import os
>>> os.path
(module ‘posixpath’ from ‘/base/python_dist/lib/python2.5/posixpath.py’)

(Jag har ändrat syntaxen frÃ¥n responsen i skalet dÃ¥ hakparanteserna fastnade i WordPress…)

OS-modulen finns med, och det gÃ¥r uppenbarligen att titta runt i sandlÃ¥dans struktur. Men Pythons pÃ¥skägg “this” har Google inte plockat med…

Vi får se om/när någon lyckas slå hål på App Engine, om Google lyckats rensa ut alla accesser till underliggande systemet eller ej. Google har ju en bra grundförutsättning i och med att Guido van Rossum arbetar på Google.
Guido

Är det någon som borde kunna ha bra koll på hur man bygger om Python är det BDFL.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Advertisement

2 comments

  1. Martin M says:

    Ett mycket intressant projekt. Det är litet synd att de skickar med Django men att större delarna av Django inte går att använda med googles databasmodeller ännu: admin, generic views, djangos DB-klasser, osv. Förhoppningsvis kommer det att bli bättre med tiden.

    Ett annat krux är att GQL (googles SQL-språk) inte stödjer joins, group by osv. Jag undrar hur problematiskt det kommer att vara i praktiken.

    Och jag undrar verkligen hur säkerheten i google’s sandlÃ¥dsversion av Python kommer att stÃ¥ sig. MÃ¥nga andra har haft problem med säkerheten i sÃ¥dana lösningar.

Leave a Reply

You must be logged in to post a comment.