A method and system for dynamic derivation of front-end runtime interface signature keys

By splitting the master signature key into multiple fragments and dynamically deriving signature keys based on runtime context features, the problems of easy leakage and cross-environment forgery of statically stored interface signature keys are solved, thereby improving system security and performance.

CN123184833APending Publication Date: 2026-11-27WUHAN FIBERHOME DIGITAL TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611479044.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-22
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, static storage of interface signature keys is prone to leakage, cross-environment forgery is difficult to prevent, gateway signature verification suffers significant performance loss, key management has coarse granularity, and lacks hierarchical protection capabilities.

Method used

The master signing key is split into multiple key fragments, which are bound to the front-end business routes through the Shamir secret sharing algorithm. The signing key is dynamically derived by combining runtime context features, and two-layer collaborative verification is performed on the server side.

Benefits of technology

Reduce the risk of key leakage, eliminate cross-environment forgery, improve system performance, and achieve hierarchical protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123184833A_ABST
    Figure CN123184833A_ABST
Patent Text Reader

Abstract

The application discloses a front-end runtime interface signature key dynamic derivation method and system, the method comprises the following steps: constructing a period analysis front-end routing tree, splitting the main key into multiple routing binding fragments by using a secret sharing algorithm, injecting corresponding component code through abstract syntax tree (AST) confusion, and generating encrypted mapping metadata; collecting normalized routing, component life cycle, DOM structure hash, and navigation source four-dimensional context features as salt values, dynamically deriving an effective signature key and generating an environment proof field; on the gateway side, first, performing lightweight context legality verification to quickly intercept illegal requests, and then, performing signature verification of the same origin algorithm to form a double-layer verification closed loop. The application solves the security defects of traditional static keys, such as easy leakage and easy forgery in cross-environment, and is suitable for interface security protection of a business system with a front-end and back-end separation architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the cross-technical fields of Web front-end security, interface authentication and microservice gateway security protection, and in particular to a method and system for dynamically deriving interface signature keys based on the front-end runtime. Background Technology

[0002] In existing front-end and back-end separated projects, API signing is a standard method to prevent request tampering and replay attacks. The conventional approach is to hard-code the signing key in the front-end code or load the signing key (SecretKey) through a configuration file, and then perform a hash operation based on the URL, parameters, timestamp, etc.

[0003] However, existing technologies have the following significant drawbacks in practical applications:

[0004] First, static key storage poses a high risk of single-point leakage. Regardless of the code obfuscation or encryption storage methods used, the signing key must be loaded into memory in plaintext form during browser runtime to participate in computation. Attackers can easily extract the complete key through browser debugging tools and reverse engineering the packaged JS code. Furthermore, the key is centrally stored in configuration files or global constants, meaning that the entire key can be obtained by cracking only one point, making the protection threshold extremely low.

[0005] Second, the decoupling of signatures from the runtime environment makes them vulnerable to cross-environment forgery. Traditional signatures only verify the integrity of the request data, not the legitimacy of the environment in which the request was initiated. Once the key is leaked, attackers can forge fully compliant signature requests in any illegitimate environment (such as malicious scripts or third-party packet sniffing tools). The backend cannot identify the authenticity of the request source, rendering the protection mechanism completely ineffective.

[0006] Third, the gateway signature verification architecture is simplistic and suffers from significant performance overhead. In existing solutions, the gateway performs a complete hash signature verification operation on all requests. A large number of illegal and forged requests also consume the gateway's computing resources, making it impossible to quickly intercept invalid requests before performing complex calculations. This results in high gateway performance overhead and affects the overall system throughput.

[0007] Fourth, the key management is coarse-grained and lacks hierarchical protection capabilities. Existing solutions generally use a globally unified key, which cannot achieve differentiated key constraints based on routing and page. Business interfaces with different security levels share the same key, and highly sensitive interfaces cannot obtain targeted high-strength protection, resulting in insufficient security adaptability.

