pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.util.streamscanner
Class MimeSniffingScanner

java.lang.Object
  extended by org.torweg.pulse.util.streamscanner.MimeSniffingScanner
All Implemented Interfaces:
IStreamScanner

public class MimeSniffingScanner
extends java.lang.Object
implements IStreamScanner

a simple scanner trying to protect against attacks on Internet Explorer's MIME sniffing vulnerabilities.

Version:
$Revision: 2026 $
Author:
Thomas Weber

Constructor Summary
MimeSniffingScanner()
          default constructor.
 
Method Summary
 void close()
          does nothing for this scanner.
 void scan(byte[] b)
          scans the given byte array.
 void scan(int b)
          scans the given byte.
 void setContentType(java.lang.String t)
          this scanner will only be applied to non-text content-types, i.e. all streams with a content-type of text/* will not be scanned.
 void setUser(User u)
          sets the user.
 void shutdown()
          unconditionally frees all resources of this scanner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MimeSniffingScanner

public MimeSniffingScanner()
default constructor.

Method Detail

setContentType

public final void setContentType(java.lang.String t)
this scanner will only be applied to non-text content-types, i.e. all streams with a content-type of text/* will not be scanned.

Specified by:
setContentType in interface IStreamScanner
Parameters:
t - the content-type

setUser

public void setUser(User u)
sets the user.

Specified by:
setUser in interface IStreamScanner
Parameters:
u - the user to set

scan

public final void scan(byte[] b)
                throws XSSStreamException
scans the given byte array.

Specified by:
scan in interface IStreamScanner
Parameters:
b - the byte array to be scanned
Throws:
XSSStreamException - if the scanner finds any of the triggers

scan

public final void scan(int b)
                throws XSSStreamException
scans the given byte.

Specified by:
scan in interface IStreamScanner
Parameters:
b - the byte to scan
Throws:
XSSStreamException - if the scanner finds any of the triggers

close

public final void close()
does nothing for this scanner.

Specified by:
close in interface IStreamScanner
See Also:
IStreamScanner.close()

shutdown

public final void shutdown()
unconditionally frees all resources of this scanner.

Specified by:
shutdown in interface IStreamScanner