Data request processing methods, apparatus, electronic devices and storage media

By extracting context information from relay nodes and reconstructing request data based on a whitelist to replace the source identity, business processing at relay nodes can be completed without leaking downstream user information. This resolves the contradiction between privacy leakage and business dependence in existing technologies, ensuring business integrity and privacy isolation.

CN123123025APending Publication Date: 2026-11-17HANGZHOU DBAPPSECURITY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611602225.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-16
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In interface relay or gateway proxy scenarios, existing technologies cannot completely prevent the leakage of non-whitelisted metadata to upstream services while ensuring the availability of internal business in relay nodes. Furthermore, existing solutions cannot cover newly added or variant fields, posing a risk of omission.

Method used

By extracting and storing the context information of the request data, new request data is generated based on the preset whitelist configuration, and the source identity is replaced with the unified site identity. At the same time, the response data is sent back using the context information, thereby achieving decoupling of upstream and downstream connections and whitelist reconstruction of request data.

Benefits of technology

Without disclosing downstream user information, the relay node can complete internal business processes such as authentication, billing, and response routing, achieving a balance between privacy protection and business availability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123025A_ABST
    Figure CN123123025A_ABST
Patent Text Reader

Abstract

This invention provides a data request processing method, apparatus, electronic device, and storage medium, belonging to the technical field of data processing. In this method, after receiving the first request data, its context information is extracted and stored locally, preventing downstream identity information from being transferred with subsequent requests. Simultaneously, the second request data is regenerated based on a preset whitelist configuration, explicitly limiting writing to fields within the whitelist; unlisted fields are not written by default rather than deleted afterward, cutting off the transmission path of unexpected metadata from the source. The source identity is then replaced with a unified site identity, ensuring the second node can only identify the relay node itself and cannot trace back to the specific first node. Finally, the locally stored context information is used to accurately transmit the response data back, thus maintaining a complete request-response business loop while completely isolating the downstream identity (i.e., the first node identity).
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a data request processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] Currently, in interface relay or gateway proxy scenarios, relay nodes typically use a combination of pass-through and partial rewriting to forward downstream requests to upstream services. However, this approach retains a large amount of header and context information from the original request by default. Even if authentication fields are replaced, the true identity and environment information of downstream users may still be leaked through network layer headers, proxy link identifiers, or custom business fields. If a blacklist deletion mechanism is used, it relies on manual enumeration, which is difficult to cover newly added or variant fields, posing a risk of omission. At the same time, excessive deletion may prevent relay nodes from completing internal business processing such as authentication, billing, and response routing.

[0003] Therefore, existing solutions are insufficient to completely prevent the leakage of non-whitelisted metadata to upstream services while ensuring the availability of internal business operations within transit nodes. Summary of the Invention

[0004] To address the issues of easy leakage of downstream user information and difficulty in balancing internal business processing at transit nodes with upstream privacy isolation in existing technologies, this invention provides a data request processing method to decouple upstream and downstream connections and reconstruct a whitelist of requested data, thereby preventing the leakage of sensitive information while ensuring the internal business loop.

[0005] In a first aspect, the present invention provides a data request processing method, the method comprising: Receive the first request data sent by the first node; Extract and store the context information of the first request data, the context information being used to characterize the identity attributes of the first node; The second request data is generated based on the preset whitelist configuration, wherein fields not included in the preset whitelist configuration are not written into the second request data; Replace the source identity of the second request data with the unified site identity, and send the second request data to the second node; The system receives the response data returned by the second node and sends the response data back to the first node based on the context information.

[0006] Further, the context information of the first request data is extracted and stored, including: Generate a request identifier corresponding to the first request data, the request identifier being used to associate the first request data, the second request data, and the response data; Extract the first node identifier, first node IP, first node authentication information, request model and billing parameters, response return relationship, first node source information, proxy link information, and business-defined user identifier from the first request data; Write the request identifier, the first node identifier, the first node IP, the first node authentication information, the request model and billing parameters, and the response return relationship into the downstream request context mapping table; Save the first node identifier, the first node IP, the first node authentication information, the first node source information, the proxy link information, and the service-customized user identifier to the internal context; The records in the downstream request context mapping table and the internal context together constitute the context information.

[0007] Furthermore, based on the preset whitelist configuration, second request data is generated, including: Create a new request object as the second request data, write the fields allowed by the preset whitelist configuration in the first request data into the request object, and refuse to copy fields in the first request data that are not included in the preset whitelist configuration.

[0008] Furthermore, the source identity of the second requested data is replaced with the unified site identity, including: Write the second node authentication credential held by the current executing entity into the second request data; Set the source identity of the second request data to at least one of the following: unified egress network address, unified organization identifier, unified business source identifier, or unified gateway identifier.

[0009] Further, sending the response data back to the first node based on the context information includes: Based on the request identifier associated with the response data, the downstream request context mapping table is queried to determine the response return relationship corresponding to the request identifier; The response data is sent back to the first node based on the established response feedback relationship.

[0010] Furthermore, the response data is streaming data; The response data is sent back to the first node according to the established response feedback relationship, including: The streaming data is continuously transmitted back to the connection channel corresponding to the response transmission relationship in data segments.

[0011] Furthermore, the method also includes: In response to the end of the request or the fulfillment of a preset timeout condition, the context information is cleaned up or archived according to a preset lifecycle strategy.

[0012] Secondly, the present invention also provides a data request processing apparatus, the apparatus comprising: The receiving unit is used to receive the first request data sent by the first node; An extraction and storage unit is used to extract and store context information of the first request data, wherein the context information is used to characterize the identity attributes of the first node; The generation unit is used to generate second request data based on a preset whitelist configuration, wherein fields not included in the preset whitelist configuration are not written into the second request data; The replacement and sending unit is used to replace the source identity of the second request data with the unified site identity and send the second request data to the second node. The receiving and sending unit is used to receive the response data returned by the second node and send the response data back to the first node based on the context information.

[0013] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the method described in the first aspect.

[0014] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the method described in the first aspect.

[0015] The present invention provides a data request processing method, comprising: receiving first request data sent by a first node; extracting and storing context information of the first request data, wherein the context information is used to characterize the identity attributes of the first node; generating second request data based on a preset whitelist configuration, wherein fields not included in the preset whitelist configuration are not written into the second request data; replacing the source identity of the second request data with a unified site identity, and sending the second request data to the second node; receiving response data returned by the second node, and sending the response data back to the first node based on the context information. As described above, in the data request processing method of the present invention, after receiving the first request data, its context information is extracted and stored locally, so that the downstream identity information is no longer transferred with subsequent requests; at the same time, the second request data is regenerated based on the preset whitelist configuration, and it is clearly limited that only fields in the whitelist are allowed to be written. Fields not listed are not written by default rather than being deleted afterward, thus cutting off the transmission path of unexpected metadata from the source of construction; then the source identity is replaced with a unified site identity, so that the second node can only identify the transit node itself and cannot trace the specific first node; finally, the response data is accurately sent back using the locally stored context information, thereby maintaining a complete request-response business closed loop under the premise of completely isolating the downstream identity (i.e., the first node identity). Attached Figure Description

[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 A flowchart of a data request processing method provided in an embodiment of the present invention; Figure 2 A schematic diagram of a data request processing device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0018] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] To facilitate understanding of this embodiment, a data request processing method disclosed in this embodiment of the invention will first be described in detail.

[0020] Example 1: like Figure 1 As shown, this embodiment provides a data request processing method. This method is applied to a relay node located between a first node and a second node, used to achieve privacy isolation between upstream and downstream connections while ensuring business continuity. The method includes the following steps: Step S100: Receive the first request data sent by the first node.

[0021] Specifically, the relay node, acting as an intermediate entity in the communication link, listens for and receives access requests from the first node. The first request data typically includes a service payload and metadata characterizing the first node's identity or environment, such as network layer headers, application layer authentication information, and custom service identifiers. In this embodiment, the first node can be the initiating terminal device, application server, or lower-level relay system, while the second node can be an upstream service interface or upper-level gateway providing specific service capabilities. It should be understood that the interaction architecture between the first and second nodes is not limited to a single node. In actual deployment, a relay node can simultaneously connect to multiple first nodes and multiple second nodes, forming a many-to-many mesh forwarding topology, as long as the functional requirements of data relay and privacy isolation are met.

[0022] Step S200: Extract and store the context information of the first request data. The context information is used to characterize the identity attributes of the first node.

[0023] Specifically, upon receiving the initial request data, the relay node does not forward it directly downstream. Instead, it first parses the identity and environmental characteristics carried within and stores this information in its local storage area. This contextual information encompasses all the key elements required for subsequent response feedback, internal authentication, billing auditing, and risk control tracking. This step ensures the first node's true identity information is stored and preserved within the relay node, preventing it from being transferred with subsequent data streams to the second node. Through this internal storage mechanism, the relay node establishes a local state independent of external communication links, providing a data foundation for completing the business loop without exposing the first node's identity.

[0024] Step S300: Generate second request data based on the preset whitelist configuration, wherein fields not included in the preset whitelist configuration are not written into the second request data.

[0025] Specifically, the relay node constructs a completely new request object as the second request data based on pre-configured whitelist rules. During this process, only fields explicitly allowed in the whitelist and necessary for the second node to process the business are written into this new object. Any fields present in the first request data but not whitelisted are not written by default during the construction phase, rather than being deleted or filtered after copying the original request. This whitelist reconstruction mechanism is fundamentally different from existing blacklist cleaning techniques: the former constructs a clean request from scratch, physically eliminating storage space for unexpected fields, thus completely eliminating the risk of accidental transmission due to incomplete field enumeration, protocol variations, or unknown headers; the latter relies on exhaustive deletion of known sensitive fields, easily overlooking newly added or non-standard fields. Through this step, the second request data contains only the minimum necessary information set to complete the business call, cutting off the transmission path of unauthorized metadata from the data construction source.

[0026] Step S400: Replace the source identity of the second request data with the unified site identity, and send the second request data to the second node.

[0027] Specifically, after constructing the second request data, the relay node uniformly sets its source identifier to its own site identity. This identity is the only legitimate caller identifier presented by the relay node to the second node. This replacement operation covers multiple dimensions, including network layer address, application layer authentication credentials, and business source identifier, ensuring that regardless of the protocol layer from which the second node identifies itself, it can only perceive the unified entity of the relay node and cannot penetrate to identify the specific first node behind it. Subsequently, the relay node initiates a call to the second node using this unified site identity. In this way, concurrent requests from multiple first nodes are aggregated into traffic from the same site from the second node's perspective, satisfying the second node's authentication and management needs for legitimate callers while completely masking the individual characteristics of the first nodes.

[0028] Step S500: Receive the response data returned by the second node, and send the response data back to the first node based on the context information.

[0029] Specifically, when the second node completes processing and returns response data, the relay node uses the context information stored in step S200 to determine the original first node and its connection channel corresponding to the response data, and accurately routes the response data back. Because the context information fully preserves the association between the request and response locally, the relay node can maintain the integrity and consistency of the request-response session even if the second request data does not contain any first node identifier. This reverse mapping mechanism decouples privacy protection from business availability: outward-sent requests are extremely concise and have a unified identity, while the internally retained state is sufficient to support complex routing and backhaul logic.

[0030] Through the coordinated execution of steps S100 to S500, this embodiment establishes the basic logic for the parallel operation of internal context storage and external whitelist reconstruction. This logic completely separates the identity attributes of the first node from the request data sent to the second node, both logically and physically. This allows the relay node to complete core business functions such as authentication, billing, and response routing without exposing the downstream identity. This resolves the contradiction between privacy leakage and business dependence in traditional transparent transmission schemes and provides a basic framework for further refinement of the context structure, reconstruction details, and response processing methods in subsequent embodiments.

[0031] Based on the above, this embodiment further refines the specific implementation method for extracting and storing the context information of the first request data. As one implementation method, extracting and storing the context information of the first request data includes: generating a request identifier corresponding to the first request data; extracting the first node identifier, first node IP, first node authentication information, request model and billing parameters, response return relationship, first node source information, proxy link information, and business-defined user identifier from the first request data; writing the request identifier, first node identifier, first node IP, first node authentication information, request model and billing parameters, and response return relationship into a downstream request context mapping table; and saving the first node identifier, first node IP, first node authentication information, first node source information, proxy link information, and business-defined user identifier into an internal context; wherein, the records in the downstream request context mapping table and the internal context together constitute the context information.

[0032] Specifically, the request identifier serves as the unique link connecting upstream and downstream requests, and its generation logic must ensure global uniqueness within the processing cycle of the current relay node. For example, it can use a UUID (Universally Unique Identifier), a long integer ID generated by the Snowflake algorithm, or a string composed of a timestamp, node number, and an auto-incrementing sequence. This request identifier circulates only within the relay node, used to associate the first request data with subsequent second request data and response data. It will never be written into the second request data sent to the second node, thus avoiding the risk of exposing the internal processing status or the identity of the first node due to identifier pass-through.

[0033] The downstream request context mapping table primarily carries key fields required to support business continuity and core transaction logic. Specifically, the first-node identifier distinguishes different callers internally, supporting multi-tenant isolation and permission verification; the first-node IP is used for executing internal risk control policies, such as frequency limits, regional blocking, or abnormal access detection; first-node authentication information is typically stored in digest or encrypted form to verify the legitimacy of the first node and subsequent quota deductions, avoiding security risks caused by plaintext tokens residing in memory for extended periods; the request model and billing parameters directly determine the call cost and quota consumption of upstream services, serving as the basis for internal billing generation and balance management, with necessary business fields entering the second request data; and the response return relationship records the connection handle, session ID, or callback address when the first node initiated the request, ensuring that response data can be accurately routed back to the original initiator. Although these fields contain sensitive information, they are essential for business processing and are therefore included in a controlled mapping table for structured storage, enabling rapid indexing and updates.