[0008] Therefore, there is an urgent need for a method and system for dynamic derivation of interface signature keys that can deeply bind the signature key to the front-end runtime environment, realize dynamic key derivation, and combine high security and high performance. Summary of the Invention

[0009] The present invention aims to solve at least one of the technical problems existing in the prior art, and proposes a method and system for dynamic derivation of signature keys based on front-end runtime interface.

[0010] In a first aspect, embodiments of the present invention provide a method for dynamically deriving a signature key based on a front-end runtime interface, comprising:

[0011] S100. Parse the routing configuration file of the front-end project, filter business routes and build a business route tree; split the master signature key into a set of key fragments that are bound to each business route; inject each key fragment into the source code of the corresponding route component to generate encrypted route-fragment mapping metadata;

[0012] S200. When the front-end page initiates an interface request, the request interceptor captures the request and collects the runtime context feature vector of the current page; according to the current route, it matches the corresponding key fragment set from the route-fragment mapping metadata, executes the key derivation algorithm with the runtime context feature vector as the salt value, and restores the derived signature key; it uses the derived signature key to perform a hash operation on the request data to generate a request signature, and at the same time generates an environment proof field, and attaches the signature and environment proof field to the request header and sends them to the server;

[0013] After receiving the request, the S300 server performs a two-layer collaborative verification according to preset rules. Once both layers of collaborative verification pass, the request is forwarded to the downstream business microservice.

[0014] Furthermore, in S100, the master signature key is split into a set of key fragments using the Shamir secret sharing algorithm. The specific method includes: setting the minimum fragment threshold t required to restore the key, splitting the master key into n key fragments, where n≥t; binding multiple key fragments to high-privilege service routes, and binding a single key fragment to ordinary service routes.

[0015] Furthermore, in S100, through Abstract Syntax Tree (AST) transformation, each key fragment is injected into the source code of the corresponding routing component in an obfuscated form. Specific methods include:

[0016] Key fragments are embedded as local constants within the business functions of the routing component, and are not defined as global variables; dead code, nested conditional branches, and random strings are inserted at the injection point for obfuscation; the variable names corresponding to the fragments are named using random hashes and do not contain key-related identifier keywords; constant folding optimization is performed during the compilation stage so that key fragments can directly participate in the calculation without independent assignment statements.

[0017] Furthermore, in S100, when parsing front-end routes, static resource routes and fallback routes are filtered out, and key fragments are bound only to business routes associated with business interfaces; standardized route identifiers are output, and the path case and slash format are unified.

[0018] Furthermore, in S200, the runtime context feature vector includes four dimensions: normalized route path, component lifecycle encoding value, core DOM structure hash value, and navigation source identifier; wherein:

[0019] The normalized routing path is the logical path of the current route, which is different from the physical URL in the browser address bar;

[0020] The component lifecycle encoding value is the encoding identifier of the lifecycle stage of the current routing component;

[0021] The core DOM structure hash value is a lightweight hash value of the core business DOM node structure of the page.

[0022] The navigation source identifier is a combination of the previous level routing path and the page jump method.

[0023] Furthermore, in S200, the method for collecting the hash value of the core DOM structure is as follows:

[0024] Perform DOM hash calculation in the asynchronous callback of requestAnimationFrame, with a random delay within a preset range; detect the browser developer tools being enabled and breakpoint debugging behavior in real time, and actively tamper with the DOM hash value if debugging behavior is captured, so that the key derivation result is invalid; only collect the core business DOM structure of the form and query area, excluding third-party components and dynamic advertising nodes.

[0025] Furthermore, in S200, the execution steps of the key derivation algorithm include:

[0026] The runtime context feature vector is serialized into a fixed format string and then SHA256 is used to obtain the environment salt value.

[0027] The matched key fragment set is concatenated and then subjected to a multi-level iterative hash operation with the environmental salt value;

