001// Copyright (c) 2001 Hursh Jain (http://www.mollypages.org) 002// The Molly framework is freely distributable under the terms of an 003// MIT-style license. For details, see the molly pages web site at: 004// http://www.mollypages.org/. Use, modify, have fun ! 005 006package fc.web.forms; 007 008import javax.servlet.*; 009import javax.servlet.http.*; 010import java.io.*; 011import java.util.*; 012import java.sql.*; 013 014import fc.jdbc.*; 015import fc.io.*; 016import fc.util.*; 017 018/** 019This class handles form submit data that may have been hacked/modified 020by the client. By default, this class logs a warning. Subclasses should 021override the {@link #handle} method as needed. 022 023@author hursh jain 024**/ 025public class SubmitHackedHandler 026{ 027protected Log log; 028 029public SubmitHackedHandler(Form form) 030 { 031 this.log = form.log; 032 } 033 034/** 035This method should handle submit data that is hacked (different than 036the options/values allowed by the html form). Possible actions are 037to log an error, email the developers, identify compromised machines etc. 038<p> 039If this method throws a {@link SubmitHackedException}, then further 040form processing will stop and the invoking page/servlet can handle the 041exception appropriately. 042<p> 043The default implementation simply logs the error and then returns. 044*/ 045public void handle(HttpServletRequest req, String msg) throws SubmitHackedException 046 { 047 log.warn("HACKLERT: IP=", req.getRemoteAddr(), ": ", msg); 048 } 049 050} //SubmitHackedHandler