Proxy detection method, system, equipment and product suitable for JavaScript object
By binding virtual attributes on JavaScript objects and obtaining stack frame information, the problem of the inability to accurately judge Proxy proxy in the existing technology is solved, cross-platform and dynamic Proxy proxy detection is realized, and debugging efficiency and security are improved.
Patent Information
- Application Number
- CN202511006187.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2045-07-22
AI Technical Summary
The prior art cannot accurately and stably determine whether the object is proxyed by Proxy without modifying the original JavaScript object or relying on specific implementations.
By binding virtual attributes on the target JavaScript object and using getter function to obtain stack frame information, combined with custom error stack processing methods, the caller type name is extracted to determine whether it is a Proxy proxy.
It implements accurate and stable judgment of whether JavaScript objects are proxyed by Proxy without modifying the original object or relying on specific implementations, supports cross-platform compatibility and dynamic analysis, and improves debugging efficiency and security.
Smart Images

Figure CN120508493A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of object state identification and security control, and in particular relates to a Proxy agent detection method, system, device and product applicable to JavaScript objects. Background Art
[0002] JavaScript is a lightweight, interpreted, or just-in-time compiled, programming language widely used in web development, primarily to enhance the interactivity and dynamism of web pages. A proxy is a transparent proxy used to efficiently access remote services or other proxies. JavaScript's Proxy object allows developers to intercept and customize operations on target objects and is widely used in scenarios such as responsive frameworks (such as Vue), data binding, and access control. However, due to the transparency of proxies, the JavaScript standard does not provide a direct method to determine whether an object is a Proxy instance.
[0003] Currently, common methods for detecting whether a JavaScript object is proxied include the following: (1) checking the constructor; (2) using the Object.prototype.toString.call() function; (3) adding a custom marker attribute (which must be set proactively) that requires pre-injection; and (4) exploiting specific trap behaviors (which are easily circumvented) that require pre-injection. However, none of these methods can accurately and stably determine whether a JavaScript object is proxied without modifying the original object or relying on specific implementations. Summary of the Invention
[0004] The purpose of the present invention is to provide a proxy agent detection method, system, computer device, computer-readable storage product and computer program product applicable to JavaScript objects, so as to solve the problem that existing proxy agent detection schemes cannot accurately and stably determine whether a JavaScript object is a proxy without modifying the original object or relying on specific implementation.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions: In a first aspect, a proxy detection method applicable to JavaScript objects is provided, comprising: Determine the target JavaScript object to be detected; Bind a virtual property for triggering detection logic through a getter function on the target JavaScript object through the object operation tool Object.defineProperty; Actively access the virtual attribute to trigger the getter function; Implementing a custom error stack processing method in the getter function to obtain stack frame information of the target JavaScript object; The target JavaScript object and the caller type name related to the current access behavior are extracted from the stack frame information, and when it is found that the caller type name matches the character string "Proxy", it is determined that the target JavaScript object has been proxied by Proxy.
[0006] Based on the above invention content, a practical, stable and cross-platform Proxy proxy detection mechanism is provided. That is, first, a virtual property for triggering the detection logic through a getter function is bound to the target JavaScript object through the object operation tool Object.defineProperty, then the virtual property is actively accessed to trigger the getter function, and a custom error stack processing method is implemented in the getter function to obtain the stack frame information of the target object. Finally, the target object and the caller type name related to the current access behavior are extracted from the stack frame information. When the name is found to match the string "Proxy", it is determined that the target object has been proxied by a Proxy. In this way, without modifying the original object or relying on the specific implementation, it is possible to accurately and stably determine whether the target object is proxied by a Proxy. This fills a gap in object state recognition in the JavaScript ecosystem, has good application value and commercial prospects, and is easy to apply and promote in practice.
[0007] In a possible design, the virtual attribute is a non-enumerable attribute, and / or the name of the virtual attribute is a randomly generated unique identifier or a preset fixed name.
[0008] In a possible design, actively accessing the virtual attribute includes: The virtual property is explicitly accessed by inserting a line of access statement during the debugging phase, or the virtual property is implicitly accessed by triggering it in any lifecycle hook.
[0009] In one possible design, a custom error stack processing method is implemented in the getter function to obtain stack frame information of the target JavaScript object, including: Introduce the Error.prepareStackTrace custom mechanism into the getter function and temporarily rewrite the Error.prepareStackTrace function as follows: replace the Error.prepareStackTrace function with a custom function that receives the error object itself and a structured stack frame array, where each stack frame array represents a function call and contains metadata about the corresponding call, including the file path, line number, column number, function name, and / or constructor flags; Create and throw a temporary error object in the getter function to trigger the call of the overridden Error.prepareStackTrace function to capture the current call stack of the target JavaScript object and eliminate unnecessary stack frames; The stack frame array corresponding to the current call stack is traversed, and the field contents of the function name field, the type name field, and the constructor identification field of each frame are extracted as the stack frame information of the target JavaScript object.
[0010] In a possible design, extracting the target JavaScript object and the caller type name related to the current access behavior from the stack frame information includes: The function getTypeName() is called to directly obtain the caller type name of the target JavaScript object and related to the current access behavior from the stack frame information.
[0011] In one possible design, after calling the function getTypeName(), the method further includes: If direct acquisition fails, the target JavaScript object and the caller type name related to the current access behavior are inferred through the function getFunctionName() according to the stack frame information.
[0012] In a second aspect, a Proxy agent detection system for JavaScript objects is provided, comprising a target object determination unit, an object property binding unit, a property function triggering unit, a stack information acquisition unit, and a type name matching unit, which are sequentially connected in communication; The target object determination unit is used to determine the target JavaScript object to be detected; The object property binding unit is used to bind a virtual property for triggering the detection logic through a getter function on the target JavaScript object through the object operation tool Object.defineProperty; The property function triggering unit is used to actively access the virtual property and trigger the getter function; The stack information acquisition unit is configured to implement a custom error stack processing method in the getter function to acquire stack frame information of the target JavaScript object; The type name matching unit is used to extract the target JavaScript object and the caller type name related to the current access behavior from the stack frame information, and when it is found that the caller type name matches the string "Proxy", it determines that the target JavaScript object has been proxied by Proxy.
[0013] In a third aspect, the present invention provides a computer device comprising a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the proxy agent detection method as described in the first aspect or any possible design of the first aspect.
[0014] In a fourth aspect, the present invention provides a computer-readable storage product having instructions stored thereon. When the instructions are run on a computer, the proxy agent detection method as described in the first aspect or any possible design of the first aspect is executed.
[0015] In a fifth aspect, the present invention provides a computer program product, comprising a computer program or instructions, which, when executed by a computer, implements the proxy agent detection method as described in the first aspect or any possible design of the first aspect.
[0016] Beneficial effects of the above scheme: (1) The present invention creatively provides a practical, stable and cross-platform proxy detection mechanism, which first binds a virtual property for triggering the detection logic through a getter function on the target JavaScript object through the object operation tool Object.defineProperty, then actively accesses the virtual property to trigger the getter function, and implements a custom error stack processing method in the getter function to obtain the stack frame information of the target object. Finally, the target object and the caller type name related to the current access behavior are extracted from the stack frame information. When the name matches the string "Proxy", it is determined that the target object has been proxied by Proxy. In this way, without modifying the original object or relying on the specific implementation, it can accurately and stably determine whether the target object is proxied by Proxy, filling a gap in object state recognition in the JavaScript ecosystem, having good application value and commercial prospects, and facilitating practical application and promotion. (2) Ability to handle cross-engine compatibility: Considering that different JavaScript engines (such as V8, SpiderMonkey, and JavaScriptCore) may have different implementation details of Proxy, a solution that can adapt to multiple operating environments is proposed. This means that it is not just designed for a specific platform, but aims to develop a detection algorithm that can work stably in various mainstream browsers and Node.js environments; (3) Support for dynamic analysis: A technology has been developed that can dynamically monitor object state changes at runtime, allowing the system to identify in real time whether an object has been transformed into a proxy. This is particularly important for maintaining the security and stability of applications, especially in the presence of potential malicious code; (4) Providing an efficient and low-intrusive implementation: We designed an efficient and low-overhead detection process to minimize the impact on application performance while maintaining low intrusion, meaning that this detection function can be integrated without large-scale modifications to the existing code structure; (5) It solves the current problem of lack of reliable methods to detect JavaScript proxies and provides developers with powerful tools to enhance application security, debugging efficiency and performance optimization. It also achieves accurate judgment of whether an object is proxied by a proxy by combining various technical means such as exception capture, cross-platform adaptation and metadata management. (5) Compared with the existing proxy detection scheme, it has the following advantages and features: non-invasive, that is, it does not change the original object structure, and only triggers the logic through attribute access; dynamic, that is, it is executed on demand at runtime, saving resources; high precision, that is, it combines stack information with type identification to accurately determine whether the object is proxied; strong scalability, which can be further extended to other types of detection (such as Reflect and Map / WeakMap, etc.); improve debugging efficiency, that is, it helps developers quickly identify whether the object is proxied and improve the ability to troubleshoot complex behaviors; enhance security, that is, prevent third-party code from tampering with key objects without being discovered; support dynamic analysis, which can be used for runtime monitoring and object protection in sandbox environments; strong cross-platform compatibility, that is, it is suitable for mainstream browsers, Node.js and applet engines, etc.; etc. (6) A flexible and extensible dynamic detection framework is built, which is suitable for a variety of advanced application scenarios, for example, in development and debugging tools, it is used to identify whether an object is proxied; in security detection modules, it is used to prevent objects from being tampered with by illegal proxies; in AOP (Aspect-Oriented-Progranning) programming frameworks, it is used to dynamically determine whether the target has been implanted with aspect logic; in performance monitoring systems, it is used to identify the additional overhead brought by proxies; in front-end security frameworks, it is used to detect whether malicious scripts have hijacked global objects; in plug-in systems, it is used to ensure that plug-ins have not tampered with the core API (Application Programming Interface); in development tools' IDEs (Integrated Development Environments) and debuggers, it is used to identify proxy objects; in sandbox isolation, it is used to enhance the security boundary control of Web containers; and so on. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A flowchart of a Proxy agent detection method applicable to JavaScript objects provided in an embodiment of the present application.
[0019] Figure 2 A schematic diagram of the structure of a Proxy agent detection system for JavaScript objects provided in an embodiment of the present application.
[0020] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly introduced below in conjunction with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structures of the drawings is only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these embodiments without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.
[0022] It should be understood that although the terms first, second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are merely used to distinguish one object from another. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.
[0023] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can indicate three situations: A exists alone, B exists alone, or A and B exist at the same time. For another example, A, B and / or C can indicate the existence of any one of A, B and C or any combination of them. The term " / and" that may appear in this document describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can indicate two situations: A exists alone or A and B exist at the same time. In addition, the character " / " that may appear in this document generally indicates that the previous and next associated objects are in an "or" relationship.
[0024] Example like Figure 1 As shown, the Proxy agent detection method provided in the first aspect of this embodiment and applicable to JavaScript objects can be executed by, but is not limited to, a computer device with certain computing resources, such as a cloud server, a personal computer (PC, a multi-purpose computer with a size, price, and performance suitable for personal use; desktops, laptops, small laptops, tablets, and ultrabooks are all personal computers), a smart phone, a personal digital assistant (PDA), or a wearable device. Figure 1As shown, the Proxy agent detection method may include, but is not limited to, the following steps S1 to S5.
[0025] S1. Determine the target JavaScript object to be detected.
[0026] In step S1, the target JavaScript object is the target object for behavior monitoring or type identification. This object may be a regular object, a function, or a class instance, or even a proxy object constructed using a proxy. In advanced scenarios such as browser environments, Node.js environments, and embedded JavaScript engines, users may wish to dynamically identify whether the object is encapsulated within a proxy to avoid misjudging its original type. Furthermore, the target JavaScript object may be determined, specifically but not limited to, through conventional manual specification or automatic screening.
[0027] S2. Bind a virtual property for triggering the detection logic through a getter function to the target JavaScript object through the object operation tool Object.defineProperty.
[0028] In step S2, to transparently monitor the target JavaScript object, a "virtual property"—that is, one that doesn't actually store a value—is bound to it, and specific detection logic is triggered via a getter function. This process is implemented using Object.defineProperty (a powerful and flexible object manipulation tool in JavaScript that can be used for a variety of purposes, including defining new properties, modifying existing properties, precisely controlling property attributes, and implementing property accessors). The virtual property is preferably set to non-enumerable (i.e., enumerable: false) to prevent discovery through conventional traversal. Specifically, the name of the virtual property can be a randomly generated unique identifier or a preset fixed name (e.g., _$$internalCheck$$). The getter function does not return any actual data, but instead serves as a trigger to initiate subsequent call stack analysis and type identification logic (i.e., detection logic). Specifically, when the virtual property is accessed, the JavaScript engine automatically calls the getter function to execute the predetermined behavior. This design enables a non-intrusive property injection mechanism, allowing monitoring capabilities to be embedded into existing code without modification.
[0029] S3. Actively access the virtual attribute to trigger the getter function.
[0030] In step S3, in order to activate the above-mentioned detection logic, it is necessary to explicitly or implicitly access this virtual attribute at runtime (when the attribute is accessed, the function body of the getter function will be automatically entered) so as to start executing a series of deep detection operations, including error stack capture, context analysis, and type determination. Specifically, actively accessing the virtual attribute includes but is not limited to: explicitly accessing the virtual attribute by inserting a line of access statement during the debugging phase, or triggering implicit access to the virtual attribute in any lifecycle hook. The above-mentioned design can embody the idea of delayed execution and on-demand triggering, ensuring that resources are consumed only when necessary.
[0031] S4. Implement a custom error stack processing method in the getter function to obtain stack frame information of the target JavaScript object.
[0032] In step S4, inside the getter function, in order to precisely control the format and content of the stack frame information, it is necessary to introduce a custom mechanism called Error.prepareStackTrace (in JavaScript, Error.prepareStackTrace is a static method used to customize the format of the error stack; this method is very useful when the user wants to control how the stack trace information of the error object is displayed when it is printed or captured). Specifically, a custom error stack processing method is implemented in the getter function to obtain the stack frame information of the target JavaScript object, including but not limited to the following steps S41 to S43.
[0033] S41. Introduce the Error.prepareStackTrace custom mechanism into the getter function and temporarily rewrite the Error.prepareStackTrace function as follows: replace the Error.prepareStackTrace function with a custom function for receiving the error object itself and a structured stack frame array, wherein each stack frame array represents a function call and includes but is not limited to metadata of the corresponding call, etc., and the metadata includes but is not limited to the file path, line number, column number, function name and / or constructor flags, etc.
[0034] In step S41, the stack frame array is also an array of CallSite objects, where CallSite is a concept in the Java virtual machine used for dynamic method calls; it is an abstract class that does not allow users to directly subclass; CallSite represents a variable method handle whose target can be changed at runtime, which is very useful for implementing dynamic behavior.
[0035] S42. Create and throw a temporary error object in the getter function to trigger the call of the overridden Error.prepareStackTrace function to capture the current call stack of the target JavaScript object and eliminate unnecessary stack frames.
[0036] In step S42, the temporary error object may be an empty error object created using the new Error() function. The rewritten Error.prepareStackTrace function may be represented by Error.captureStackTrace(error, targetObj), where error represents the temporary error object and targetObj represents the target JavaScript object. The unnecessary stack frame may be, but is not limited to, a stack frame corresponding to the target JavaScript object's wrapper layer.
[0037] S43. Traverse the stack frame array corresponding to the current call stack, and extract the field contents of each frame, such as the function name field, the type name field, and the constructor identification field, as the stack frame information of the target JavaScript object.
[0038] In step S43 , special attention needs to be paid to the context of the current call frame during traversal, especially the call hierarchy related to the target JavaScript object.
[0039] S5. Extract the target JavaScript object and the caller type name related to the current access behavior from the stack frame information, and when it is found that the caller type name matches the string "Proxy", determine that the target JavaScript object has been proxied by Proxy.
[0040] In the step S5, specifically, the caller type name of the target JavaScript object and related to the current access behavior is extracted from the stack frame information, including but not limited to: calling the function getTypeName(), so as to directly obtain the caller type name of the target JavaScript object and related to the current access behavior from the stack frame information. The aforementioned function getTypeName() is an existing function. When the target JavaScript object is specifically a CallSite object, if the environment supports it, the function getTypeName() can be called to directly obtain the name of the type to which the caller belongs (i.e., the caller type name). However, if it cannot be obtained directly, the possible type name can also be inferred through getFunctionName() or other means, that is, after calling the function getTypeName(), the method also includes but is not limited to: if direct acquisition fails, then according to the stack frame information, the caller type name of the target JavaScript object and related to the current access behavior is inferred through the function getFunctionName(). The aforementioned function getFunctionName() is also an existing function. Furthermore, a string comparison can be used to determine whether the caller type name matches the string "Proxy." If so, the current access behavior is triggered by a Proxy object, and the target JavaScript object can be inferred to have been proxied. Otherwise, it is not. This allows the use of meta-information in JavaScript stack traces, combined with language-level reflection capabilities, to implement a type detection mechanism that does not rely on instanceof.
[0041] Therefore, based on the proxy detection method described in the aforementioned steps S1 to S5, a practical, stable, and cross-platform proxy detection mechanism is provided. That is, first, a virtual property for triggering the detection logic through a getter function is bound to the target JavaScript object through the object operation tool Object.defineProperty. Then, the virtual property is actively accessed to trigger the getter function, and a custom error stack processing method is implemented in the getter function to obtain the stack frame information of the target object. Finally, the caller type name of the target object and related to the current access behavior is extracted from the stack frame information. When the name matches the string "Proxy", it is determined that the target object has been proxied. In this way, without modifying the original object or relying on the specific implementation, it is possible to accurately and stably determine whether the target object is proxied. This fills a gap in object state recognition in the JavaScript ecosystem, has good application value and commercial prospects, and is easy to apply and promote in practice.
[0042] like Figure 2 As shown, the second aspect of this embodiment provides a virtual system for implementing the proxy agent detection method described in the first aspect, including a target object determination unit, an object attribute binding unit, an attribute function triggering unit, a stack information acquisition unit, and a type name matching unit that are sequentially connected in communication; The target object determination unit is used to determine the target JavaScript object to be detected; The object property binding unit is used to bind a virtual property for triggering the detection logic through a getter function on the target JavaScript object through the object operation tool Object.defineProperty; The property function triggering unit is used to actively access the virtual property and trigger the getter function; The stack information acquisition unit is configured to implement a custom error stack processing method in the getter function to acquire stack frame information of the target JavaScript object; The type name matching unit is used to extract the target JavaScript object and the caller type name related to the current access behavior from the stack frame information, and when it is found that the caller type name matches the string "Proxy", it determines that the target JavaScript object has been proxied by Proxy.
[0043] The working process, working details and technical effects of the aforementioned system provided in the second aspect of this embodiment can be referred to the Proxy agent detection method described in the first aspect, and will not be repeated here.
[0044] like Figure 3 As shown, a third aspect of this embodiment provides a computer device for executing the proxy detection method described in the first aspect, comprising a memory, a processor, and a transceiver communicatively connected in sequence. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the proxy detection method described in the first aspect. Specifically, the memory may include, but is not limited to, random-access memory (RAM), read-only memory (ROM), flash memory, first-input first-output (FIFO), and / or first-input last-output (FILO) memory; the processor may include, but is not limited to, a microprocessor from the STM32F105 series. Furthermore, the computer device may include, but is not limited to, a power module, a display screen, and other necessary components.
[0045] The working process, working details and technical effects of the aforementioned computer device provided in the third aspect of this embodiment can be referred to the proxy agent detection method described in the first aspect, and will not be repeated here.
[0046] A fourth aspect of this embodiment provides a computer-readable storage product storing instructions including the proxy detection method described in the first aspect. Specifically, the computer-readable storage product stores instructions that, when executed on a computer, execute the proxy detection method described in the first aspect. The computer-readable storage product refers to a data storage medium, which may include, but is not limited to, a computer-readable storage medium such as a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, and / or a memory stick. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0047] The working process, working details and technical effects of the aforementioned computer-readable storage product provided in the fourth aspect of this embodiment can be referred to the proxy agent detection method described in the first aspect, and will not be repeated here.
[0048] A fifth aspect of this embodiment provides a computer program product, including a computer program or instructions, which, when executed by a computer, implements the proxy detection method described in the first aspect. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0049] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.
Claims
1. A proxy detection method applicable to JavaScript objects, characterized in that: include: Determine the target JavaScript object to be detected; Bind a virtual property for triggering detection logic through a getter function on the target JavaScript object through the object operation tool Object.defineProperty; Actively access the virtual attribute to trigger the getter function; Implementing a custom error stack processing method in the getter function to obtain stack frame information of the target JavaScript object; The target JavaScript object and the caller type name related to the current access behavior are extracted from the stack frame information, and when it is found that the caller type name matches the string "Proxy", it is determined that the target JavaScript object has been proxied by Proxy.
2. The Proxy detection method according to claim 1, characterized in that: The virtual attribute is a non-enumerable attribute, and / or the name of the virtual attribute is a randomly generated unique identifier or a preset fixed name.
3. The Proxy detection method according to claim 1, characterized in that: Actively access the virtual attributes, including: The virtual property is explicitly accessed by inserting a line of access statement during the debugging phase, or the virtual property is implicitly accessed by triggering it in any lifecycle hook.
4. The Proxy detection method according to claim 1, characterized in that: Implementing a custom error stack processing method in the getter function to obtain stack frame information of the target JavaScript object includes: Introduce the Error.prepareStackTrace custom mechanism into the getter function and temporarily rewrite the Error.prepareStackTrace function as follows: replace the Error.prepareStackTrace function with a custom function that receives the error object itself and a structured stack frame array, where each stack frame array represents a function call and contains metadata about the corresponding call, including the file path, line number, column number, function name, and / or constructor flags; Create and throw a temporary error object in the getter function to trigger the call of the overridden Error.prepareStackTrace function to capture the current call stack of the target JavaScript object and eliminate unnecessary stack frames; The stack frame array corresponding to the current call stack is traversed, and the field contents of the function name field, the type name field, and the constructor identification field of each frame are extracted as the stack frame information of the target JavaScript object.
5. The Proxy detection method according to claim 1, characterized in that: Extracting the target JavaScript object and the caller type name related to the current access behavior from the stack frame information includes: The function getTypeName() is called to directly obtain the caller type name of the target JavaScript object and related to the current access behavior from the stack frame information.
6. The Proxy detection method according to claim 5, characterized in that: After calling the function getTypeName(), the method further includes: If direct acquisition fails, the target JavaScript object and the caller type name related to the current access behavior are inferred through the function getFunctionName() according to the stack frame information.
7. A proxy agent detection system suitable for JavaScript objects, characterized in that: It includes a target object determination unit, an object attribute binding unit, an attribute function triggering unit, a stack information acquisition unit and a type name matching unit which are sequentially connected in communication; The target object determination unit is used to determine the target JavaScript object to be detected; The object property binding unit is used to bind a virtual property for triggering the detection logic through a getter function on the target JavaScript object through the object operation tool Object.defineProperty; The property function triggering unit is used to actively access the virtual property and trigger the getter function; The stack information acquisition unit is configured to implement a custom error stack processing method in the getter function to acquire stack frame information of the target JavaScript object; The type name matching unit is used to extract the caller type name of the target JavaScript object and related to the current access behavior from the stack frame information, and when it is found that the caller type name matches the string "Proxy", it determines that the target JavaScript object has been proxied by Proxy.
8. A computer device, characterized in that: The invention comprises a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the proxy detection method according to any one of claims 1 to 6.
9. A computer-readable storage product, characterized in that The computer-readable storage product stores instructions, and when the instructions are run on a computer, the proxy agent detection method according to any one of claims 1 to 6 is executed.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or the instruction is executed by a computer, the proxy detection method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
System interface calling detection method and device
CN112560022A
System and method for data communication
CN116601925A
GUI (Graphical User Interface) program fuzzing test method and system, computer equipment and storage medium
CN120256314A
Using object flow integrity to improve software security
US20200117803A1