[0028] Output a fixed-length derived signature key for signature operations; if the context feature vector is abnormal, output an invalid key of illegal length, and the signature verification will automatically fail.

[0029] Furthermore, after receiving the request, the S300 server performs a two-layer collaborative verification according to preset rules. The specific methods include: performing the first layer of context validity verification: matching the preset route-context whitelist graph according to the request route, and verifying whether the environment proof field carried in the request corresponds to a valid operating context; if the verification fails, the request is directly rejected; if the verification passes, performing the second layer of signature verification: generating the expected signature based on the key material corresponding to the current route using the same key derivation algorithm as the front end, and comparing it with the signature carried in the request; if the comparison passes, the request is forwarded to the downstream business service; if the comparison fails, the request is rejected.

[0030] Furthermore, before performing the second signature verification, the validity of the timestamp carried in the request and the uniqueness of the Nonce value are verified first. Specific methods include:

[0031] Set a preset time window. If the request timestamp exceeds the time window, it is judged as a replay attack and rejected directly. Check whether the Nonce value already exists in the cache. If it exists, it is judged as a replay attack and rejected directly. If it does not exist, write the Nonce value into the cache and retain it for a preset time.

[0032] Secondly, this invention also discloses a dynamic signature key derivation system based on a front-end runtime interface, comprising: a construction-stage key fragmentation injection module, a front-end runtime key derivation module, and a gateway two-layer signature verification module; wherein:

[0033] The build-time key fragmentation injection module is used to parse the routing configuration file of the front-end project, filter business routes and build a business route tree; split the master signature key into a set of key fragments that are bound to each business route; inject each key fragment into the source code of the corresponding route component to generate encrypted route-fragment mapping metadata;

[0034] The front-end runtime key derivation module is used when the front-end page initiates an interface request. The request interceptor captures the request and collects the runtime context feature vector of the current page. Based on the current route, it matches the corresponding key fragment set from the route-fragment mapping metadata, executes the key derivation algorithm with the runtime context feature vector as the salt, and restores the derived signature key. The derived signature key is used to perform a hash operation on the request data to generate a request signature, and an environment proof field is generated at the same time. The signature and environment proof field are appended to the request header and sent to the server.

[0035] The gateway's two-layer signature verification module is used to perform two-layer collaborative verification according to preset rules after the server receives a request. After both layers of collaborative verification pass, the request is forwarded to the downstream business microservice.

[0036] This invention discloses a method and system for dynamically deriving interface signature keys based on front-end runtime context awareness. The method includes: parsing the front-end routing tree during the construction phase, splitting the master key into multiple route binding fragments using a secret sharing algorithm, injecting corresponding component code through Abstract Syntax Tree (AST) obfuscation, and generating encrypted mapping metadata; collecting four-dimensional context features—normalized routes, component lifecycles, DOM structure hashes, and navigation source—as salt values ​​during front-end runtime, dynamically deriving a valid signature key, and generating an environment proof field; and performing lightweight context validity verification to quickly intercept illegal requests on the gateway side, followed by signature verification using a same-origin algorithm, forming a two-layer verification closed loop. This invention solves the security defects of traditional static keys, such as easy leakage and cross-environment forgery, and is suitable for interface security protection of business systems with front-end and back-end separation architectures.

[0037] Compared with the prior art, the present invention has the following beneficial effects:

[0038] 1. Fragmented and distributed key storage reduces the risk of leakage at the source. This invention splits the complete master key into multiple fragments and injects them into the business code of different routing components. There is no globally unified complete key storage point in the system. Even if a fragment of a single route is extracted, the complete key cannot be recovered, which greatly increases the technical threshold for key cracking.