[0034] The internal context focuses on isolating sensitive metadata that purely characterizes the individual features of the first node and does not substantially help the second node complete business calls. This includes first node origin information (such as User-Agent, Referer, Origin, etc.), which often exposes the client's device type, operating system version, or page origin; proxy link information (such as X-Forwarded-For, X-Real-IP, Via headers, etc.), revealing the network path and intermediate nodes traversed by the request; and business-defined user identifiers (such as tenant ID, internal employee number, debugging flags, etc.), reflecting the first node's identity attributes within its own business system. Storing these fields separately in the internal context rather than the mapping table (i.e., the downstream request context mapping table) serves two purposes: firstly, to provide complete data support when tracing issues, auditing compliance, or conducting in-depth risk control analysis; and secondly, to separate them from the frequently accessed business mapping table at the physical storage level, reducing the probability of privacy exposure due to mapping table cache leaks or log printing.

[0035] Through this dual-track storage structure, this embodiment achieves refined hierarchical management of context information. The downstream request context mapping table, as a hot data carrier, ensures the efficient operation of core business functions such as authentication, billing, auditing, routing, risk control, and access control. The internal context, as a cold data or audit data carrier, maximizes the exposure of sensitive information while meeting compliance and operational requirements. Together, they constitute a complete context information system, enabling relay nodes to completely strip away the individual characteristics of the first node when sending requests externally, while having sufficient information support when processing business internally, thus effectively solving the balance problem between privacy protection and business availability. It should be understood that the above field division is only an exemplary implementation. In practical applications, the fields to be included in the mapping table and the fields to be included in the internal context can be flexibly adjusted according to specific business scenarios and security compliance requirements, as long as the principle of controlled storage of business-necessary fields and isolated storage of non-essential sensitive fields is followed.

[0036] Based on the above, this embodiment further refines the specific implementation of generating second request data based on a preset whitelist configuration. As one implementation method, generating second request data based on a preset whitelist configuration includes: creating a new request object as the second request data, writing fields allowed by the preset whitelist configuration in the first request data into the request object, and refusing to copy fields from the first request data that are not included in the preset whitelist configuration.

[0037] Specifically, when the relay node performs request reconstruction, it does not modify, delete, or filter the original memory object corresponding to the received first request data. Instead, it allocates a completely new storage space in memory and instantiates an independent request object as the second request data. This new object, in its initial state, does not contain any fields or header information from the first request data; it is a pure data container. Subsequently, the system actively extracts the corresponding values ​​from the first request data according to the allowed field list defined in the preset whitelist configuration and serializes and writes them into the newly created request object. For example, the whitelist configuration typically includes necessary protocol headers such as Content-Type and Accept, as well as business call parameters such as model name, prompt word content, temperature parameters, and maximum token count. Only fields explicitly whitelisted are written to the new object; any other fields present in the first request data but not whitelisted are skipped during the construction process, neither read nor written.

[0038] This rejection of copying has a clear physical meaning: the final generated second request data's memory structure does not contain any unauthorized field entities, rather than these fields being copied to a new object and then erased or set to null. In contrast, common blacklist removal mechanisms in existing technologies identify and remove sensitive fields based on the original request object. This approach heavily relies on a complete enumeration of known sensitive fields. If new headers added during protocol upgrades, client-defined non-standard fields, or debug flags automatically injected by multi-level proxies are not updated to the blacklist in time, these fields will be passed through to the second node with the request, causing privacy leaks. The whitelist reconstruction mechanism used in this embodiment changes the security boundary from removing known risks as much as possible to only allowing known security, naturally isolating any unauthorized metadata at the physical level. This completely eliminates the risk of accidental transmission due to incomplete field enumeration or unknown variants, ensuring that the request data sent to the second node only contains the minimum set of information necessary to complete the business. It should be understood that although this embodiment uses an HTTP request object as an example for illustration, in other communication protocol scenarios, such as gRPC, WebSocket, or private binary protocols, as long as the construction logic of creating a new carrier and filling in the whitelist is followed, it falls within the protection scope of this invention.

[0039] Based on the above, this embodiment further refines the specific implementation dimensions of replacing the source identity of the second request data with a unified site identity. As one implementation method, replacing the source identity of the second request data with a unified site identity includes: writing the second node authentication credential held by the current executing entity into the second request data; and setting the source identity of the second request data to at least one of a unified egress network address, a unified organization identifier, a unified business source identifier, or a unified gateway identifier.

