Streaming CSRF Token Insertion via State Machine

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for protecting against Cross-Site Request Forgeries (CSRF) are inefficient and can alter content, causing delays and incorrect presentation, as they require parsing and reconstructing HTML documents to insert security tokens, which can lead to processor overload and user experience issues.

Innovation Solution

A state machine is used to scan and insert CSRF tokens into content in real-time as it is served, without altering the content's structure, allowing for efficient token insertion and handling of malformed HTML, ensuring minimal overhead and no delay in content delivery.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If HTML documents are parsed and reconstructed to insert security tokens, then CSRF protection is achieved, but server performance deteriorates due to processor overload and memory consumption

Engineering Contradiction:
ImproveCSRF protectionVSAvoidserver performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent extracts only the essential functionality needed for CSRF protection (token insertion) from the full HTML document parsing process. Instead of parsing and reconstructing entire documents, the system injects tokens at specific points in the HTML stream without requiring complete document analysis, thereby achieving security protection while minimizing processor and memory overhead

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent segments the HTML document processing into discrete insertable points that can be identified during streaming without waiting for complete document parsing. This allows token insertion to occur at specific locations (such as form elements or links) as the HTML stream is being served, rather than requiring the entire document to be parsed and reconstructed first

Inventive Principle:
Principle #1Segmentation

2Reliability

If HTML documents are parsed and reconstructed to insert security tokens, then CSRF protection is achieved, but content delivery is delayed

Engineering Contradiction:
ImproveCSRF protectionVSAvoidcontent delivery delay
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent performs preliminary identification of token insertion points during the initial phase of HTML streaming, before the complete document is received. This allows the security tokens to be inserted at predetermined locations in the HTML stream without waiting for full document parsing, enabling earlier content delivery while maintaining CSRF protection

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system extracts and processes only the critical portions of the HTML stream that contain insertable elements (such as forms or links) without requiring complete document reconstruction. This selective processing approach eliminates unnecessary parsing delays while ensuring tokens are inserted at all required locations

Inventive Principle:
Principle #2Taking out (Extraction)

3Reliability

If HTML documents are parsed and reconstructed to insert security tokens, then CSRF protection is achieved, but content structure is altered causing incorrect presentation

Engineering Contradiction:
ImproveCSRF protectionVSAvoidcontent structure integrity
Core Design Contradiction:
ReliabilityVSManufacturing precision

Solution Approach 1:

The patent extracts tokens and inserts them into the HTML stream without performing full document reconstruction that would alter whitespace, formatting, or structural elements. By avoiding complete parsing and re-generation of HTML, the original content structure and presentation are preserved while still achieving security token insertion

Inventive Principle:
Principle #2Taking out (Extraction)

4Reliability

If HTML documents are parsed and reconstructed to insert security tokens, then CSRF protection is achieved, but device complexity increases

Engineering Contradiction:
ImproveCSRF protectionVSAvoidprocessing complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The patent simplifies the processing complexity by extracting only the essential token insertion functionality from complex HTML parsing and reconstruction operations. The system identifies insertable elements and injects tokens without requiring full DOM construction, attribute validation, or complete document re-generation, thereby reducing computational overhead and processing complexity

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentEP2558973B1Streaming insertion of tokens into content to protect against csrf
Publication Date: 2017.02.15 SUCCESSFACTORS INC
  • EP2558973B1 patent drawing
  • EP2558973B1 patent drawing
  • EP2558973B1 patent drawing

AI summary

Methods and apparatus are provided for protecting against cross-site request forgeries (CSRFs) by requiring certain requests submitted to a computer server to include specific tokens. The requests involve modification of or access to protected data, and the tokens are inserted by a state machine into content from which the requests are initiated. For example, content that includes a form, a hyperlink, a scripted request or other control for initiating a follow-on request to the server is modified to include tokens. The state machine may scan the content in real time (e.g., as it is served) to identify these controls and to insert the tokens. Using a state machine allows the content to be streamed even as it is scanned, does not require construction of a representation of the content (e.g., a DOM tree), and avoids modifying any of the content other than to insert one or more tokens.