[0039] 2. The key is deeply bound to the runtime environment, preventing cross-environment forgery attacks. This invention uses the page runtime context characteristics as a necessary input parameter for key derivation. Only under a legitimate page environment, the correct lifecycle stage, and a compliant navigation path can a valid key be derived. Even if key fragments are stolen, a valid signature cannot be generated in an illegitimate runtime environment, thus solving the problem of forged requests after key leakage from a fundamental mechanism perspective.

[0040] 3. A two-layer verification architecture balances security and performance. The gateway in this invention first performs context verification through lightweight hash comparison, quickly intercepting the vast majority of illegal requests. Complex signature calculations are only performed on requests that pass context verification. This enhances security while effectively reducing the gateway's computational power consumption and improving overall system throughput. Attached Figure Description

[0041] Figure 1 A flowchart illustrating a method for dynamically deriving a front-end runtime interface signature key, provided in an embodiment of the present invention;

[0042] Figure 2 This is a flowchart illustrating an optional specific implementation method of step S100 in an embodiment of the present invention;

[0043] Figure 3 This is a flowchart illustrating an optional specific implementation method of step S200 in an embodiment of the present invention;

[0044] Figure 4 This is a flowchart illustrating an optional specific implementation method of step S300 in an embodiment of the present invention;

[0045] Figure 5 This is a structural block diagram of a front-end runtime interface signature key dynamic derivation system provided in an embodiment of the present invention. Detailed Implementation

[0046] To enable those skilled in the art to better understand the technical solutions of the present invention, exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0047] Where there is no conflict, the various embodiments of the present invention and the features thereof may be combined with each other.

[0048] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0049] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0050] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having the meaning consistent with their meaning in the context of the relevant art and the invention, and will not be interpreted as having an idealized or overly formal meaning unless expressly so defined herein.

[0051] In the technical solution of this invention, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information all comply with relevant laws and regulations and do not violate public order and good morals. The use of user data in this technical solution follows relevant national laws and regulations (e.g., the "Information Security Technology - Personal Information Security Specification"). For example: appropriate measures are taken for personal information access control; restrictions are imposed on the display of personal information; the purpose of using personal information does not exceed the scope of direct or reasonable association; and explicit identity targeting is eliminated when using personal information to avoid precisely locating a specific individual.

[0052] To address at least one of the technical problems existing in the aforementioned related technologies, the present invention provides a method and system for dynamically deriving signature keys based on front-end runtime interface;

[0053] This embodiment provides a method for dynamically deriving signature keys based on front-end runtime interface, such as... Figure 1 ,include:

[0054] S100. Parse the routing configuration file of the front-end project, filter business routes and build a business route tree; split the master signature key into a set of key fragments that are bound to each business route; inject each key fragment into the source code of the corresponding route component to generate encrypted route-fragment mapping metadata; this stage is executed when the front-end project is built and packaged, and is implemented in the form of a build plugin to adapt to mainstream front-end build tools such as Vite and Webpack.

[0055] In S100 of this embodiment, as Figure 2 When parsing front-end routes, static resource routes and fallback routes are filtered out, and key fragments are bound only to business routes associated with business interfaces; standardized route identifiers are output, with unified path case and forward slash format.

[0056] Specifically, the plugin reads the route configuration file in the router directory of the front-end project, statically parses it to generate a complete route tree structure, and supports the recognition of static routes, dynamic routes with parameters, and nested sub-routes.

[0057] The parsed full set of routes is filtered: static resource routes, fallback routes such as 404 / 500 errors, and page routes that are purely for display and have no business interfaces are excluded. Only business routes that are associated with backend business interfaces are retained, generating a standardized list of business routes. All business routes undergo path normalization processing: they are uniformly converted to lowercase, leading and trailing slashes are removed, and parameter placeholders are standardized to eliminate interference from format differences in subsequent route matching.

[0058] In S100 of this embodiment, the Shamir secret sharing algorithm is used to split the master signature key into a set of key fragments. The specific method includes: setting the minimum fragment threshold t required to restore the key, splitting the master key into n key fragments, where n≥t; binding multiple key fragments to high-privilege service routes, and binding a single key fragment to ordinary service routes.