[0040] Specifically, identity replacement is not a simple overwriting of a single field, but a multi-dimensional reconstruction encompassing the network transport layer and application protocol layer. First, regarding writing the second-node authentication credentials held by the current executing entity into the second request data, the current executing entity specifically refers to the relay node itself, not the first node initiating the request. This means that the relay node must replace the original authentication information carried in the first request data with legitimate credentials that it has pre-applied for and independently managed from the second node. For example, this authentication credential could be a relay node-specific API Key, OAuth Access Token, or digital certificate signature. Through this operation, when the second node performs authentication verification, it verifies the legitimacy and quota status of the relay node, thereby cutting off the possibility of the second node using the original credentials to reverse-associate the identity of the first node. It also allows concurrent requests from multiple first nodes to share the unified calling permissions of the relay node.

[0041] Secondly, regarding the specific settings for the source identity, this embodiment provides multiple optional dimensions to adapt to different protocol environments and privacy protection needs. The unified egress network address refers to the fixed public IP address or an address from a virtual IP address pool used by the relay node for external communication. Regardless of the first node's real IP address, the second node can only observe this unified egress address in network layer packet captures or log records, thus achieving network-level identity anonymity. The unified organization identifier is typically used in the second node service of a multi-tenant architecture, manifested as a specific Organization ID, Tenant ID, or Account ID, indicating that the request belongs to the unified organization entity registered by the relay node, rather than the individual organization to which the first node belongs. The unified business source identifier focuses on application-level traffic marking, such as a unified User-Agent string, a specific Project ID, App ID, or a custom X-Source-Type header field, used to inform the second node that the request comes from a standardized business access channel. The unified gateway identifier is an infrastructure-level identity marker, such as Gateway-ID, Cluster-Name, or Edge-Node-Token, used to identify that the request has passed through a specific gateway cluster or edge node.

[0042] In practical deployments, the aforementioned identifiers can be used individually or in combination according to the interface specifications and security policies of the second node. For example, in a typical HTTP API call scenario, a relay node can simultaneously configure a unified egress IP as the source address, write its own API Key in the Authorization header, and add a unified Gateway-ID in a custom header. This multi-dimensional combination and replacement mechanism constructs a defense-in-depth system: even if the identifier of one dimension is partially exposed or parsed due to protocol characteristics, the unified identifiers of other dimensions can still maintain the overall consistency of the site identity, preventing the second node from inferring the individual characteristics of the first node through cross-validation. Simultaneously, since all replaced identifiers conform to the second node's expected format and value range for legitimate callers, they will not trigger risk control interception or authentication failure by the second node, ensuring business connectivity and management compliance under strict privacy isolation. It should be understood that the identifier types listed above are merely examples; any identifier form that can converge the individual characteristics of the first node into a unified characteristic of the relay node can be included within the scope of protection of this invention.

[0043] Based on the above, this embodiment further refines the specific implementation mechanism for sending response data back to the first node based on context information. As one implementation method, sending response data back to the first node based on context information includes: querying the downstream request context mapping table based on the request identifier associated with the response data to determine the response return relationship corresponding to the request identifier; and sending the response data back to the first node through the determined response return relationship.

[0044] Specifically, the aforementioned reverse mapping process is triggered only when the relay node receives response data from the second node. It's important to note that since the first node's identity has been completely stripped from the second request data sent to the second node, the response data returned by the second node typically does not directly contain explicit fields pointing to the first node. The request identifier associated with the response data here does not mean that the identifier is embedded within the response data packet, but rather that the relay node has internally established a temporary binding relationship between the upstream communication connection and the request identifier when sending the second request data. For example, when initiating an HTTP request, the relay node can bind the generated request identifier to the current asynchronous I / O coroutine, socket handle, HTTP / 2 Stream ID, or a custom session context. When the response data returns via this upstream communication connection, the relay node can read the binding state of that connection to extract the corresponding request identifier, thereby establishing a logical association between the response data and the original request.

[0045] After obtaining the request identifier, the relay node uses it as an index key to query the locally stored downstream request context mapping table. Since this mapping table has fully recorded the response return relationship corresponding to each request identifier in step S200, the system can accurately locate the downstream connection channel established when the first node initiated the request. This response return relationship can take various forms in its implementation, such as a TCP long-connection Socket file descriptor, a WebSocket session object, a gRPC bidirectional stream channel, or a callback address and routing key in a message queue. Regardless of changes in the underlying transport protocol, as long as this relationship can uniquely identify a data path to the first node, it can serve as the basis for return.

