Method and device for preventing illegal acquisition of coded file indicator source code
By compiling and verifying the indicator metadata and calling relationships of code files, establishing associations and storing them in the data structure server, the problems of high difficulty of bytecode obfuscation and high learning costs in the existing technology are solved, and the security of code files is achieved. performance and normal operation.
Patent Information
- Application Number
- CN202210134185.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-14
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-02-14
AI Technical Summary
When existing technology prevents illegal acquisition of code files, bytecode obfuscation is difficult and can easily lead to bugs. It cannot effectively resist experienced R&D personnel, and the learning cost is high.
By compiling the indicator metadata and calling relationship of the code file, the target encoding file is constructed, and its legality is tested in the static file server. The association between the calling indicator and the called indicator is established, stored in the data structure server, and the permissions are verified. Then open data access permissions.
It ensures the security of code files, avoids illegal access by unauthorized users, reduces the learning cost of R&D personnel, and ensures the normal operation of indicator metadata.
Smart Images

Figure CN114564739B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of encryption technology, and in particular to a method for preventing illegal acquisition of source code of coded file indicators. Background Art
[0002] When the code file is uploaded to the static file server, there is a risk that the code logic may be illegally obtained by unauthorized users. For technicians in this field, the code file or code logic is open and has no confidentiality.
[0003] To solve the above problems, the existing technology mainly adopts the method of obfuscation encryption, that is, adding bytecodes to the code files and adding a large amount of code information under the attribute names. However, this method only increases the degree of reading interference, and the specific disadvantages are as follows:
[0004] 1. It is difficult to add bytecode obfuscation to code files. R&D personnel need to master assembly and disassembly related technologies, and the learning cost is too high.
[0005] 2. Bytecode obfuscation can easily lead to unexpected bugs in the code, which can cause the program to fail to run;
[0006] 3. Even if bytecode obfuscation is added, it can only prevent novice crackers and cannot resist experienced R&D personnel.
[0007] The information disclosed in the background technology section of this application is only intended to deepen the understanding of the general background technology of this application, and should not be regarded as an admission or any form of implication that the information constitutes the prior art already known to those skilled in the art. Summary of the invention
[0008] The embodiments of the present disclosure provide a method and device for preventing illegal acquisition of the source code of an encoding file indicator, which can at least solve some of the problems in the prior art.
[0009] In a first aspect of the embodiments of the present disclosure,
[0010] A method for preventing illegal acquisition of the source code of the coded file indicator is provided, comprising:
[0011] Compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file;
[0012] Uploading the target encoded file to a static file server, and checking the legitimacy of the target encoded file according to preset checking rules;
[0013] If the target coded file is legal, determining whether the calling relationship pre-stored in the static file server matches the calling relationship in the target coded file;
[0014] If there is a match, an association relationship between the calling indicator and the called indicator is established, and the association relationship is stored in the data structure server.
[0015] In an optional embodiment,
[0016] After storing the association relationship in the data structure server, the method further includes:
[0017] Obtaining the association relationship in the data structure server;
[0018] According to the association relationship and the preset reflection relationship, the associated indicator in the association relationship is obtained.
[0019] In an optional embodiment,
[0020] Before obtaining the association relationship in the data structure server, the method further includes:
[0021] Verifying the authority of the target object of the association relationship according to the authority data pre-stored in the data structure server;
[0022] If the authority of the target object matches the pre-stored authority data, the data acquisition authority is opened to the target object.
[0023] In an optional embodiment,
[0024] The indicator metadata includes at least one of an indicator name, an indicator code, an indicator label, an indicator output type, and an indicator description.
[0025] In an optional embodiment,
[0026] The preset inspection rules include:
[0027] Determine whether the indicator metadata exists, whether the indicator metadata is legal, and whether the syntax of the indicator metadata is correct;
[0028] The method for checking the legitimacy of the target encoding file according to the preset checking rules includes:
[0029] Based on the preset verification rules, it is determined in turn whether each item of the indicator metadata in the target encoding file matches the preset verification rules.
[0030] In a second aspect of the embodiments of the present disclosure,
[0031] Provided is a device for preventing illegal acquisition of a coded file indicator source code, the device comprising:
[0032] The first unit is used to compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file;
[0033] The second unit is used to upload the target encoded file to a static file server and check the legitimacy of the target encoded file according to a preset inspection rule;
[0034] The third unit is used to determine whether the calling relationship pre-stored in the static file server matches the calling relationship in the target coding file when the target coding file is legal;
[0035] The fourth unit is used to establish an association relationship between the calling indicator and the called indicator if there is a match, and store the association relationship in the data structure server.
[0036] In an optional embodiment,
[0037] The device further comprises a fifth unit, wherein the fifth unit is configured to:
[0038] Obtaining the association relationship in the data structure server;
[0039] According to the association relationship and the preset reflection relationship, the associated indicator in the association relationship is obtained.
[0040] In an optional embodiment,
[0041] The device further comprises a sixth unit, wherein the sixth unit is configured to:
[0042] Verifying the authority of the target object of the association relationship according to the authority data pre-stored in the data structure server;
[0043] If the authority of the target object matches the pre-stored authority data, the data acquisition authority is opened to the target object.
[0044] In an optional embodiment,
[0045] The indicator metadata includes at least one of an indicator name, an indicator code, an indicator label, an indicator output type, and an indicator description.
[0046] In an optional embodiment,
[0047] The preset inspection rules include:
[0048] Determine whether the indicator metadata exists, whether the indicator metadata is legal, and whether the syntax of the indicator metadata is correct;
[0049] The second unit is also used for:
[0050] Based on the preset verification rules, it is determined in turn whether each item of the indicator metadata in the target encoding file matches the preset verification rules.
[0051] In a third aspect of the embodiments of the present disclosure,
[0052] An electronic device is provided, comprising:
[0053] processor;
[0054] a memory for storing processor-executable instructions;
[0055] The processor is configured to call the instructions stored in the memory to execute the method described in the first aspect of the aforementioned embodiment of the present disclosure.
[0056] In a fourth aspect of the embodiments of the present disclosure,
[0057] A computer-readable storage medium is provided, on which computer program instructions are stored, characterized in that when the computer program instructions are executed by a processor, the method described in the first aspect of the embodiment of the present disclosure is implemented.
[0058] The present disclosure provides a method for preventing illegal acquisition of coded file indicator source code, comprising:
[0059] Compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file;
[0060] Uploading the target encoded file to a static file server, and checking the legitimacy of the target encoded file according to preset checking rules;
[0061] If the target coded file is legal, determining whether the calling relationship pre-stored in the static file server matches the calling relationship in the target coded file;
[0062] If there is a match, an association relationship between the calling indicator and the called indicator is established, and the association relationship is stored in the data structure server.
[0063] The method disclosed in the present invention can store the target coding file in the data structure server, so that unauthorized users cannot illegally obtain it, thereby ensuring the security of the indicator metadata in the target coding file;
[0064] In addition, there is no need to modify the bytecode of the indicator metadata in the target encoding file, which ensures the normal operation of the indicator and reduces the learning cost, so that R&D personnel only need to focus on the indicator logic itself. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1A flowchart of a method for preventing illegal acquisition of a coding file indicator source code according to an embodiment of the present disclosure is exemplarily shown;
[0066] Figure 2 The structural diagram of the device for preventing illegal acquisition of the source code of the indicator of the encoding file according to the embodiment of the present disclosure is exemplarily shown. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.
[0068] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in sequences other than those illustrated or described herein.
[0069] It should be understood that in the various embodiments of the present disclosure, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0070] It should be understood that in the present disclosure, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0071] It should be understood that in the present disclosure, "plurality" refers to two or more than two. "And / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "Contains A, B and C", "Contains A, B, C" means that A, B, and C are all included, "Contains A, B or C" means that one of A, B, and C is included, and "Contains A, B and / or C" means that any one, any two, or any three of A, B, and C are included.
[0072] It should be understood that in this disclosure, "B corresponding to A", "B corresponding to A", "A and B
[0073] "Corresponding" or "B corresponds to A" means that B is associated with A and B can be determined based on A. Determining B based on A does not mean determining B based only on A, but B can also be determined based on A and / or other information. A and B match when the similarity between A and B is greater than or equal to a preset threshold.
[0074] Depending on the context, "if" as used herein may be interpreted as "when" or "when" or "in response to determining" or "in response to detecting."
[0075] The technical solution of the present disclosure is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0076] Figure 1 The flowchart of the method for preventing illegal acquisition of the source code of the coding file indicator according to the embodiment of the present disclosure is shown as an example. Figure 1 As shown, the method includes:
[0077] S101, compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file;
[0078] Exemplarily, the coding file of the embodiment of the present disclosure may include a file compiled in the current coding language. For illustrative purposes, the embodiment of the present disclosure takes Python as the coding language as an example. The existing code file or code logic is open and has no confidentiality.
[0079] The present disclosure constructs a target encoding file and subsequently uploads it to a static file server, so that the encoding file can be pre-set to facilitate later file calls, etc.
[0080] In an optional embodiment,
[0081] The indicator metadata includes at least one of an indicator name, an indicator code, an indicator label, an indicator output type, and an indicator description.
[0082] Exemplarily, when compiling metadata of various indicators of the current encoded file, a table name can be identified by a special symbol, where other indicators need to be called, that is, there is an association relationship with other indicators.
[0083] S102, uploading the target coded file to a static file server, and checking the legitimacy of the target coded file according to a preset checking rule;
[0084] In an optional embodiment,
[0085] The preset inspection rules include:
[0086] Determine whether the indicator metadata exists, whether the indicator metadata is legal, and whether the syntax of the indicator metadata is correct;
[0087] The method for checking the legitimacy of the target encoding file according to the preset checking rules includes:
[0088] Based on the preset verification rules, it is determined in turn whether each item of the indicator metadata in the target encoding file matches the preset verification rules.
[0089] Exemplarily, the preset verification rules can comprehensively verify the legitimacy of the target encoding file and avoid omissions in a certain dimension.
[0090] S103, if the target coded file is legal, determining whether the calling relationship pre-stored in the static file server matches the calling relationship in the target coded file;
[0091] Optionally, during the upload of Python indicators, the indicator governance system can be used to verify whether the indicator metadata (including IndexName, IndexCode, OutputFormat, IndexTag, Description) exists, whether the metadata is legal (OutputFormat can only contain "value", "string", "date"), and whether the indicator syntax is correct (that is, whether it meets the Python 3 syntax) to verify the legitimacy of the indicator.
[0092] On this basis, you can check whether the associated / called indicator already exists in the static file server. If not, an exception is thrown to prohibit uploading;
[0093] If it exists, the association relationship between the calling indicator and the called indicator is automatically established, and the association relationship is saved in the data structure server.
[0094] S104: If there is a match, an association relationship between the calling indicator and the called indicator is established, and the association relationship is stored in a data structure server.
[0095] By storing the target encoding file in the data structure server, unauthorized users cannot illegally obtain it, so the security of the indicator metadata in the target encoding file can be guaranteed.
[0096] In an optional embodiment,
[0097] After storing the association relationship in the data structure server, the method further includes:
[0098] Obtaining the association relationship in the data structure server;
[0099] According to the association relationship and the preset reflection relationship, the associated indicator in the association relationship is obtained.
[0100] In an optional embodiment,
[0101] Before obtaining the association relationship in the data structure server, the method further includes:
[0102] Verifying the authority of the target object of the association relationship according to the authority data pre-stored in the data structure server;
[0103] If the authority of the target object matches the pre-stored authority data, the data acquisition authority is opened to the target object.
[0104] For example, when using it, you can first obtain the association relationship in the data structure server, and then obtain the associated indicator by reflection. If the associated indicator is not in the static file server, there is a risk that the associated indicator cannot be found during use, so that the indicator cannot be used. In order to eliminate this risk, it is necessary to verify when uploading the indicator.
[0105] By verifying the authority of the target object, that is, determining whether the authority of the target object matches the pre-stored authority data, it is possible to ensure that the data is not obtained by users with illegal authority, thereby further ensuring the security of the data.
[0106] In addition, it should be noted that the indicators in the indicator metadata of the embodiment of the present disclosure can be used to illustrate the concept of the overall comprehensive quantitative characteristics. For example, in the industrial census, all industrial enterprises constitute the overall, and the total number of industrial enterprises, the total number of industrial employees, the total wages, the average wage, the total value of fixed assets, the total profit, etc. are indicators, which all reflect the quantitative characteristics of the overall from different aspects. The embodiment of the present disclosure does not limit this.
[0107] The present invention provides a method for preventing illegal acquisition of coded file indicator source code, comprising:
[0108] Compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file;
[0109] Uploading the target encoded file to a static file server, and checking the legitimacy of the target encoded file according to preset checking rules;
[0110] If the target coded file is legal, determining whether the calling relationship pre-stored in the static file server matches the calling relationship in the target coded file;
[0111] If there is a match, an association relationship between the calling indicator and the called indicator is established, and the association relationship is stored in the data structure server.
[0112] The method disclosed in the present invention can store the target coding file in the data structure server, so that unauthorized users cannot illegally obtain it, thereby ensuring the security of the indicator metadata in the target coding file;
[0113] In addition, there is no need to modify the bytecode of the indicator metadata in the target encoding file, which ensures the normal operation of the indicator and reduces the learning cost, so that R&D personnel only need to focus on the indicator logic itself.
[0114] Figure 2 The structural diagram of the device for preventing illegal acquisition of the source code of the coding file indicator according to the embodiment of the present disclosure is exemplarily shown as follows: Figure 2 As shown, the device comprises:
[0115] The first unit 21 is used to compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file;
[0116] The second unit 22 is used to upload the target encoded file to a static file server and check the legitimacy of the target encoded file according to a preset checking rule;
[0117] The third unit 23 is used to determine whether the calling relationship pre-stored in the static file server matches the calling relationship in the target coding file when the target coding file is legal;
[0118] The fourth unit 24 is used to establish an association relationship between the calling indicator and the called indicator if there is a match, and store the association relationship in the data structure server.
[0119] In an optional embodiment,
[0120] The device further comprises a fifth unit, wherein the fifth unit is configured to:
[0121] Obtaining the association relationship in the data structure server;
[0122] According to the association relationship and the preset reflection relationship, the associated indicator in the association relationship is obtained.
[0123] In an optional embodiment,
[0124] The device further comprises a sixth unit, wherein the sixth unit is configured to:
[0125] Verifying the authority of the target object of the association relationship according to the authority data pre-stored in the data structure server;
[0126] If the authority of the target object matches the pre-stored authority data, the data acquisition authority is opened to the target object.
[0127] In an optional embodiment,
[0128] The indicator metadata includes at least one of an indicator name, an indicator code, an indicator label, an indicator output type, and an indicator description.
[0129] In an optional embodiment,
[0130] The preset inspection rules include:
[0131] Determine whether the indicator metadata exists, whether the indicator metadata is legal, and whether the syntax of the indicator metadata is correct;
[0132] The second unit 22 is also used for:
[0133] Based on the preset verification rules, it is determined in turn whether each item of the indicator metadata in the target encoding file matches the preset verification rules.
[0134] It should be noted that the beneficial effects of the embodiments of the device disclosed herein can refer to the beneficial effects of the aforementioned method embodiments, and the embodiments of the present disclosure will not be repeated here.
[0135] In a third aspect of the embodiments of the present disclosure,
[0136] An electronic device is provided, comprising:
[0137] processor;
[0138] a memory for storing processor-executable instructions;
[0139] The processor is configured to call the instructions stored in the memory to execute the method described in the first aspect of the aforementioned embodiment of the present disclosure.
[0140] In a fourth aspect of the embodiments of the present disclosure,
[0141] A computer-readable storage medium is provided, on which computer program instructions are stored, characterized in that when the computer program instructions are executed by a processor, the method described in the first aspect of the embodiment of the present disclosure is implemented.
[0142] It should be noted that the beneficial effects corresponding to the electronic device and the readable storage medium of the embodiments of the present disclosure can refer to the beneficial effects of the aforementioned method embodiments, and the embodiments of the present disclosure will not be repeated here.
[0143] The present disclosure also provides a program product, which includes an execution instruction, which is stored in a readable storage medium. At least one processor of a device can read the execution instruction from the readable storage medium, and at least one processor executes the execution instruction so that the device implements the methods provided in the various embodiments described above.
[0144] Among them, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application-specific integrated circuit (Application Specific Integrated Circuits, abbreviated as: ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist in a communication device as discrete components. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0145] In the above-mentioned terminal or server embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present disclosure may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A method for preventing illegal acquisition of coded file indicator source code, characterized in that: The method comprises: Compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file; wherein the indicator metadata includes at least one of an indicator name, an indicator code, an indicator label, an indicator output type and an indicator description; the calling relationship associated with the indicator metadata indicates that when compiling the indicator metadata of the current encoding file, a table name is identified by a special symbol, and other indicators need to be called here, that is, there is an association relationship with other indicators; Uploading the target encoded file to a static file server, and checking the legitimacy of the target encoded file according to preset checking rules; In the case where the target encoded file is legal, determining whether the call relationship pre-stored in the static file server matches the call relationship associated with the indicator metadata in the target encoded file; If there is a match, an association relationship between the calling indicator and the called indicator is established, and the association relationship is stored in the data structure server.
2. The method according to claim 1, characterized in that After storing the association relationship in the data structure server, the method further includes: Obtaining the association relationship in the data structure server; According to the association relationship, the called indicator in the association relationship is obtained by reflection.
3. The method according to claim 2, characterized in that Before obtaining the association relationship in the data structure server, the method further includes: Verifying the authority of the target object of the association relationship according to the authority data pre-stored in the data structure server; If the authority of the target object matches the pre-stored authority data, the data acquisition authority is opened to the target object.
4. The method according to claim 1, characterized in that: The preset inspection rules include: Determine whether the indicator metadata exists, whether the indicator metadata is legal, and whether the syntax of the indicator metadata is correct; The method for checking the legitimacy of the target encoding file according to the preset checking rules includes: Based on the preset verification rules, it is determined in turn whether each item of the indicator metadata in the target encoding file matches the preset verification rules.
5. A device for preventing illegal acquisition of the source code of the coded file indicator, characterized in that: The device comprises: The first unit is used to compile the indicator metadata of the current encoding file and the calling relationship associated with the indicator metadata to construct a target encoding file; wherein the indicator metadata includes at least one of an indicator name, an indicator code, an indicator label, an indicator output type and an indicator description; the calling relationship associated with the indicator metadata indicates that when compiling the indicator metadata of the current encoding file, a table name is identified by a special symbol, and other indicators need to be called here, that is, there is an association relationship with other indicators; The second unit is used to upload the target encoded file to a static file server and check the legitimacy of the target encoded file according to a preset inspection rule; The third unit is used to determine whether the calling relationship pre-stored in the static file server matches the calling relationship associated with the indicator metadata in the target encoding file when the target encoding file is legal; The fourth unit is used to establish an association relationship between the calling indicator and the called indicator if there is a match, and store the association relationship in the data structure server.
6. The device according to claim 5, characterized in that The device further comprises a fifth unit, wherein the fifth unit is configured to: Obtaining the association relationship in the data structure server; According to the association relationship, the called indicator in the association relationship is obtained by reflection.
7. The device according to claim 6, characterized in that The device further comprises a sixth unit, wherein the sixth unit is configured to: Verifying the authority of the target object of the association relationship according to the authority data pre-stored in the data structure server; If the authority of the target object matches the pre-stored authority data, the data acquisition authority is opened to the target object.
8. The device according to claim 5, characterized in that The preset inspection rules include: Determine whether the indicator metadata exists, whether the indicator metadata is legal, and whether the syntax of the indicator metadata is correct; The second unit is also used for: Based on the preset verification rules, it is determined in turn whether each item of the indicator metadata in the target encoding file matches the preset verification rules.