[0059] Specifically, the global master signature key K is loaded, and the Shamir(t,n) secret sharing algorithm is used by default for key splitting, where t is the minimum fragment threshold required to restore the key, and n is the total number of fragments, satisfying n≥t. In an optional embodiment, a custom hierarchical derived function can also be used to replace the Shamir algorithm for key splitting.

[0060] Fragments are bound one-to-one with business routes: For ordinary business routes, one key fragment is bound; for business routes involving sensitive data or high-privilege operations, multiple key fragments are bound to raise the threshold for key recovery and increase the difficulty of cracking.

[0061] In S100 of this embodiment, each key fragment is injected into the source code of the corresponding routing component in an obfuscated form through Abstract Syntax Tree (AST) transformation. The specific method includes:

[0062] Key fragments are embedded as local constants within the business functions of the routing component, and are not defined as global variables; dead code, nested conditional branches, and random strings are inserted at the injection point for obfuscation; the variable names corresponding to the fragments are named using random hashes and do not contain key-related identifier keywords; constant folding optimization is performed during the compilation stage so that key fragments can directly participate in the calculation without independent assignment statements.

[0063] Specifically, the source code files of all business routes are traversed, and an Abstract Syntax Tree (AST) is parsed for each component's source code to locate the business function nodes within the component.

[0064] The key fragments corresponding to the route are injected into the business function as local constants, without creating global variables to avoid global retrieval and location; multiple obfuscation processes are performed synchronously during injection, specifically including:

[0065] Insert a large amount of illogical dead code, nested conditional branches, and random string variables around the fragments to interfere with the reverse analysis path;

[0066] The variable names corresponding to the fragments are named using random MD5 hash strings, without any identifying keywords related to keys or signatures such as "secret", "key", or "sign".

[0067] The constant folding optimization is triggered during the compilation phase, allowing key fragments to directly participate in subsequent computational expressions. There are no independent fragment assignment statements, which further increases the difficulty of reverse extraction.

[0068] In S100 of this embodiment, "routing-fragment mapping metadata" is generated, encrypted, and then embedded in the front-end public basic library for the runtime SDK to read.

[0069] S200. When the front-end page initiates an interface request, the request interceptor captures the request and collects the runtime context feature vector of the current page; according to the current route, it matches the corresponding key fragment set from the route-fragment mapping metadata, executes the key derivation algorithm with the runtime context feature vector as the salt value, and restores the derived signature key; it uses the derived signature key to perform a hash operation on the request data to generate a request signature, and at the same time generates an environment proof field, and attaches the signature and environment proof field to the request header and sends them to the server;

[0070] In S200 of this embodiment, the runtime context feature vector includes four dimensions: normalized routing path, component lifecycle encoding value, core DOM structure hash value, and navigation source identifier; wherein:

[0071] The normalized routing path is the logical path of the current route, which is different from the physical URL in the browser address bar;

[0072] The component lifecycle encoding value is the encoding identifier of the lifecycle stage of the current routing component;

[0073] The core DOM structure hash value is a lightweight hash value of the core business DOM node structure of the page.

[0074] The navigation source identifier is a combination of the previous level routing path and the page jump method.

[0075] In S200 of this embodiment, the method for collecting the hash value of the core DOM structure is as follows:

[0076] Perform DOM hash calculation in the asynchronous callback of requestAnimationFrame, with a random delay within a preset range; detect the browser developer tools being enabled and breakpoint debugging behavior in real time, and actively tamper with the DOM hash value if debugging behavior is captured, so that the key derivation result is invalid; only collect the core business DOM structure of the form and query area, excluding third-party components and dynamic advertising nodes.

[0077] Specifically, when a user initiates an API request, the front-end request interceptor automatically triggers the signature logic.