[0046] Subsequently, the relay node uses the established response feedback relationship to write the received response data into the corresponding downstream connection channel, completing the physical data feedback. This process is completed entirely within a closed loop within the relay node. For the second node, it merely returns the processing result to a legitimate caller (i.e., the unified site identity of the relay node), neither knowing nor needing to know which specific first node the result was ultimately delivered to. This design fundamentally decouples the upstream response reception and downstream response delivery actions, enabling the relay node to maintain strict privacy boundaries while ensuring the integrity and reliability of the request-response session. Even in high-concurrency scenarios with tens of thousands of concurrent first-node requests, the relay node can accurately route each response data back to the original initiator based on the deterministic association between the request identifier and the mapping table, effectively avoiding response errors or loss due to identity anonymity. This demonstrates that the technical solution of this invention achieves privacy protection without sacrificing the availability of business functions.

[0047] Based on the above, this embodiment further processes the special form of the response data. As one implementation, the response data is streaming data; the response data is transmitted back to the first node according to a defined response transmission relationship, including: continuously transmitting the streaming data in data segments to the connection channel corresponding to the response transmission relationship.

[0048] Specifically, in real-time interactive scenarios such as large-scale API calls, the response returned by the second node is often not a complete data packet delivered all at once, but rather generated and sent gradually in the form of streaming data. This streaming data typically follows protocol specifications such as Server-Sent Events (SSE), HTTP Chunked Transfer Encoding, or WebSocket binary frames. Its characteristic is that the data is divided into multiple independent data fragments, arriving at the relay node sequentially in time sequence. For this type of data, the relay node cannot use the traditional receive-buffer-forward model, otherwise it will lead to significant initial delays and interactive stuttering, severely impacting the user experience. Therefore, this embodiment adopts a processing logic of continuous data fragment backhaul. That is, when the relay node detects the arrival of each data fragment in the upstream connection, it immediately writes it into the downstream connection channel determined by the response backhaul relationship, achieving a near real-time transparent transmission effect. During this process, the relay node only performs necessary protocol adaptation or format verification on the data fragments, without parsing or reassembling their content, thus ensuring the low-latency characteristics of streaming transmission.

[0049] More importantly, to support the aforementioned continuous return mechanism, the mapping relationship between the request identifier and the downstream connection channel must remain stable throughout the entire streaming lifecycle. Unlike ordinary requests, which release mapped resources after a single response, streaming data transmission is a continuous process that may span several seconds or even minutes. During this time period, regardless of how many data segments the second node sends, or whether there are network jitters or brief periods of silence, the relay node must ensure that the response return relationship corresponding to the request identifier remains valid and points to the correct first node connection. Only when a clear stream end marker is detected (such as the [done] message in SSE, a zero-length block in a chunked transmission, or a connection close signal), or when a preset timeout / abnormal interruption condition is triggered, will the system release the mapping relationship and clean up the related resources. This persistent maintenance of the mapping relationship ensures that in long-term streaming interactions, every subsequent data segment can be accurately routed to the original initiator, avoiding response interruptions or errors due to lost mappings.

[0050] Furthermore, the streaming processing mechanism in this embodiment also strictly adheres to the principle of privacy isolation. During the continuous backhaul of streaming data in segments, the relay node does not inject the identity information of the first node into any data segment, nor does it relax the whitelist verification standards due to the special nature of streaming transmission. Instead, since streaming data is typically transmitted based on established unified site identity connections, it naturally inherits the anonymity of the upstream connection. This means that even if a second node attempts to infer downstream users by analyzing the content or temporal characteristics of the streaming data, it cannot obtain any valid information beyond the unified identity of the relay node. In this way, this embodiment ensures the extreme real-time performance and smoothness required for applications such as large models without sacrificing any degree of privacy and security, achieving perfect compatibility between business performance and data protection. It should be understood that although this embodiment mainly uses SSE streaming in a text generation scenario as an example, for speech synthesis, video streaming, or any other business scenario using segmented transmission technology, as long as the technical essence of continuous backhaul in segments and maintaining the mapping relationship is met, it falls within the protection scope of this invention.

[0051] Building upon the above, this embodiment further supplements the security management of context information. As one implementation method, in response to the end of a request or the fulfillment of a preset timeout condition, context information is cleaned up or archived according to a preset lifecycle strategy.

[0052] Specifically, while context information is indispensable for ensuring a closed business loop, it contains the identity attributes and sensitive environmental data of the first node. Indefinite retention within intermediate nodes poses potential data security risks and compliance vulnerabilities. Therefore, this embodiment introduces a clear lifecycle management mechanism to ensure that context information exists only within the necessary time window required for business processing. The conditions for triggering cleanup or archiving mainly include two categories: first, request termination. This refers not only to the normal workflow termination state where the second node returns a complete response and the intermediate node successfully transmits it back to the first node, but also to abnormal interruption states caused by network disconnection, authentication failure, quota exhaustion, or upstream service rejection; second, meeting preset timeout conditions. For example, during streaming data transmission, if no new data fragment is received for a predetermined period, or if the first node fails to send a valid request for a long time after establishing a connection, the system will determine it as a timeout and trigger processing logic. This dual-trigger mechanism ensures that context information is handled promptly in both normal business processes and abnormal edge scenarios, avoiding data residue caused by process crashes or logical deadlocks.

