# US 10,372,899 B2 · Method and apparatus for context-aware output escaping using dynamic content marking

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,372,899 B2
- Document ID: US10372899B2
- Status: Granted
- Kind: B2
- Application number: 12/841,747
- Filed: 2010-07-22
- Published: 2012-01-26
- Granted: 2019-08-06
- Earliest claimed: 2010-07-22
- Assignees: International Business Machines Corporation
- Applicants: Olgierd Pieczul; Mark Alexander McGloin; Mary Ellen Zurko
- Inventors: Olgierd Pieczul; Mark Alexander McGloin; Mary Ellen Zurko
- Web page: https://patentgrep.com/patent/US10372899B2

## CPC

- G06F 21/50: Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
- G06F 21/51: at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
- G06F 21/54: by adding security routines or objects to programs
- G06F 21/56: Computer malware detection or handling, e.g. anti-virus arrangements
- G06F 2221/2119: Authenticating web pages, e.g. with suspicious links
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A technique to provide runtime output sanitization filtering of web application content that contains multiple contexts in which dynamic output is included. To facilitate this operation, dynamically-generated content is prepared for sanitization in advance, preferably by being “marked” by the web application itself (or by middleware). Preferably, given dynamically-generated content is marked by enclosing it between dynamic content indicators. After the document generation is completed but before it is output, the application-generated content is processed by a content sanitization filter. The filter uses the dynamic content identifiers to identify and locate the content that needs output escaping. The filter detects the appropriate context within which the dynamically-generated content has been placed and applies escaping. The output content is prepared for escaping in advance even if assembled from multiple sources that do not operate in the same runtime environment.

## Claims

### Claim 1

A method, comprising:
deploying a run-time sanitization filter separately from a web application, the run-time sanitization filter being deployed to provide a sanitization function as a hosted service;
receiving, by the run-time sanitization filter, a document that has been previously generated by the web application and determined to include a full set of marked content, the full set of marked content comprising at least a first portion of dynamic output that was generated by the web application in a first context, and a second portion of dynamic output that was generated by the web application in a second context, with the second context being different than the first context;
configuring the run-time sanitization filter to identify the full set of marked content, the configuring using one or more string values included in the document;
applying the run-time sanitization filter to the first portion of dynamic output that was generated in the first context; and
applying the run-time sanitization filter to the second portion of dynamic output that was generated in the second context;
wherein deploying the run-time sanitization filter separately from the web application and receiving the document that has been previously generated by the web application and determined to include the full set of marked content decouples (i) a determination about a need to sanitize the dynamic outputs generated by the web application, and (ii) sanitization performed as the hosted service by the run-time sanitization filter, the run-time sanitization filter thereby only sanitizing the document after the full set of marked content is ready to be examined.

### Claim 2 (depends on 1)

The method as described in claim 1 wherein the first context is HTML and the second context is JavaScript.

### Claim 3 (depends on 1)

The method as described in claim 1 further comprising:
performing dynamic content marking by modifying application code to mark the first portion of dynamic output as being generated in the first context; and
performing dynamic content marking by modifying application code to mark the second portion of dynamic output as being generated in the second context.

### Claim 4

An apparatus, comprising:
a processor;
computer memory holding computer program instructions that when executed by the processor perform operations, comprising:
deploying a run-time sanitization filter separately from a web application, the run-time sanitization filter being deployed to provide a sanitization function as a hosted service;
receiving, by the run-time sanitization filter, a document that has been previously generated by the web application and determined to include a full set of marked content, the full set of marked content comprising at least a first portion of dynamic output that was generated by the web application in a first context, and a second portion of dynamic output that was generated by the web application in a second context, with the second context being different than the first context;
configuring the run-time sanitization filter to identify the full set of marked content, the configuring using one or more string values included in the document;
applying the run-time sanitization filter to the first portion of dynamic output that was generated in the first context; and
applying the run-time sanitization filter to the second portion of dynamic output that was generated in the second context;
wherein deploying the run-time sanitization filter separately from the web application and receiving the document that has been previously generated by the web application and determined to include the full set of marked content decouples (i) a determination about a need to sanitize the dynamic outputs generated by the web application, and (ii) sanitization performed as the hosted service by the run-time sanitization filter, the run-time sanitization filter thereby only sanitizing the document after the full set of marked content is ready to be examined.

### Claim 5 (depends on 4)

The apparatus as described in claim 4 wherein the first context is HTML and the second context is JavaScript.

### Claim 6 (depends on 4)

The apparatus as described in claim 4 wherein the computer instructions are executed by the processor to perform further operations comprising:
performing dynamic content marking by modifying application code to mark the first portion of dynamic output as being generated in the first context; and
performing dynamic content marking by modifying application code to mark the second portion of dynamic output as being generated in the second context.

### Claim 7

A computer program product in a non-transitory computer readable medium for use in a data processing system, the computer program product holding computer program instructions that when executed by the data processing system perform operations, comprising:
deploying a run-time sanitization filter separately from a web application, the run-time sanitization filter being deployed to provide a sanitization function as a hosted service;
receiving, by the run-time sanitization filter, a document that has been previously generated by the web application and determined to include a full set of marked content, the full set of marked content comprising at least a first portion of dynamic output that was generated by the web application in a first context, and a second portion of dynamic output that was generated by the web application in a second context, with the second context being different than the first context;
configuring the run-time sanitization filter to identify the full set of marked content, the configuring using one or more string values included in the document;
applying the run-time sanitization filter to the first portion of dynamic output that was generated in the first context; and
applying the run-time sanitization filter to the second portion of dynamic output that was generated in the second context;
wherein deploying the run-time sanitization filter separately from the web application and receiving the document that has been previously generated by the web application and determined to include the full set of marked content decouples (i) a determination about a need to sanitize the dynamic outputs generated by the web application, and (ii) sanitization performed as the hosted service by the run-time sanitization filter, the run-time sanitization filter thereby only sanitizing the document after the full set of marked content is ready to be examined.

### Claim 8 (depends on 7)

The computer program product as described in claim 7 wherein the first context is HTML and the second context is JavaScript.

### Claim 9 (depends on 7)

The computer program product as described in claim 7 wherein the computer instructions are executed by the processor to perform further operations comprising:
performing dynamic content marking by modifying application code to mark the first portion of dynamic output as being generated in the first context; and
performing dynamic content marking by modifying application code to mark the second portion of dynamic output as being generated in the second context.

### Claim 10 (depends on 1)

The method as described in claim 1 wherein the run-time sanitization filter is deployed in a cloud computing operating environment.

### Claim 11 (depends on 4)

The apparatus as described in claim 4 wherein the run-time sanitization filter is deployed in a cloud computing operating environment.

### Claim 12 (depends on 7)

The apparatus as described in claim 7 wherein the run-time sanitization filter is deployed in a cloud computing operating environment.