[0078] Context feature vector collection: The SDK collects runtime environment features of the current page in real time and assembles them into a feature vector C={path,lifecycle,domHash,navRef}. Here, path is the normalized logical path of the current route (not the physical URL in the browser address bar); lifecycle is the encoded value of the current component's lifecycle stage; domHash is a lightweight hash value of key DOM node structures, used to defend against DevTools injection and page tampering; and navRef is a combined identifier of the parent route path and navigation method (push / replace), used to verify legitimate navigation links.

[0079] In S200 of this embodiment, the execution steps of the key derivation algorithm include:

[0080] The runtime context feature vector is serialized into a fixed format string and then SHA256 is used to obtain the environment salt value.

[0081] The matched key fragment set is concatenated and then subjected to a multi-level iterative hash operation with the environmental salt value;

[0082] Output a fixed-length derived signature key for signature operations; if the context feature vector is abnormal, output an invalid key of illegal length, and the signature verification will automatically fail.

[0083] Specifically, the key is first dynamically restored. Based on the current path, the required set of key fragments is located from the mapping metadata. Using the feature vector C as the salt, the key reconstruction algorithm is executed: K'=Derive({ki},C). If C does not match the valid context preset during the construction period, K' will be invalid, and the signature will automatically fail.

[0084] Then, for signature generation and request sending, the restored key K' is used to perform HMAC-SHA256 operation on "request URL + parameters + timestamp + nonce" to generate a signature; at the same time, a partial digest of C is used as an environment proof field and appended to the HTTP request header.

[0085] After receiving the request, the S300 server performs a two-layer collaborative verification according to preset rules. Once both layers of collaborative verification pass, the request is forwarded to the downstream business microservice.

[0086] In this implementation of S300, such as Figure 4After receiving the request, the server performs a two-layer collaborative verification according to preset rules. The specific methods include: performing the first layer of context validity verification: matching the preset route-context whitelist graph according to the request route, and verifying whether the environment proof field carried in the request corresponds to a valid operating context; if the verification fails, the request is directly rejected; if the verification passes, performing the second layer of signature verification: generating the expected signature based on the key material corresponding to the current route using the same key derivation algorithm as the front end, and comparing it with the signature carried in the request; if the comparison passes, the request is forwarded to the downstream business service; if the comparison fails, the request is rejected.

[0087] Before performing the second signature verification, the validity of the timestamp carried in the request and the uniqueness of the Nonce value are verified first. The specific methods include:

[0088] Set a preset time window. If the request timestamp exceeds the time window, it is judged as a replay attack and rejected directly. Check whether the Nonce value already exists in the cache. If it exists, it is judged as a replay attack and rejected directly. If it does not exist, write the Nonce value into the cache and retain it for a preset time.

[0089] Specifically, request information is extracted: The gateway filter receives the request and extracts the signature value, environment verification field, and original request data. The first verification (context verification): Based on the request URL, it matches the server-maintained "routing-context whitelist graph" to verify whether the environment verification field is within the legitimate call context of the interface. If invalid, the request is directly rejected, skipping subsequent time-consuming signature calculations. The second verification (signature verification): Using the same derived algorithm as the frontend and the key material stored on the server, the expected signature is independently calculated and compared with the signature carried in the request.

[0090] Allow request: If both verifications pass, the request is forwarded to the downstream microservice; if either verification fails, a 403 status code is returned.

[0091] This embodiment discloses a method for dynamically deriving interface signature keys based on front-end runtime context awareness. The method includes: parsing the front-end routing tree during the construction phase, splitting the master key into multiple route binding fragments using a secret sharing algorithm, injecting corresponding component code through Abstract Syntax Tree (AST) obfuscation, and generating encrypted mapping metadata; collecting four-dimensional context features—normalized routes, component lifecycles, DOM structure hashes, and navigation source—as salt values ​​during front-end runtime, dynamically deriving a valid signature key, and generating an environment proof field; and performing lightweight context validity verification to quickly intercept illegal requests on the gateway side, followed by signature verification using a same-origin algorithm, forming a two-layer verification closed loop. This invention solves the security defects of traditional static keys, which are prone to leakage and forgery across environments, and is suitable for interface security protection of business systems with front-end and back-end separation architectures.