[0053] The specific form of the preset lifecycle policy can be configured differently according to the type of context information and business needs. For high-frequency access data stored in memory, such as response return relationships and temporary request identifiers used for real-time routing, the policy is usually set to release memory immediately. That is, at the moment the request is completed or a timeout is determined, the relevant objects are cleared through garbage collection mechanisms or explicit destruction instructions to release resources as quickly as possible and eliminate the risk of memory dump leakage. For downstream request context mapping table records stored in databases or cache systems, the policy can adopt the method of setting a time-to-live (TTL) expiration, so that the records will automatically expire and be deleted after a fixed period of time after creation. This method ensures data availability during concurrent processing and avoids the complexity of manual cleanup logic. For internal context information involving billing audit, compliance traceability, or fault diagnosis, the policy can be configured to asynchronously archive to cold storage, that is, migrate it from the online production environment to a low-cost medium with restricted access and encryption, and set a longer retention period or permanent storage to meet the mandatory requirements of laws and regulations for transaction log retention, while physically isolating it from the high-risk online service environment.

[0054] Through the aforementioned lifecycle management strategy, this invention achieves key enhancements in data security defense in depth. On the one hand, timely cleanup of no longer needed context information effectively prevents memory overflow or performance degradation caused by state accumulation at relay nodes, ensuring the long-term stable operation of the system. On the other hand, shortening the residence time of sensitive data in the production environment directly reduces secondary privacy risks caused by system intrusion, theft of memory snapshots, or accidental leakage of operation and maintenance logs. Even if attackers breach the outer defenses, the effective context information they can obtain is limited to active requests within a very short time window, making it impossible to trace back historical user behavior or steal identity data in bulk. Furthermore, the differentiated archiving strategy enables relay nodes to meet strict privacy protection standards while also taking into account the business needs of financial settlement and compliance auditing. This demonstrates that the technical solution of this invention does not sacrifice operability for security, but rather achieves a dynamic balance between privacy protection and business compliance through refined data governance. It should be understood that the above strategies are merely illustrative examples. In actual deployment, the trigger threshold, retention period, and archiving method can be flexibly adjusted according to the specific laws and regulations of the jurisdiction, industry security standards, or the company's internal risk control policies. As long as the principle of minimizing retention and timely disposal is followed, they all fall within the protection scope of this invention.

[0055] Example 2: This invention also provides a data request processing device, which is mainly used to execute the data request processing method provided in Embodiment 1 of this invention. The following is a detailed description of the data request processing device provided in this invention.

[0056] Figure 2 This is a schematic diagram of a data request processing apparatus according to an embodiment of the present invention, such as... Figure 2 As shown, the device mainly includes: a receiving unit 10, an extraction and storage unit 20, a generation unit 30, a replacement and transmission unit 40, and a receiving and transmission unit 50, wherein: The receiving unit is used to receive the first request data sent by the first node; The extraction and storage unit is used to extract and store the context information of the first request data. The context information is used to characterize the identity attributes of the first node. The generation unit is used to generate second request data based on a preset whitelist configuration, wherein fields not included in the preset whitelist configuration are not written into the second request data; The replacement and sending unit is used to replace the source identity of the second request data with the unified site identity and send the second request data to the second node. The receiving and sending unit is used to receive the response data returned by the second node and send the response data back to the first node based on the context information.

[0057] Optionally, the extraction and storage unit is further configured to: generate a request identifier corresponding to the first request data, the request identifier being used to associate the first request data, the second request data, and the response data; extract the first node identifier, first node IP, first node authentication information, request model and billing parameters, response return relationship, first node source information, proxy link information, and business-defined user identifier from the first request data; write the request identifier, first node identifier, first node IP, first node authentication information, request model and billing parameters, and response return relationship into the downstream request context mapping table; and save the first node identifier, first node IP, first node authentication information, first node source information, proxy link information, and business-defined user identifier into the internal context; wherein, the records in the downstream request context mapping table and the internal context together constitute the context information.

[0058] Optionally, the generation unit is also configured to: create a new request object as second request data, write fields allowed by the preset whitelist configuration in the first request data into the request object, and refuse to copy fields not included in the preset whitelist configuration in the first request data.

[0059] Optionally, the replacement and sending unit is also used to: write the second node authentication credential held by the current executing entity into the second request data; and set the source identity of the second request data to at least one of the unified egress network address, unified organization identifier, unified business source identifier, or unified gateway identifier.

