|
| 1 | +/** |
| 2 | + * OWASP Enterprise Security API (ESAPI) |
| 3 | + * |
| 4 | + * This file is part of the Open Web Application Security Project (OWASP) |
| 5 | + * Enterprise Security API (ESAPI) project. For details, please see |
| 6 | + * <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>. |
| 7 | + * |
| 8 | + * Copyright (c) 2007 - The OWASP Foundation |
| 9 | + * |
| 10 | + * The ESAPI is published by OWASP under the BSD license. You should read and accept the |
| 11 | + * LICENSE before you use, modify, and/or redistribute this software. |
| 12 | + * |
| 13 | + * @author Jeff Williams <a href="http://www.aspectsecurity.com">Aspect Security</a> |
| 14 | + * @created 2007 |
| 15 | + */ |
| 16 | +package org.owasp.esapi; |
| 17 | + |
| 18 | + |
| 19 | +/** |
| 20 | + * A parameterized string that can be used to send data to an interpreter. |
| 21 | + * |
| 22 | + * PreparedString div = new PreparedString( “<a href=”@1” onmouseover=”alert(‘@2’)”>test</a>” ); |
| 23 | + * div.setURL( 1, request.getParameter( “url” ) ); |
| 24 | + * div.setJavaScriptString( 2, request.getParameter( “message” ) ); |
| 25 | + * out.println( div.toString() ); |
| 26 | + * |
| 27 | + * // escaping for SQL |
| 28 | + * PreparedString query = new PreparedString( “SELECT * FROM users WHERE name=@1 AND password=@2” ); |
| 29 | + * query.setSQLString( 1, request.getParameter( “name” ) ); |
| 30 | + * query.setSQLString( 1, request.getParameter( “pass” ) ); |
| 31 | + * stmt.execute( query.toString() ); |
| 32 | + * |
| 33 | + * @author Jeff Williams (jeff.williams .at. aspectsecurity.com) <a |
| 34 | + * href="http://www.aspectsecurity.com">Aspect Security</a> |
| 35 | + * @since June 1, 2007 |
| 36 | + */ |
| 37 | +public class PreparedString { |
| 38 | + String template = null; |
| 39 | + char parameterCharacter = '@'; |
| 40 | + |
| 41 | + public PreparedString( String template ) { |
| 42 | + this.template = template; |
| 43 | + } |
| 44 | + |
| 45 | + public void setParameterCharacter( char c ) { |
| 46 | + parameterCharacter = c; |
| 47 | + } |
| 48 | + |
| 49 | + /// FIXME: xxx |
| 50 | + |
| 51 | +} |
0 commit comments