[0092] Based on the same inventive concept, this invention also provides a dynamic signature key derivation system based on a front-end runtime interface, as shown in Figure 5, comprising: a key fragmentation injection module during construction, a front-end runtime key derivation module, and a gateway two-layer signature verification module; wherein:

[0093] The build-time key fragmentation injection module is used to parse the routing configuration file of the front-end project, filter business routes and build a business route tree; split the master signature key into a set of key fragments that are bound to each business route; inject each key fragment into the source code of the corresponding route component to generate encrypted route-fragment mapping metadata;

[0094] The front-end runtime key derivation module is used when the front-end page initiates an interface request. The request interceptor captures the request and collects the runtime context feature vector of the current page. Based on the current route, it matches the corresponding key fragment set from the route-fragment mapping metadata, executes the key derivation algorithm with the runtime context feature vector as the salt, and restores the derived signature key. The derived signature key is used to perform a hash operation on the request data to generate a request signature, and an environment proof field is generated at the same time. The signature and environment proof field are appended to the request header and sent to the server.

[0095] The gateway's two-layer signature verification module is used to perform two-layer collaborative verification according to preset rules after the server receives a request. After both layers of collaborative verification pass, the request is forwarded to the downstream business microservice.

[0096] The specific working methods of the construction period key fragmentation injection module, the front-end runtime key derivation module, and the gateway two-layer signature verification module have been described in detail in the above-mentioned method for dynamic derivation of front-end runtime interface signature keys, and will not be repeated here.

[0097] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0098] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0099] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0100] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.

[0101] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0102] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0103] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0104] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown 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 the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may 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.

[0106] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of the invention as set forth in the appended claims.

Claims

1. A method for dynamically deriving signature keys from front-end runtime interfaces, characterized in that, include: S100. Parse the routing configuration file of the front-end project, filter business routes, and build a business route tree; The master signature key is split into a set of key fragments that are bound to each business route; Each key fragment is injected into the source code of the corresponding routing component to generate encrypted route-fragment mapping metadata; S200. When the front-end page initiates an interface request, the request interceptor captures the request and collects the runtime context feature vector of the current page; Based on the current route, the corresponding key fragment set is matched from the route-fragment mapping metadata. The key derivation algorithm is executed with the runtime context feature vector as the salt value to restore the derived signature key. The derived signature key is used to perform a hash operation on the request data to generate a request signature. At the same time, an environment proof field is generated. The signature and environment proof field are appended to the request header and sent to the server. After receiving the request, the S300 server performs a two-layer collaborative verification according to preset rules. Once both layers of collaborative verification pass, the request is forwarded to the downstream business microservice.

2. The method according to claim 1, characterized in that, In S100, the master signature key is split into a set of key fragments using the Shamir secret sharing algorithm. The specific method includes: setting the minimum fragment threshold t required to restore the key, splitting the master key into n key fragments, where n≥t; binding multiple key fragments to high-privilege service routes, and binding a single key fragment to ordinary service routes.

3. The method according to claim 1, characterized in that, In S100, through Abstract Syntax Tree (AST) transformation, each key fragment is injected into the source code of the corresponding routing component in an obfuscated form. Specific methods include: Key fragments are embedded as local constants within the business functions of the routing component, and are not defined as global variables; dead code, nested conditional branches, and random strings are inserted at the injection point for obfuscation; the variable names corresponding to the fragments are named using random hashes and do not contain key-related identifier keywords; constant folding optimization is performed during the compilation stage so that key fragments can directly participate in the calculation without independent assignment statements.