[0060] Optionally, the receiving and sending unit is also used to: query the downstream request context mapping table based on the request identifier associated with the response data, determine the response sending relationship corresponding to the request identifier, and send the response data back to the first node through the determined response sending relationship.

[0061] Optionally, the response data is streaming data; the receiving and transmission unit is also used to: continuously transmit the streaming data in data segments to the connection channel corresponding to the response transmission relationship.

[0062] Optionally, the device is also used to: clean up or archive the context information according to a preset lifecycle strategy in response to the end of the request or the satisfaction of a preset timeout condition.

[0063] The device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0064] like Figure 3As shown in the embodiment of this application, an electronic device 600 includes a processor 601, a memory 602, and a bus. The memory 602 stores machine-readable instructions executable by the processor 601. When the electronic device is running, the processor 601 communicates with the memory 602 via the bus, and the processor 601 executes the machine-readable instructions to perform the steps of the data request processing method described above.

[0065] Specifically, the memory 602 and processor 601 mentioned above can be general-purpose memory and processor, without any specific limitations. When the processor 601 runs the computer program stored in the memory 602, it can execute the data request processing method mentioned above.

[0066] The processor 601 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 601 or by instructions in software form. The processor 601 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 602, and processor 601 reads the information from memory 602 and, in conjunction with its hardware, completes the steps of the above method.

[0067] Corresponding to the above data request processing method, this application embodiment also provides a computer-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to perform the steps of the above data request processing method.

[0068] The data request processing apparatus provided in this application embodiment can be specific hardware on a device or software or firmware installed on the device. The implementation principle and technical effects of the apparatus provided in this application embodiment are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the apparatus embodiment can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, apparatuses, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.

[0069] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0070] For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0071] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0072] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0073] If the aforementioned function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the data request processing method described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0074] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0075] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A data request processing method, characterized in that, The method includes: Receive the first request data sent by the first node; Extract and store the context information of the first request data, the context information being used to characterize the identity attributes of the first node; The second request data is generated based on the preset whitelist configuration, wherein fields not included in the preset whitelist configuration are not written into the second request data; Replace the source identity of the second request data with the unified site identity, and send the second request data to the second node; The system receives the response data returned by the second node and sends the response data back to the first node based on the context information.

2. The method according to claim 1, characterized in that, Extract and store the context information of the first request data, including: Generate a request identifier corresponding to the first request data, the request identifier being used to associate the first request data, the second request data, and the response data; Extract the first node identifier, first node IP, first node authentication information, request model and billing parameters, response return relationship, first node source information, proxy link information, and business-defined user identifier from the first request data; Write the request identifier, the first node identifier, the first node IP, the first node authentication information, the request model and billing parameters, and the response return relationship into the downstream request context mapping table; Save the first node identifier, the first node IP, the first node authentication information, the first node source information, the proxy link information, and the service-customized user identifier to the internal context; The records in the downstream request context mapping table and the internal context together constitute the context information.

3. The method according to claim 1, characterized in that, The second request data is generated based on the preset whitelist configuration, including: Create a new request object as the second request data, write the fields allowed by the preset whitelist configuration in the first request data into the request object, and refuse to copy fields in the first request data that are not included in the preset whitelist configuration.

4. The method according to claim 1, characterized in that, Replace the source identity of the second requested data with the unified site identity, including: Write the second node authentication credential held by the current executing entity into the second request data; Set the source identity of the second request data to at least one of the following: unified egress network address, unified organization identifier, unified business source identifier, or unified gateway identifier.

5. The method according to claim 2, characterized in that, Based on the context information, the response data is sent back to the first node, including: Based on the request identifier associated with the response data, the downstream request context mapping table is queried to determine the response return relationship corresponding to the request identifier; The response data is sent back to the first node based on the established response feedback relationship.

6. The method according to claim 5, characterized in that, The response data is streaming data; The response data is sent back to the first node according to the established response feedback relationship, including: The streaming data is continuously transmitted back to the connection channel corresponding to the response transmission relationship in data segments.

7. The method according to claim 1, characterized in that, The method further includes: In response to the end of the request or the fulfillment of a preset timeout condition, the context information is cleaned up or archived according to a preset lifecycle strategy.

8. A data request processing apparatus, characterized in that, The device includes: The receiving unit is used to receive the first request data sent by the first node; An extraction and storage unit is used to extract and store context information of the first request data, wherein the context information is used to characterize the identity attributes of the first node; The generation unit is used to generate second request data based on a preset whitelist configuration, wherein fields not included in the preset whitelist configuration are not written into the second request data; The replacement and sending unit is used to replace the source identity of the second request data with the unified site identity and send the second request data to the second node. The receiving and sending unit is used to receive the response data returned by the second node and send the response data back to the first node based on the context information.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the method of any one of claims 1 to 7.