How to use URL encryption

Prerequisites

Introduction

To activate URL encryption, the encryption mode must be specified in the first place. Airlock supports pass phrase-based encryption (PBE) and session-based encryption schemes. The recommended setting is session-based, where all cryptographically encrypted values are only valid during one user's session. The pass phrase-based encryption mode makes it possible to have encrypted URLs, parameters and values valid over multiple user sessions.

Once URL encryption is activated, Airlock encrypts all relative and absolute URLs in the HTML responses of the back-end application. New since Airlock version 4.2.4, also absolute URLs with the same protocol and host name the last request was referred to will be encrypted.

Note: It is necessary to configure at least one exception pattern (see below) in order to use the URL encryption mechanism in a meaningful way. Once URL encryption is activated, Airlock only accepts encrypted URLs with a valid signature. At least one URL must be reachable in the plain format to enter the application context.

Illegal URL redirect location

External redirect location to redirect the user to if an invalid URL is detected.Note: Invalid URLs may occur because of session timeouts or other terminated sessions and do not imply active attacks in all cases.

Example: /index.html

URL encryption path exception pattern

Once the URL encryption engine is activated for a Mapping, Airlock only accepts encrypted URLs to access the corresponding back-end application servers. However, there must be so-called bookmarks or entry URLs configured, which are accessible without encryption, in order to enter the application context in the first place. The exception patterns can be configured in a list of regular expressions. All incoming URLs that match one of these patterns are accepted by Airlock without encryption. The Ignore Case option specifies whether the pattern should be interpreted as case sensitive or not.

Note: The illegal URL redirect location (see above) must be one of these exceptions if it is located behind the same Mapping. Otherwise, a continuous redirect loop is initiated. It is recommended to only allow very simple and static URLs to be accessed as exceptions.

The following example specifies that the URL /index.html may be accessed without encryption. This way, users can set a bookmark for the index page in their browsers. From that point on, all URLs will be encrypted.

Example: ^/index\.html$

Preconditions / normal case

For URL Encryption to work 'out of the box', Airlock needs to recognise all URLs sent in the response of the back-end application server. This works automatically if the URL is placed in accordance with a common HTML specification. This are:

Important:Only absolute URLs with the same protocol and host name the last request was referred to will be encrypted.e.g.: <a href="http://www.mydomain.com/rootpath/path">...

External, absolute links with different host name and protocol will NOT be encrypted.e.g.: <a href="http://www.otherdomain.com/path">...

Before 4.2.4:

Important: Only URLs without protocol and host name will be encrypted. URLs with protocol and host names will be interpreted as links to external systems and thus not changed.e.g.: <a href="http://www.mydomain.com/rootpath/path">...

Hint: Rewrite links to remove protocol and host names, like for example "http://www.mydomain.com/rootpath/path" to "/rootpath/path".

Special URLs and special content types

URLs can appear in other document types as well, for example in document types like "text/css". In this case it is also possible to configure rules so that Airlock recognizes those URLs and encrypt them. Mostly this is used for image URLs in CSS files with content type "text/css", as shown in the following example.

Example:

.calendar thead tr { background: url("/jira/includes/js/calendar/skins/aqua/title-bg.gif") repeat-x 0 100%; color: #000; } .calendar thead .title { /* This holds the current "month, year" */ font-weight: bold; /* Pressing it will take you to the current date */ text-align: center; padding: 2px; With the function "Rewrite Response Body (any content)" it is possible to define the URL to encrypt as follows:

The principle is the same as what we saw in the last chapter. To define the URL to encrypt, use ?<URL>URL as well. For this example and for most other cases, set a default rule using "Rewrite Stylesheet URLs".

The function "Rewrite Response Body (any content)" can also be used if URLs are placed at non HTML conform locations in HTML documents (content-type: "text/html"). In this case not even the function "Rewrite Response Body (HTML only)" with option "URI" will work.

When will URL encryption not work?

URL encryption does not work if URLs are built or assembled dynamically on the client side e.g. by JavaScript functions.

Useful Tool

During implementation, in some cases it is necessary to use tools to analyse the responses, in order to find the URLs which are not encrypted and may cause trouble. One of these tools is ieHTTPheaders (for Internet Explorer) or Tamper Data when using Mozilla Firefox.

Form Protection

In addition to URL Encryption it is possible to sign all form information of an application. See the article about Form protection.