4. The method according to claim 1, characterized in that, In S100, when parsing front-end routes, static resource routes and fallback routes are filtered out, and key fragments are bound only to business routes associated with business interfaces; standardized route identifiers are output, and the case and slash format of the path are unified.

5. The method according to claim 1, characterized in that, In S200, the runtime context feature vector includes four dimensions: normalized route path, component lifecycle encoding value, core DOM structure hash value, and navigation source identifier; wherein: The normalized routing path is the logical path of the current route, which is different from the physical URL in the browser address bar; The component lifecycle encoding value is the encoding identifier of the lifecycle stage of the current routing component; The core DOM structure hash value is a lightweight hash value of the core business DOM node structure of the page. The navigation source identifier is a combination of the previous level routing path and the page jump method.

6. The method according to claim 5, characterized in that, In S200, the core DOM structure hash value is collected in the following way: Perform DOM hash calculations within the asynchronous callback of requestAnimationFrame, with an added random delay within a preset range; Real-time monitoring of browser developer tools and breakpoint debugging behavior; if debugging behavior is captured, the DOM hash value is actively modified to invalidate the key derivation result; only the core business DOM structure of forms and query areas is collected, excluding third-party components and dynamic advertising nodes.

7. The method according to claim 1, characterized in that, In S200, the execution steps of the key derivation algorithm include: The runtime context feature vector is serialized into a fixed format string and then SHA256 is used to obtain the environment salt value. The matched key fragment set is concatenated and then subjected to a multi-level iterative hash operation with the environmental salt value; Output a fixed-length derived signature key for signature operations; if the context feature vector is abnormal, output an invalid key of illegal length, and the signature verification will automatically fail.

8. The method according to claim 1, characterized in that, After receiving the request, the S300 server performs a two-layer collaborative verification according to preset rules. The specific methods include: performing the first layer of context validity verification: matching the preset route-context whitelist graph according to the request route, and verifying whether the environment proof field carried in the request corresponds to a valid operating context; if the verification fails, the request is directly rejected; if the verification passes, performing the second layer of signature verification: generating the expected signature based on the key material corresponding to the current route using the same key derivation algorithm as the front end, and comparing it with the signature carried in the request; if the comparison passes, the request is forwarded to the downstream business service; if the comparison fails, the request is rejected.

9. The method according to claim 8, characterized in that, Before performing the second signature verification, the validity of the timestamp carried in the request and the uniqueness of the Nonce value are verified first. Specific methods include: Set a preset time window. If the request timestamp exceeds the time window, it is judged as a replay attack and rejected directly. Check whether the Nonce value already exists in the cache. If it exists, it is judged as a replay attack and rejected directly. If it does not exist, write the Nonce value into the cache and retain it for a preset time.

10. A dynamic derivation system for signature keys based on a front-end runtime interface, employing any one of the methods in claims 1-9, characterized in that, include: The system consists of a key fragmentation injection module, a front-end runtime key derivation module, and a gateway two-layer signature verification module; among which: The build-time key fragmentation injection module is used to parse the routing configuration file of the front-end project, filter business routes and build a business route tree; split the master signature key into a set of key fragments that are bound to each business route; inject each key fragment into the source code of the corresponding route component to generate encrypted route-fragment mapping metadata; The front-end runtime key derivation module is used when the front-end page initiates an interface request. The request interceptor captures the request and collects the runtime context feature vector of the current page. Based on the current route, it matches the corresponding key fragment set from the route-fragment mapping metadata, executes the key derivation algorithm with the runtime context feature vector as the salt, and restores the derived signature key. The derived signature key is used to perform a hash operation on the request data to generate a request signature, and an environment proof field is generated at the same time. The signature and environment proof field are appended to the request header and sent to the server. The gateway's two-layer signature verification module is used to perform two-layer collaborative verification according to preset rules after the server receives a request. After both layers of collaborative verification pass, the request is forwarded to the downstream business microservice.