CN116842485A - Front-end code processing method and related equipment - Google Patents

Front-end code processing method and related equipment Download PDF

Info

Publication number
CN116842485A
CN116842485A CN202310822614.7A CN202310822614A CN116842485A CN 116842485 A CN116842485 A CN 116842485A CN 202310822614 A CN202310822614 A CN 202310822614A CN 116842485 A CN116842485 A CN 116842485A
Authority
CN
China
Prior art keywords
end code
file
code
processed
byte
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310822614.7A
Other languages
Chinese (zh)
Inventor
周力
金朝麟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Youzhuju Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youzhuju Network Technology Co Ltd filed Critical Beijing Youzhuju Network Technology Co Ltd
Priority to CN202310822614.7A priority Critical patent/CN116842485A/en
Publication of CN116842485A publication Critical patent/CN116842485A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/14Protecting executable software against software analysis or reverse engineering, e.g. by obfuscation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Technology Law (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Storage Device Security (AREA)

Abstract

The disclosure provides a method for processing a front-end code, which comprises the following steps: acquiring a front-end code to be processed; converting the front-end code to be processed into a byte code file; and generating a front-end code loading data packet based on the byte code file. Based on the processing method of the front-end code, the disclosure also provides a processing device of the front-end code, a storage medium and a program product.

Description

Front-end code processing method and related equipment
Technical Field
The present disclosure relates to the field of internet technologies, and in particular, to a front end code processing method, a front end code processing apparatus, a storage medium, and a program product.
Background
Front-end code, also known as web front-end code (e.g., javaScript language (JavaScript) source code), is typically loaded and run by a user's client or browser. In this way, the user can directly acquire the source code of the front-end code being run through the client or the browser, so that the front-end code has the risk of being cracked and stolen by others, and even tampered with. Therefore, how to reduce the risk of front-end code being broken, stolen or tampered with is one of the problems that are currently in need of solution.
Disclosure of Invention
In view of this, the embodiments of the present disclosure provide a front-end code processing method, which can greatly reduce the risk of front-end code being cracked, stolen or tampered.
The front end code processing method according to the embodiment of the disclosure may include: acquiring a front-end code to be processed; converting the front-end code to be processed into a byte code file; and generating a front-end code loading data packet based on the byte code file.
In an embodiment of the present disclosure, the acquiring the front-end code to be processed includes: acquiring a first front-end code file from a first designated path; and taking the first front-end code file as the front-end code to be processed.
In an embodiment of the present disclosure, the method further includes, after obtaining the first front end code file from the first specified path: determining whether the first front-end code file is a strongly typed language file; and in response to determining that the first front-end code file is not the strongly typed language file, converting the first front-end code file into a strongly typed language file, and taking the strongly typed language file obtained through conversion as the front-end code to be processed.
In an embodiment of the present disclosure, the strongly typed language file is a strongly typed scripting language Type Script file.
In an embodiment of the present disclosure, the bytecode file is a web compiled WASM file.
In an embodiment of the disclosure, the converting the front-end code to be processed into bytecode includes: compiling the front-end code to be processed by using a WASM compiler or a WASM tool chain to obtain the byte code file; and storing the byte code file to a second designated path.
In an embodiment of the disclosure, the storing the bytecode to the second specified path includes: encrypting the byte code file; and storing the encrypted bytecode file to the second designated path.
In an embodiment of the disclosure, encrypting the byte code file includes: the byte code files are encrypted using a symmetric encryption algorithm or an asymmetric encryption algorithm.
In an embodiment of the disclosure, the generating the front-end code loading data packet based on the bytecode file includes: acquiring a second front-end code file from a third designated path; obtaining the byte code file from the second designated path; and combining the second front-end code file and the byte code file into the front-end code loading data packet.
Based on the front-end code processing method, an embodiment of the present disclosure further provides a front-end code processing apparatus, including:
the code acquisition module is used for acquiring a front-end code to be processed;
the conversion module is used for converting the front-end code to be processed into a byte code file; and
and the data packet generating module is used for generating a front-end code loading data packet based on the byte code file.
The embodiment of the disclosure also provides an electronic device, including: the processing device comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the processing method of the front-end code when executing the computer program.
Embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the processing method of the front-end code described above.
Embodiments of the present disclosure also provide a computer program product comprising computer program instructions which, when run on a computer, cause the computer to perform the above-described front-end code processing method.
It can be seen that, in the processing method of the front end code and the related device provided in the present disclosure, the front end code to be processed is first converted into a bytecode file that can be executed by a client or a browser of a user, and then a front end code loading data packet is generated based on the bytecode file obtained through conversion. The front-end code to be processed may include all the front-end codes or may be only part of the front-end codes related to the service core logic. In this way, the front-end code loading packet loaded to the user's client or browser will no longer include the source code of the front-end code or the source code of the front-end code involving the business core logic portion, but will be replaced with a bytecode file that the user's client or browser can execute. The converted byte code file has the characteristics of poor readability, difficult decompilation and the like, so that the risk of cracking, embezzling or tampering of the front-end code can be greatly reduced and the safety of the front-end code can be improved by using the front-end code loading data packet obtained by the front-end code processing method.
Drawings
In order to more clearly illustrate the technical solutions of the present disclosure or related art, the drawings required for the embodiments or related art description will be briefly described below, and it is apparent that the drawings in the following description are only embodiments of the present disclosure, and other drawings may be obtained according to these drawings without inventive effort to those of ordinary skill in the art.
Fig. 1 shows a schematic diagram of an application scenario for loading front-end code according to an embodiment of the disclosure;
FIG. 2 shows an implementation flow of a method for processing front-end code according to an embodiment of the disclosure;
FIG. 3 illustrates an implementation flow of a more specific front-end code processing method according to some embodiments of the present disclosure;
FIG. 4 illustrates the internal structure of a processing device of front end code according to some embodiments of the present disclosure;
fig. 5 is a schematic diagram of a hardware structure of a more specific electronic device according to the present embodiment.
Detailed Description
For the purposes of promoting an understanding of the principles and advantages of the disclosure, reference will now be made to the embodiments illustrated in the drawings and specific language will be used to describe the same.
It should be noted that unless otherwise defined, technical or scientific terms used in the embodiments of the present disclosure should be given the ordinary meaning as understood by one of ordinary skill in the art to which the present disclosure pertains. The terms "first," "second," and the like, as used in embodiments of the present disclosure, do not denote any order, quantity, or importance, but rather are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that elements or items preceding the word are included in the element or item listed after the word and equivalents thereof, but does not exclude other elements or items. The terms "connected" or "connected," and the like, are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", etc. are used merely to indicate relative positional relationships, which may also be changed when the absolute position of the object to be described is changed.
It will be appreciated that before using the technical solutions of the various embodiments in the disclosure, the user may be informed of the type of personal information involved, the range of use, the use scenario, etc. in an appropriate manner, and obtain the authorization of the user.
For example, in response to receiving an active request from a user, a prompt is sent to the user to explicitly prompt the user that the operation it is requesting to perform will require personal information to be obtained and used with the user. Therefore, the user can select whether to provide personal information to the software or hardware such as the electronic equipment, the application program, the server or the storage medium for executing the operation of the technical scheme according to the prompt information.
As an alternative but non-limiting implementation, in response to receiving an active request from a user, the manner in which the prompt information is sent to the user may be, for example, a popup, in which the prompt information may be presented in a text manner. In addition, a selection control for the user to select to provide personal information to the electronic device in a 'consent' or 'disagreement' manner can be carried in the popup window.
It will be appreciated that the above-described notification and user authorization process is merely illustrative, and not limiting of the implementations of the present disclosure, and that other ways of satisfying relevant legal regulations may be applied to the implementations of the present disclosure.
Fig. 1 illustrates an application scenario of loading front-end code according to some embodiments of the present disclosure. In the application scenario shown in fig. 1, when a user requests to display a certain target page through the client or browser 110, the client or browser 110 of the user sends a target page loading request to the server. In this case, the server 120 returns the front end code corresponding to the target page to the user's client or browser 110. And after the client or browser of the user loads the front end code of the target page, the target page can be displayed on the display device of the target page.
As mentioned above, most of the front end codes of the target page are JavaScript source codes. Therefore, in the application scenario, if the source code of the front-end code is not encrypted or only is simply encrypted, the user can easily crack the source code of the front-end code, and even can steal or tamper the front-end code, which brings great security risks to the service.
Further, as front-end applications become more complex, some of the business core logic will typically be pre-empted in the front-end application. This is because if the service core logic is placed on the server side, stress is applied to the server side equipment, thereby affecting the stability of the service. In this case, if the front-end code is not encrypted, it may cause leakage of the service core logic, which may also bring about security risk for the development of the service.
To reduce the risk of cracking, theft, and tampering of the front-end code, code obfuscation techniques are currently commonly used to protect the front-end code. The code confusion technology is to transform and reconstruct codes so as to make the codes difficult to understand and analyze, thereby increasing the difficulty of reverse engineering. However, conventional code obfuscation techniques still have some drawbacks. First, although the difficulty of reverse engineering increases for the code after confusion, the code can still be restored, and thus, the security is not completely guaranteed. Second, code aliasing can lead to increased code volume and reduced performance, adversely affecting the user experience.
In order to solve the above-mentioned problems, an embodiment of the present disclosure provides a processing method of front-end code. Fig. 2 shows an implementation flow of a method for processing front-end code according to an embodiment of the disclosure. The processing method of the front-end code as shown in fig. 2 may include the following steps:
in step 202, a front end code to be processed is obtained.
In step 204, the front-end code to be processed is converted into a byte code file.
In step 206, a front end code load packet is generated based on the bytecode file.
It should be noted that, in the embodiment of the present disclosure, the front end code to be processed may be all the front end codes corresponding to a certain target page, or may be a part of the front end codes corresponding to a certain target page, for example, a part of the front end codes related to service core logic.
In addition, in the embodiment of the present disclosure, the above-mentioned bytecode file refers to a file in a bytecode format obtained by processing a source code of a front-end code, and its expression form may be regarded as a binary form. In general, the difficulty of reverse engineering of a byte code file is very high, so that the use of the byte code file to replace all or part of the front-end code can effectively avoid or reduce the risk of the front-end code being cracked, stolen and tampered.
Further, in some embodiments of the present disclosure, the above-described bytecode file may be embodied as a network compilation (WebAssembly, WASM) file. WASM is a new coding format and can run in a browser, and WASM can coexist with JavaScript. Furthermore, WASM has a bytecode format. That is, the WASM's representation is a series of data in binary form. Therefore, the difficulty of reverse engineering of the WASM file is very high, and thus, using the WASM file as the above-mentioned byte code file to replace all of the front-end code or a part of the front-end code can effectively avoid or reduce the risk of the front-end code being cracked, stolen and tampered. Moreover, the WASM, as a cross-platform execution format, may be executed on a variety of browsers and operating systems, and also provides a wide range of compatibility and portability for the methods described in the embodiments of the present disclosure.
The steps of the processing method of the front end code will be described in detail with reference to the accompanying drawings and specific examples.
For the step 202, in an embodiment of the present disclosure, the acquiring the front end code to be processed may specifically include: firstly, acquiring a first front-end code file from a first appointed path; then, the first front-end code file is used as the front-end code to be processed.
In the embodiment of the disclosure, the first specified path is one or more paths storing front end codes corresponding to target pages to be processed. Specifically, as described above, the front end codes to be processed may be all the front end codes corresponding to the target page requested to be displayed by the user. In addition, in consideration of that the volume of the file is greatly increased after the source code of the front-end code is converted into the byte code file, the front-end code to be processed may be a part of the front-end code corresponding to the target page, for example, may be a part of the front-end code related to the service core logic. Therefore, in the case that the front end codes to be processed are all the front end codes corresponding to the target page requested to be displayed by the user, the first specified path is one or more paths for storing the front end codes corresponding to the target page; the first front end code file is one or more files of the front end codes corresponding to the target page. In the case that the front end code to be processed is a part of the front end code corresponding to the target page requested to be displayed by the user, the first specified path is one or more paths storing the part of the front end code corresponding to the target page; the first front-end code file is one or more code files to be processed in the front-end code corresponding to the target page. In some specific embodiments, the first specified path is a preset path for storing a part of source codes related to the service core logic in the front-end code; for other portions of source code that do not involve business core logic, they may be deposited under other designated paths, such as under a third designated path described below. After the setting, when the service developer performs service development, part of source codes related to service core logic in front-end codes are stored in the first appointed path; and other parts of the source code which do not relate to business core logic are stored under other specified paths. The processing has the advantages that the increase of the front-end code volume and the performance reduction are reduced while the front-end code security is ensured, and the loading speed and the user experience of the front-end code loading data packet are improved.
As mentioned above, in the present stage, most of the front end code of the target page is JavaScript source code, while JavaScript is a weak type scripting language, when defining variables, it is not necessary to determine specific types of variables, and the program will automatically determine the types of variables during the running process. However, in general, the type of variable defined therein needs to be determined in the process of converting JavaScript code into a bytecode file, and thus, in some embodiments of the present disclosure, after the first front-end code file is obtained from the first specified path, the above step 202 will further include the steps of: firstly, determining whether the first front-end code file is a strong type language file; then, in response to determining that the first front-end code file is not a strongly typed language file, the first front-end code file is converted into a strongly typed language file, and the strongly typed language file obtained through conversion is used as the front-end code to be processed. If the first front-end code file is determined to be a strong type language file, the first front-end code file is not required to be processed, and the first front-end code file is directly used as the front-end code to be processed.
In some embodiments of the present disclosure, the above-described strongly typed language file generally refers to a language in which variable types need to be defined for variables involved in code, such as C++, rust, and type script language (TypeScript), among others.
Specifically, if the first front-end code file is a JavaScript file, the strongly typed language file may be a TypeScript file.
The TypeScript is a superset of JavaScript, is a strong type of script language, contains all elements of JavaScript, and can be loaded to operate JavaScript codes. The TypeScript is added with the characteristics of strong type, interface, class, generalization and the like on the basis of JavaScript, so that an issuer can write codes more safely, efficiently and reliably. Also, in the field of front-end code development, typeScript is becoming one of the mainstream development tools.
In this case, after the first front-end code file is obtained in step 202, it is determined whether the first front-end code file is a TypeScript file or a JavaScript file; if the file is the TypeScript file, directly taking the acquired first front-end code file as the front-end code to be processed; if the file is a JavaScript file, the JavaScript file can be converted into a TypeScript file, and the TypeScript file obtained after conversion is used as the front-end code to be processed. In addition, since TypeScript is a superset of JavaScript, javaScript code can be loaded to run, so the operation of converting the JavaScript file into the TypeScript file is very simple, and the type of the variable in the JavaScript file is only required to be added with definition. It can be seen that in the above method, the processing is very simple for the front-end code programmed using JavaScript, and it is not necessary to rewrite the front-end code into another language.
In addition to the above, if it is determined that the above-described first front-end code file is not a JavaScript file but other weak type language file, it may be converted into some strong type language file, for example, a c++, rust, typeScript file, or the like, according to actual circumstances. However, the converted file is then used as the front-end code to be processed.
If the first front-end code file itself is a strong type language file such as c++ or Rust, the first front-end code file may be directly used as the front-end code to be processed without processing the first front-end code file. And the first front end code file may be directly used as the front end code to be processed.
For the step 204, in the process of converting the front-end code to be processed into a bytecode file, if the bytecode file is a WASM file, in an embodiment of the disclosure, the step 204 may include: and compiling the front-end code to be processed by using a WASM compiler or a WASM tool chain to obtain the byte code file. The step 204 may further include: and storing the byte code file into a second designated path. It can be seen that the above-described second specified path is a path specified in advance for storing the processed bytecode file.
Specifically, in the step 204, if the front end code to be processed is a TypeScript file, a compiler or a tool chain of TypeScript-WASM may be used to compile the TypeScript file to obtain the bytecode file; if the front-end code to be processed is a C++ file, compiling the C++ file by using a compiler or a tool chain of a C++ -WASM to obtain the byte code file; if the front-end code to be processed is a Rust file, a compiler or a tool chain of Rust-WASM may be used to compile the Rust file to obtain the bytecode file. Thus, it can be seen that the method can support various development languages of the front-end code, such as JavaScript, typeScript, C ++ and Rust, and the front-end code developed by the development language can be converted into a WASM file with higher security, and the processing process is simple, and even the front-end code does not need to be rewritten by other languages.
To further increase the security of the front-end code, and reduce the risk of cracking, theft, and tampering thereof, embodiments of the present disclosure will further include, prior to storing the above-described bytecode file in the second designated path: encrypting the byte code file; then, the encrypted byte code file is stored in the second specified path. I.e. stored to the second designated path is an encrypted byte code file. In some embodiments of the present disclosure, encrypting the bytecode file may specifically include: the byte code files are encrypted using a symmetric encryption algorithm or an asymmetric encryption algorithm. The above-described byte code files are encrypted using, for example, AES and/or RSA encryption algorithms. It can be understood that the encrypted byte code file can be executed only after being decrypted in the client or browser of the user, so that the risk of unauthorized access such as cracking, embezzling and tampering of the front-end code can be further effectively prevented by encrypting the byte code file, and confidentiality and integrity of the front-end code in the transmission and storage processes can be ensured.
For the step 206, in some embodiments of the present disclosure, the front end code to be processed is all the front end codes corresponding to the target page, and the process of generating the front end code loading data packet based on the byte code file may refer to obtaining the byte code file from the second specified path and loading the byte code file as the front end code loading data packet.
In other embodiments of the present disclosure, the front-end code to be processed is a part of the front-end code corresponding to the target page, where the generating the front-end code loading data packet based on the bytecode file in step 206 may include: firstly, acquiring a second front-end code file from a third appointed path; obtaining a byte code file from the second designated path; and the second front end code file combines the byte code file with the front end code load data packet.
Wherein the third specified path is one or more paths for storing portions of the front-end code other than the front-end code to be processed, e.g., one or more paths for storing portions of the front-end code other than the core business logic. At this time, the second front-end code file may be the source code of one or more front-end code files of the uncore business logic written in the languages JavaScript, typeScript, C ++ and Rust, etc.
In step 206, the one or more second front-end code files obtained from the third specified path are combined with the bytecode files obtained from the second specified path to form a front-end code load packet. Wherein all or part of the front-end code is replaced with a byte code file that is more secure but still executable by the user's client or browser, thereby improving the security of the front-end code.
When receiving a target page loading request from a client or browser of a user, the server returns a front end code loading data packet corresponding to the target page to the client or browser of the user, loads the front end code loading data packet by the client or browser of the user, and executes corresponding codes in a memory, so that the corresponding target page is displayed for the user. Specifically, a user's client or browser may load and execute a bytecode file through a runtime environment corresponding to the bytecode file. For example, for a WASM file, loading and running of the WASM file may be achieved through a WASM runtime environment of a user's client or browser.
Further, if the bytecode file in the front-end code loading data packet is an encrypted bytecode file, the client or browser of the user needs to perform a corresponding decryption operation on the bytecode file in the front-end code loading data packet.
According to the method, all or part of the front-end file is converted into the byte code file, so that the safety of the front-end file can be greatly improved, and the risks of cracking, embezzling and tampering of the front-end file are reduced. Further, embodiments of the present disclosure provide a higher security and protection mechanism by using WebAssembly, which may efficiently and securely execute front-end code in a user's client or browser.
Fig. 3 illustrates an implementation flow of a more specific front-end code processing method according to some embodiments of the present disclosure. As shown in fig. 3, the method for processing the front-end code may include:
at step 302, a first front end code file is obtained from a first designated path;
in step 304, determining whether the first front-end code file is a strongly typed language file;
in step 306, in response to determining that the first front-end code file is not a strong type language file, converting the first front-end code file into a TypeScript file, and taking the converted TypeScript file as a front-end code to be processed; then, step 310 is performed;
in step 308, in response to determining that the first front-end code file is a strongly typed language file, taking the first front-end code file as a front-end code to be processed; then, step 310 is performed;
in step 310, compiling the front-end code to be processed by using a WASM compiler or a WASM tool chain to obtain a compiled WASM file;
at step 312, encrypting the WASM file;
storing the encrypted WASM file to a second designated path at step 314;
at step 316, a second front end code file is obtained from the third designated path;
at step 318, the second front end code file and the WASM file are combined into a front end code load packet.
The front-end code loading data packet corresponds to a target page, and when a user requests to open a certain target page through a client or a browser, the client or the browser of the user sends a target page loading request to a server. In this case, the server returns a front-end code loading packet corresponding to the target page to the user's client or browser. At this time, after the client or browser of the user loads the front end code loading data packet corresponding to the target page, the target page can be displayed on the display device.
The specific implementation method of each step in the foregoing front-end code processing method may refer to the foregoing embodiment, and will not be repeated herein. Further, as can be seen from the above-described processing method of the front-end code, only a part of the front-end code corresponding to the target page is set as the front-end code to be processed in the above-described method. Compared with the processing mode that all front end codes corresponding to the target page are used as the front end codes to be processed, the processing can realize the protection of core service logic and greatly reduce the size of the front end code loading data packet. The front-end code processing method is compatible with the safety and processing and transmission efficiency of the front-end code, reduces the increase of the front-end code volume and the decrease of the performance while protecting the front-end code safety, and is beneficial to improving the loading speed and the user experience of the application.
Based on the foregoing front-end code processing method, an embodiment of the present disclosure further provides a front-end code processing apparatus, where an internal structure of the front-end code processing apparatus is shown in fig. 4, and may include:
a code acquisition module 410, configured to acquire a front-end code to be processed;
a conversion module 420, configured to convert the front-end code to be processed into a byte code file; and
the data packet generating module 430 is configured to generate a front end code loading data packet based on the byte code file.
Specific implementations of the above modules may refer to the foregoing methods and the accompanying drawings, and the implementation methods of the above modules may refer to the foregoing methods and the accompanying drawings, which are not repeated herein.
For convenience of description, the above devices are described as being functionally divided into various modules, respectively. Of course, the functions of the various modules may be implemented in the same one or more pieces of software and/or hardware when implementing the present disclosure. The device of the foregoing embodiment is configured to implement the processing method of the corresponding front end code in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Accordingly, in the processing device for the front end code provided by the disclosure, the front end code to be processed is firstly converted into a byte code file which can be executed by a client or a browser of a user, and then a front end code loading data packet is generated based on the byte code file obtained through conversion. The front-end code to be processed may include all the front-end codes or only part of the front-end codes related to the service core logic. In this way, the front-end code load packet loaded to the client will no longer include the source code of the front-end code or the source code of the front-end code involving the business core logic portion, but will be replaced with a bytecode file executable by the client or browser of the user. Because the converted byte code file has the characteristics of poor readability, difficult decompilation and the like, the front-end code loading data packet obtained by the front-end code processing device can greatly reduce the risk of cracking, embezzling or tampering the front-end code and improve the safety of the front-end code.
Fig. 5 is a schematic hardware structure of a more specific electronic device according to this embodiment, where the device may include: a processor 2010, a memory 2020, an input/output interface 2030, a communication interface 2040, and a bus 2050. Wherein the processor 2010, the memory 2020, the input/output interface 2030 and the communication interface 2040 enable a communication connection therebetween within the device via the bus 2050.
The processor 2010 may be implemented as a general-purpose CPU (Central Processing Unit ), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, etc. for executing associated programs to implement the solutions provided by the embodiments of the present disclosure.
The Memory 2020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory ), a static storage device, a dynamic storage device, or the like. Memory 2020 may store an operating system and other application programs, and when the embodiments of the present specification are implemented in software or firmware, the associated program code is stored in memory 2020 and executed by processor 2010.
The input/output interface 2030 is used for connecting input/output devices to realize information input and output. The input/output device may be configured in the device as a component, or may be externally connected to the device to provide corresponding functions. Wherein the input devices may include microphones, various types of sensors, etc., and the output devices may include displays, speakers, vibrators, indicator lights, etc.
The communication interface 2040 is used to connect communication modules (not shown) to enable communication interactions of the present device with other devices. The communication module may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
The bus 2050 includes a pathway to transfer information between various components of the device (e.g., the processor 2010, the memory 2020, the input/output interface 2030, and the communication interface 2040).
It should be noted that although the above-described device illustrates only the processor 2010, the memory 2020, the input/output interface 2030, the communication interface 2040 and the bus 2050, the device may include other components necessary for proper operation in a specific implementation. Furthermore, it will be understood by those skilled in the art that the above-described apparatus may include only the components necessary to implement the embodiments of the present description, and not all the components shown in the drawings.
The electronic device of the foregoing embodiment is configured to implement the processing method of the corresponding front end code in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which is not described herein.
Based on the same inventive concept, the present disclosure also provides a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the front end code processing method according to any of the above embodiments, corresponding to any of the above embodiments.
The computer readable media of the present embodiments, including both permanent and non-permanent, removable and non-removable media, may be used to implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device.
The storage medium of the foregoing embodiments stores computer instructions for causing the computer to execute the processing method of the front end code according to any one of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which are not described herein.
Those of ordinary skill in the art will appreciate that: the discussion of any of the embodiments above is merely exemplary and is not intended to suggest that the scope of the disclosure, including the claims, is limited to these examples; the technical features of the above embodiments or in the different embodiments may also be combined under the idea of the present disclosure, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in details for the sake of brevity.
Additionally, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown within the provided figures, in order to simplify the illustration and discussion, and so as not to obscure the embodiments of the present disclosure. Furthermore, the devices may be shown in block diagram form in order to avoid obscuring the embodiments of the present disclosure, and this also accounts for the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform on which the embodiments of the present disclosure are to be implemented (i.e., such specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the disclosure, it should be apparent to one skilled in the art that embodiments of the disclosure can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative in nature and not as restrictive.
While the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of those embodiments will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
The disclosed embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Accordingly, any omissions, modifications, equivalents, improvements, and the like, which are within the spirit and principles of the embodiments of the disclosure, are intended to be included within the scope of the disclosure.

Claims (13)

1. A method of processing front-end code, comprising:
acquiring a front-end code to be processed;
converting the front-end code to be processed into a byte code file; and
and generating a front-end code loading data packet based on the byte code file.
2. The method of claim 1, wherein the acquiring the front-end code to be processed comprises:
acquiring a first front-end code file from a first designated path; and
and taking the first front-end code file as the front-end code to be processed.
3. The method of claim 2, wherein the method further comprises, after retrieving the first front end code file from the first specified path:
determining whether the first front-end code file is a strongly typed language file; and
and in response to determining that the first front-end code file is not the strongly typed language file, converting the first front-end code file into a strongly typed language file, and taking the strongly typed language file obtained through conversion as the front-end code to be processed.
4. A method according to claim 3, wherein the strongly typed language file is a strongly typed scripting language Type Script file.
5. The method of claim 1, wherein the bytecode file is a web compiled WASM file.
6. The method of claim 5, wherein the converting the front-end code to be processed into bytecode comprises:
compiling the front-end code to be processed by using a WASM compiler or a WASM tool chain to obtain the byte code file; and
the byte code file is stored to a second designated path.
7. The method of claim 6, wherein the storing the bytecode to a second specified path comprises:
encrypting the byte code file; and
storing the encrypted byte code file to the second designated path.
8. The method of claim 7, wherein the encrypting the bytecode file comprises: the byte code files are encrypted using a symmetric encryption algorithm or an asymmetric encryption algorithm.
9. The method of claim 6, wherein the generating a front end code load packet based on the bytecode file comprises:
acquiring a second front-end code file from a third designated path;
obtaining the byte code file from the second designated path; and
and combining the second front-end code file and the byte code file into the front-end code loading data packet.
10. A front-end code processing apparatus, comprising:
the code acquisition module is used for acquiring a front-end code to be processed;
the conversion module is used for converting the front-end code to be processed into a byte code file; and
and the data packet generating module is used for generating a front-end code loading data packet based on the byte code file.
11. An electronic device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of processing front-end code according to any of claims 1-9 when the computer program is executed.
12. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of processing the front-end code of any of claims 1-9.
13. A computer program product comprising computer program instructions which, when run on a computer, cause the computer to perform the method of processing front-end code according to any of claims 1 to 9.
CN202310822614.7A 2023-07-05 2023-07-05 Front-end code processing method and related equipment Pending CN116842485A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310822614.7A CN116842485A (en) 2023-07-05 2023-07-05 Front-end code processing method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310822614.7A CN116842485A (en) 2023-07-05 2023-07-05 Front-end code processing method and related equipment

Publications (1)

Publication Number Publication Date
CN116842485A true CN116842485A (en) 2023-10-03

Family

ID=88166706

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310822614.7A Pending CN116842485A (en) 2023-07-05 2023-07-05 Front-end code processing method and related equipment

Country Status (1)

Country Link
CN (1) CN116842485A (en)

Similar Documents

Publication Publication Date Title
US20160203087A1 (en) Method for providing security for common intermediate language-based program
CN108664773B (en) Method and device for protecting Java source code
WO2015058620A1 (en) Method and apparatus for generating installation package corresponding to an application and executing application
US9443064B2 (en) Protecting method and system of java source code
CN109062582B (en) Encryption method and device for application installation package
CN108229112A (en) A kind of operation method and device for protecting application program, application program
US20160162686A1 (en) Method for verifying integrity of dynamic code using hash background of the invention
WO2015149214A1 (en) Method, apparatus, and computer-readable medium for obfuscating execution of application on virtual machine
CN112231702B (en) Application protection method, device, equipment and medium
US10574642B2 (en) Protecting a web server against an unauthorized client application
CN112966227A (en) Code encryption and decryption method and device and storage medium
US20200074077A1 (en) Method for Providing a Security-Critical Software Application on a Computer Unit
US20150026483A1 (en) Systems and Methods for Mobile Application Protection
CN114925338A (en) Compiling method, device, equipment, medium and product
US20140351947A1 (en) Method of generating execution file for mobile device, method of executing application of mobile device, device to generate application execution file, and mobile device
CN117150515B (en) Safety protection method for EDA secondary development source code, electronic equipment and storage medium
CN104657635A (en) Application processing method, device and server
CN107092517B (en) SDK tool package generation method and device
CN110535642B (en) Method for distributing storage keys, intelligent terminal and storage medium
CN116842485A (en) Front-end code processing method and related equipment
CN113220314B (en) APP resource loading and APK generation method, device, equipment and medium
CN114139117A (en) Application program reinforcing method and device, electronic equipment and storage medium
CN114756833A (en) Code obfuscation method, apparatus, device, medium, and program product
CN113836582A (en) Software encryption and decryption method and device, electronic equipment and storage medium
CN113449330A (en) Method for transmitting Javascript encrypted file

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination