TEC Workbook - IBM

TEC Workbook - IBM TEC Workbook - IBM

23.02.2013 Views

IBM Software The policy will now protect against malicious SQL injection threats. The file sqlThreat.xml contains a SOAP message with an SQL Injection Threat in it. The contents of the element contain the threat: XI50 DataPower' or '1'='1 {omitted} Security;Integration;Performance __6. In the soapUI request window, load the request from c:\labs\requests\sqlThreat.xml. __7. Click the green submit button to POST the message to ProductServiceProxy. The request should fail due to “Message contains restricted content (from client)”. 2.6 Transforming with XSL and XPath At the heart of WebSphere DataPower SOA Appliances is a high speed XSL compiler and execution engine. In fact, most built-in functionality is engineered using XSL. Some of the built-in stylesheets can be found in the store directory. XSL developers can easily copy and modify the IBM provided stylesheets to create new functionality or support emerging standards before IBM makes them available. When a stylesheet is referenced for the first time, it is compiled using a patented optimizing XSL compiler for execution on specialized WebSphere DataPower hardware, then cached in memory for high-speed recall and execution. IBM has augmented XSL with a rich set of extension functions that enable you to easily add complex processing functionality to your processing rules. For example, there are extension functions for performing base-64 encoding and decoding, encryption and decryption, and date/time functions. There are also functions for communicating with off-box web services as well as LDAP servers. In this section, you’ll be introduced to how XSL templates are used within processing rules. You’ll also get a chance to see the decode() extension function for decoding base-64 encoded text. In the following steps, you’ll add a transform action to the response (server to client) rule instead of the request rule. Since the transform action will modify the overall structure of the message, it won’t match the schema that the backend service is expecting, therefore the request will fail. To avoid this, you’ll modify the response which is destined back to soapUI. __1. In the policy editor, towards the bottom, click on the Server to Client rule to make it the active rule in the editor. Page 46 WebSphere Lab Jam

__2. Click and drag a transform action and drop it after the match action. __3. Double click the yellow outlined transform action to expose its configuration settings. For this transform, the stylesheet will be located on a remote HTTP server rather than in your local: directory. __4. In the Transform field: __a. In the top dropdown, select http://. __b. In the lower text box, type: demoserver/files/productTransform.xsl __5. Click the Done button to save the transform action. __6. Click the Apply Policy button to apply the changes to the overall policy. __7. Click the Close Window link to dismiss the policy editor. __8. Click the Apply button in the Configure Multi-Protocol Gateway form. IBM Software You’re now ready to run another transaction through your multi-protocol gateway service. Before you do that, let’s take a look at what the XSL template will do to the message. Here’s the SOAP body of the response message. Notice the tag contains base- 64 encoded text (some of it has been omitted). XI50 WebSphere DataPower SUJNIFdlYlNw {omitted} Security;Integration;Performance Lab 2 - Working with XML Page 47

<strong>IBM</strong> Software<br />

The policy will now protect against malicious SQL injection threats. The file sqlThreat.xml contains a<br />

SOAP message with an SQL Injection Threat in it. The contents of the element contain the<br />

threat:<br />

<br />

XI50<br />

DataPower' or '1'='1<br />

{omitted}<br />

Security;Integration;Performance<br />

<br />

__6. In the soapUI request window, load the request from c:\labs\requests\sqlThreat.xml.<br />

__7. Click the green submit button to POST the message to ProductServiceProxy. The request<br />

should fail due to “Message contains restricted content (from client)”.<br />

2.6 Transforming with XSL and XPath<br />

At the heart of WebSphere DataPower SOA Appliances is a high speed XSL compiler and execution<br />

engine. In fact, most built-in functionality is engineered using XSL. Some of the built-in stylesheets can<br />

be found in the store directory. XSL developers can easily copy and modify the <strong>IBM</strong> provided stylesheets<br />

to create new functionality or support emerging standards before <strong>IBM</strong> makes them available.<br />

When a stylesheet is referenced for the first time, it is compiled using a patented optimizing XSL compiler<br />

for execution on specialized WebSphere DataPower hardware, then cached in memory for high-speed<br />

recall and execution.<br />

<strong>IBM</strong> has augmented XSL with a rich set of extension functions that enable you to easily add complex<br />

processing functionality to your processing rules. For example, there are extension functions for<br />

performing base-64 encoding and decoding, encryption and decryption, and date/time functions. There<br />

are also functions for communicating with off-box web services as well as LDAP servers.<br />

In this section, you’ll be introduced to how XSL templates are used within processing rules. You’ll also<br />

get a chance to see the decode() extension function for decoding base-64 encoded text.<br />

In the following steps, you’ll add a transform action to the response (server to client) rule instead of the<br />

request rule. Since the transform action will modify the overall structure of the message, it won’t match<br />

the schema that the backend service is expecting, therefore the request will fail. To avoid this, you’ll<br />

modify the response which is destined back to soapUI.<br />

__1. In the policy editor, towards the bottom, click on the Server to Client rule to make it the active<br />

rule in the editor.<br />

Page 46 WebSphere Lab Jam

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!