File access method and device, equipment and storage medium
By identifying file types and access rights matching, it intercepts mismatched file access requests, solving the problems of false interception and high costs in existing technologies and achieving accurate data protection.
Patent Information
- Application Number
- CN202410411076.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-07
- Publication Date
- 2025-10-14
AI Technical Summary
The existing file access control and interception methods often have false interceptions, high development and deployment costs, low versatility, and the risk of data leakage.
By obtaining the file access request of the application process, determining the process ID, read and write permissions and target path, identifying the file type, and determining the access rights based on the process ID, the access request is intercepted if there is a mismatch.
It achieves accurate identification and interception of data leaks, reduces development and deployment costs, improves versatility, avoids management and control loopholes, and effectively prevents data leaks.
Smart Images

Figure CN120780669A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a file access method, apparatus, device, and storage medium. Background Art
[0002] With the continuous development of internet technology, online office methods have become more diverse, such as cloud desktops. In these online office environments, users need to install applications such as browsers to access information and collaborative office software for external communication and collaboration. However, users may use browsers and other tools to upload data files to the public network or send data files externally through collaborative office software, which poses the risk of data leakage.
[0003] To prevent data leaks, some vendors use file access control policies based on learning how certain processes access protected directories. Other vendors implement network filtering by analyzing network protocols and comparing them with classified databases to determine confidentiality. These file access control and interception methods often lead to false interceptions, high development and deployment costs, and limited versatility. These methods also present significant control loopholes and pose a high risk of data leaks. Summary of the Invention
[0004] The present application provides a file access method, apparatus, device and storage medium, which can improve the accuracy of intercepting data leakage, reduce development and deployment costs, have strong versatility, avoid management loopholes, and effectively prevent data leakage.
[0005] In a first aspect, an embodiment of the present application provides a file access method, comprising:
[0006] Obtaining a file access request from an application process, and determining a process identifier corresponding to the file access request, read and write permissions corresponding to the file access request, and a target path of a file to be accessed;
[0007] Determining the target file type of the file to be accessed according to the target path;
[0008] Determining target access rights corresponding to the application process according to the process identifier;
[0009] If the target access permission does not match the target file type and the read and write permissions, the file access request is intercepted.
[0010] In a possible implementation, determining the target file type of the file to be accessed according to the target path includes:
[0011] determine the target file type according to at least one of the attribute information of the file to be accessed and the target path; the target file type comprises an online software directory file, a system file and a data file, wherein, a target file type other than the online software directory file and the system file is a data file.
[0012] In a possible implementation, the determining the target file type according to at least one of the attribute information of the file to be accessed and the target path comprises:
[0013] if the target path corresponds to an online software directory, determining that the target file type of the file to be accessed is the online software directory file; and / or,
[0014] if the target path corresponds to a system directory and the attribute information satisfies a preset condition, determining that the target file type of the file to be accessed is the system file.
[0015] In a possible implementation, the method further comprises:
[0016] determining an application identifier and an installation directory corresponding to an application program when the application program is started;
[0017] determining a working directory corresponding to the application program;
[0018] determining the working directory and the installation directory as online software directories corresponding to the application program, and saving the application identifier and the online software directories.
[0019] In a possible implementation, the attribute information comprises at least one of a file owner, a file digital signature, a file product name, a last modification time and a file format structure.
[0020] In a possible implementation, the method further comprises:
[0021] adjusting a setting item of a registry pre-reading function to a target value, so that the application process cannot use the pre-reading function.
[0022] In a possible implementation, the determining the target access permission corresponding to the application process according to the process identifier comprises:
[0023] determining an application program to which the process identifier belongs according to the process identifier;
[0024] determining the target access permission corresponding to the application process according to a software type corresponding to the application program.
[0025] In a possible implementation, the method further includes:
[0026] If the target access permission matches the target file type and the read-write permission, the application process is allowed to access the file to be accessed.
[0027] In a second aspect, the embodiments of the present application provide a file access device, including:
[0028] An obtaining module is configured to obtain a file access request of an application process, and determine a process identifier corresponding to the file access request, read-write permission corresponding to the file access request, and a target path of a file to be accessed;
[0029] A first determining module is configured to determine a target file type of the file to be accessed according to the target path;
[0030] A second determining module is configured to determine a target access permission corresponding to the application process according to the process identifier;
[0031] An intercepting module is configured to intercept the file access request if the target access permission does not match the target file type and the read-write permission.
[0032] In a possible implementation, the first determining module is specifically configured to:
[0033] Determine the target file type according to at least one of attribute information of the file to be accessed and the target path; the target file type includes an online software directory file, a system file, and a data file, wherein, a target file type other than the online software directory file and the system file is a data file.
[0034] In a possible implementation, the first determining module is specifically configured to include:
[0035] If the target path corresponds to an online software directory, the target file type of the file to be accessed is determined as the online software directory file;
[0036] If the target path corresponds to a system directory, and the attribute information satisfies a preset condition, the target file type of the file to be accessed is determined as the system file.
[0037] In a possible implementation, the device is further configured to:
[0038] When an application program is started, determine an application identifier corresponding to the application program and an installation directory;
[0039] Determine a working directory corresponding to the application program;
[0040] determine the working directory and the installation directory as the online software directory corresponding to the application program, and save the application identifier and the online software directory.
[0041] In a possible implementation, the attribute information includes at least one of a file owner, a file digital signature, a file product name, a last modification time, and a file format structure.
[0042] In a possible implementation, the apparatus is further configured to:
[0043] adjust a setting item of a registry pre-read function to a target value, so that the application process cannot use the pre-read function.
[0044] In a possible implementation, the second determining module is specifically configured to:
[0045] determine an application program to which the process identifier belongs according to the process identifier;
[0046] determine a target access right corresponding to the application process according to a software type corresponding to the application program.
[0047] In a possible implementation, the apparatus is further configured to:
[0048] if the target access right matches the target file type and the read-write right, allow the application process to access the file to be accessed.
[0049] In a third aspect, an embodiment of the present application provides a file access device, including: a processor, a memory;
[0050] the memory stores computer execution instructions;
[0051] the processor executes the computer execution instructions stored in the memory, and implements the file access method in any one of the first aspect.
[0052] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer execution instructions, when the computer execution instructions are executed, the computer execution instructions are used to implement the file access method in any one of the first aspect.
[0053] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, when the computer program is executed, the computer program implements the file access method in any one of the first aspect.
[0054] In a sixth aspect, an embodiment of the present application provides a chip, wherein the chip stores a computer program, and the computer program is executed by the chip to implement the file access method according to any one of the first aspect.
[0055] The file access method, device, equipment and storage medium provided by the embodiments of the present application obtain a file access request of an application process, and determine a process identifier corresponding to the file access request, read-write permissions corresponding to the file access request, and a target path of a file to be accessed; according to the target path, determine a target file type of the file to be accessed; according to the process identifier, determine a target access permission corresponding to the application process; if the target access permission does not match the target file type and the read-write permissions, intercept the file access request. In the present application, the target file type of the file to be accessed is determined, and the target access permission of the application process is determined, and when the target access permission does not match the target file type and the read-write permissions, the file is not allowed to be accessed. In this way, based on the matching of the file type and the permission, accurate interception of the file access behavior in the case of data leakage can be realized, and at the same time, there is no need to establish a confidential database and the like, the development and deployment cost is low, and the versatility is strong. In addition, it can also avoid control loopholes and effectively prevent data leakage. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 It is a schematic diagram of an application scenario;
[0057] Figure 2 It is a flowchart of a file access method provided by an embodiment of the present application;
[0058] Figure 3 It is a flowchart of another file access method provided by an embodiment of the present application;
[0059] Figure 4 It is a judgment logic diagram of a system file provided by an embodiment of the present application;
[0060] Figure 5 It is a schematic diagram of an online software accessing a system file provided by an embodiment of the present application;
[0061] Figure 6 It is a schematic diagram of an online software accessing an online software directory file provided by an embodiment of the present application;
[0062] Figure 7 It is a schematic diagram of an online software accessing a data file provided by an embodiment of the present application;
[0063] Figure 8 It is a schematic diagram of a non-online software modifying an online software directory file provided by an embodiment of the present application;
[0064] Figure 9A structural schematic diagram of a file access device provided by an embodiment of the present application is shown in FIG. 1.
[0065] Figure 10 A structural schematic diagram of a file access device provided by an embodiment of the present application is shown in FIG. 1. DETAILED DESCRIPTION
[0066] For those skilled in the art to better understand the technical solutions of the present application, the present application will be described in further detail below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments and drawings described herein are only used to explain the present application, but not to limit the present application. It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards, and provide corresponding operation portal for user to choose authorization or refusal.
[0067] With the continuous development of Internet technology, online office methods are more diversified, such as cloud desktops, etc. Specifically, through virtualization technology, a virtual machine is run in a server, and a terminal is only responsible for displaying a virtual desktop image and accepting keyboard and mouse messages. At this time, the virtual desktop is called a cloud desktop. The cloud desktop and its data are separated from the physical terminal, which can ensure that the data is always stored on the server, realizing data not falling to the ground. Through peripheral redirection, the access of peripherals can be controlled. Therefore, the cloud desktop environment itself is data safe.
[0068] In the office cloud desktop environment, users usually need to install a browser to review materials, and also need to install collaborative office software to communicate and collaborate externally. However, since the user may upload data files to the public network using the browser, or send data files to the outside through the collaborative office software, there is a risk of leakage. On this basis, the office desktop environment needs to ensure that it can prevent the browser and the collaborative office software from accessing local data files, thereby avoiding data leakage; at the same time, it also needs to ensure that these online software can normally access system files and their own files to ensure their normal operation.
[0069] In related technologies, in order to prevent data leakage, some manufacturers usually use the following processing method:
[0070] First, some manufacturers use file filtering drivers to learn the access behavior of some processes to some protected directories for a period of time (such as 7 days), then report the access behavior of the process to the configuration center, and then issue the policy to let the file filtering driver enter the protection mode and control the file access according to the policy (files that have not been accessed during the learning mode are not allowed to be accessed).
[0071] This processing mode may cause false interception on the one hand because the possible access range of the process cannot be completely obtained in the process of learning the access behavior of the target process, and may cause false interception. When the target software is upgraded or the operating system is patched (such as version upgrade, etc.), the file set that needs to be accessed increases, thereby increasing the risk of false interception. On the other hand, the user can bypass the protection system by copying data files to the system directory and changing them to system file names, and there is a control loophole, and the risk of data leakage is high.
[0072] Secondly, some manufacturers use network filtering drivers to listen to the default port (i.e. 80 port) of Hypertext Transfer Protocol (HTTP) and the default port (i.e. 443 port) of HTTP Secure (HTTPS), parse Secure Sockets Layer / Transport Layer Security (SSL / TLS), restore data packets, parse Internet Protocol (IP) addresses, domain names, Uniform Resource Locator (URL) links, and secret information databases according to http / https message headers, and judge whether it is secret. And extract text information from the message, compare the extracted information with the secret database, and judge whether it is secret. Exemplarily, Windows Filtering Platform (WFP) is a framework for filtering network data in Windows, which is the current mainstream network filtering framework. Windows Filtering Platform can perform network filtering on multiple layers. In the two layers (Layers) at the top, namely FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V4 and FWPM_LAYER_ALE_AUTH_CONNECT_V4, the current application path can be obtained when intercepting network communication, and network filtering based on process can be realized.
[0073] The above processing mode needs to parse various network protocols, including http / https, File Transfer Protocol (FTP), Simple Mail Transfer Protocol (STMP), etc., and also needs to perform ssl / tls decryption; meanwhile, a database of confidential information needs to be created and maintained, which has a large development and deployment cost and is not very versatile. In addition, if the user encrypts and compresses the data file before uploading, the above processing mode cannot identify it.
[0074] Therefore, the file access control and interception method in the related art has many misinterceptions, low interception accuracy, large development and deployment cost, poor versatility, certain control loopholes, and high data leakage risk.
[0075] To solve the above problems, the present application provides a file access method, device, equipment and storage medium. The file filtering driver in the electronic device obtains a file access request of an application process, and determines a process identifier corresponding to the file access request, read-write permissions corresponding to the file access request, and a target path of a file to be accessed. Then, through a file recognition program, the target file type of the file to be accessed is determined according to the target path; the target access permission corresponding to the application process is determined according to the process identifier; if the target access permission matches the target file type and the read-write permission, the application process is allowed to access the file to be accessed; if the target access permission does not match the target file type and the read-write permission, the file access request is intercepted. In this way, the electronic device can accurately identify different target file types through the file recognition program, and determine whether to intercept according to whether the target access permission of the application process matches the target file type and the read-write permission, which can accurately and universally prevent online software from accessing data files, has small cost and deployment cost, is difficult for users to bypass the protection, can avoid control loopholes, and effectively prevent data leakage.
[0076] Figure 1 It is a schematic diagram of an application scenario. As shown in Figure 1 In the related art, some manufacturers prevent data leakage by learning the access behavior of some processes to some protected directories, and then determining a protection strategy based on the learned access behavior; or by listening to network ports, parsing network protocols, comparing with a confidential information database, and determining whether it is confidential to perform network filtering. The two file access methods in the related art have low interception accuracy, large development and deployment cost, poor versatility, and certain control loopholes.
[0077] In the embodiment of the present application, the file filtering driver in the electronic device determines the target file type based on the target path corresponding to the file access request, and simultaneously determines the target access rights of the application process based on the process identifier. Then, based on the matching of the target access rights with the target file type and read / write permissions, it determines whether to intercept the file access request. In this way, the electronic device can accurately identify and intercept file access behaviors that may indicate data leakage, with high versatility, low development and deployment costs, and greater difficulty for users to bypass the protection, effectively preventing data leakage.
[0078] The following is a detailed description of the solutions shown in this application through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be repeated in different embodiments.
[0079] Figure 2 This is a flowchart of a file access method provided in an embodiment of the present application. Figure 2 , the file access methods may include:
[0080] S201: Obtain a file access request from an application process, and determine a process identifier corresponding to the file access request, read and write permissions corresponding to the file access request, and a target path of a file to be accessed.
[0081] The execution subject of the embodiment of the present application can be an electronic device, specifically a file filter driver, a file recognition program, etc. in the electronic device, and of course it can also be a file access device set in the electronic device. The file access device can be implemented by software, or it can be implemented by a combination of software and hardware. For ease of understanding, in the following, the execution subject is taken as an example of an electronic device for explanation, and the network device can specifically be a mobile phone, a computer, a server, etc. The embodiment of the present application does not limit the specific type of electronic device. In addition, the operating system of the electronic device in the embodiment of the present application can be a Windows operating system, a Linux operating system, etc., and of course it can be other operating systems. The embodiment of the present application does not limit this, and the operating system is Windows as an example for explanation.
[0082] In the embodiments of the present application, the application process can be a process of an application program. The file access request can be a request that the application process needs to access a certain file. The file to be accessed can be a file pointed to by the file access request. The process identifier can be process identifier information corresponding to the application process, for example, can be a process number (Identity document, ID) and the like. The read-write permission can be a file opening permission corresponding to the file access request, and specifically can include read-only, write, simultaneous read-write, and deletion, and the like. The read-write permission can be represented based on a specific identifier in the file access request, and of course can also include other permission types and other identification manners, and the embodiments of the present application do not limit this. The target path can be a complete storage path of the file to be accessed.
[0083] In the embodiments of the present application, a file filtering driver can be installed in the electronic device, which can obtain a file access request of an application process, and determine a process identifier corresponding to the file access request, a read-write permission, and a target path of the file to be accessed according to the file access request. Specifically, the file filtering driver can capture read-write operations of an application program on a file and a registry in an operating system (for example, Windows and the like) by using an interface provided by the operating system, that is, obtain a file access request of an application process, and then obtain process identifier, read-write permission, and target path and the like information corresponding to the file access request.
[0084] Exemplarily, when an application layer of the electronic device calls a multifunction function CreateFile to open a file, a PreCreate callback function of the file filtering driver is triggered, and the file filtering driver can obtain an application process ID of the application layer, a target path of the file to be accessed, and a read-write permission and the like based on the callback function.
[0085] S202, determine a target file type of the file to be accessed according to the target path.
[0086] In the embodiments of the present application, the target file type can be a specific file type of the file to be accessed. The target file type can include a system file, an online software directory file, and a data file and the like. The system file can be a necessary file when the operating system runs. The online software directory file can be a file necessary for an application program such as a browser and office software to run online. The data file is a file other than the system file and the online software directory file, for example, a user's internal working document and the like.
[0087] In the embodiments of the present application, the electronic device can also be installed with a file identification program, which can run in the application layer, can determine the type of the file, and determine whether the application process can access the file to be identified according to the access permission of the application process, and then return the identification result to the file filtering driver, and the file filtering driver allows or intercepts the file access request. Specifically, after the file filtering driver in the electronic device obtains the process identifier corresponding to the file access request, the read-write permission corresponding to the file access request, and the target path of the file to be accessed, it can send these information to the file identification program for identification and judgment.
[0088] In this step, the file identification program can first determine the target file type of the file to be accessed based on the target path of the file to be accessed. The specific determination method can be that the file identification program obtains the attribute information of the file to be accessed according to the target path, and then determines the target file type of the file to be accessed according to the target path and the attribute information. Of course, the file identification program can also determine the target file type of the file to be accessed by other means, such as the file content of the file to be accessed, and the present application embodiments are not limited thereto.
[0089] S203, determining the target access permission corresponding to the application process according to the process identifier.
[0090] In the embodiments of the present application, the target access permission can refer to the file access permission corresponding to the application process. The application program corresponding to the application process can be different software types, for example, it can be divided into online software and offline software. Different software types can correspond to different target access permissions. For example, the target access permission corresponding to the online software is to allow access to system files and online software directory files, and to intercept access to other data files; the target access permission corresponding to the offline software is to intercept the offline software from writing files in the online software directory file, and the rest are allowed. Of course, the application process can also correspond to other software types, and correspondingly there can be other target access permissions, which can be flexibly set based on actual needs, and the present application embodiments are not limited thereto.
[0091] In this step, the file identification program in the electronic device can determine the software type corresponding to the application program to which the application process belongs according to the process identifier of the application process, and further determine the target access permission corresponding to the application process. In this way, the electronic device can accurately identify the file type of the file to be accessed and the access permission of the application process through the file identification program, and subsequently compare and match, so as to accurately intercept the access request with data leakage, and the accuracy of interception is higher.
[0092] S204, if the target access permission does not match the target file type and the read-write permission, the file access request is intercepted.
[0093] In the embodiment of the present application, the file identification program compares and matches the target access permission corresponding to the application process with the read-write permission in the file access request according to the target file type corresponding to the to-be-identified file and the file access request, and then sends the matching result to the file filtering driver. If the matching is successful, the file filtering driver allows the application process to access the to-be-accessed file. If the matching is not successful, the file filtering driver intercepts the file access request and does not allow the application process to access the to-be-accessed file.
[0094] For example, if the target access permission corresponding to the application process is to allow access to system files and online software directory files, and does not allow access to data files, and the target file type corresponding to the to-be-identified file is a data file and the read-write permission in the file access request is to read and write at the same time, the file application program can determine that the target access permission does not match the target file type and the read-write permission of the to-be-identified file, and the file filtering driver intercepts the file access request.
[0095] The file access method provided by the embodiment of the present application acquires the file access request of the application process, determines the process identifier corresponding to the file access request, the read-write permission corresponding to the file access request, and the target path of the to-be-accessed file, determines the target file type of the to-be-accessed file according to the target path, determines the target access permission corresponding to the application process according to the process identifier, and intercepts the file access request if the target access permission does not match the target file type and the read-write permission. In the present application, the target file type of the to-be-accessed file is determined, and the target access permission of the application process is determined. When the target access permission does not match the target file type and the read-write permission, the access is not allowed. In this way, based on the judgment and matching of the file type and the permission, accurate interception of the file access behavior in the case of data leakage can be realized, and there is no need to establish a confidential database, the development and deployment cost is low, and the universality is strong. In addition, the control loophole can be avoided, and data leakage can be effectively prevented.
[0096] On the basis of the above-mentioned embodiments, Figure 3 The flowchart of another file access method provided by the embodiment of the present application is shown in FIG. 6. As shown in FIG. 6, the file access method can include the following steps. Figure 3 The file access method can include the following steps.
[0097] S301, acquiring the file access request of the application process, and determining the process identifier corresponding to the file access request, the read-write permission corresponding to the file access request, and the target path of the to-be-accessed file.
[0098] S302, determining a target file type according to at least one of the attribute information of the file to be accessed and the target path; the target file type includes an online software directory file, a system file, and a data file; wherein, a target file type other than the online software directory file and the system file is the data file.
[0099] In the embodiments of the present application, after determining the attribute information of the file to be accessed, the file recognition program in the electronic device can determine the target file type according to the attribute information and the target path of the file to be accessed. In this way, the file recognition program does not need to obtain the file content, and can realize accurate and rapid recognition of the file type.
[0100] In a possible implementation, the attribute information of the file to be accessed can be obtained in the following manner:
[0101] According to the target path, the attribute information of the file to be accessed is read.
[0102] In the embodiments of the present application, the attribute information can refer to various file attribute information of the file to be accessed. The file in the operating system includes specific attribute information. In the Windows operating system, the user can click the right mouse button on the file and select "Properties" to view. The file recognition program in the electronic device can read the attribute information of the file to be accessed, and subsequently determine whether the file to be accessed is a system file according to the attribute information. In this way, accurate recognition of the system file can be realized, and the recognition speed is faster and the recognition efficiency is higher because the file content does not need to be obtained.
[0103] In a possible implementation, the attribute information includes at least one of a file owner, a file digital signature, a file product name, a last modification time, and a file format structure.
[0104] In the embodiments of the present application, the file owner can refer to account information corresponding to the file to be accessed. The system file in the operating system usually corresponds to a specific account. For example, the file owner corresponding to the system file in the Windows operating system can refer to one of "SYSTEM", "TrustedInstaller", and "LOCAL SERVICE". These different accounts are usually used to run operating system services, perform installation tasks, or manage local resources, etc.
[0105] The file digital signature can refer to the digital signature corresponding to the file to be accessed. The system file in the operating system usually includes a specific digital signature, which is used to ensure the authenticity and integrity of the file. For example, various system files such as drivers and plug-ins in the Windows operating system usually include a Microsoft signature.
[0106] The file product name can refer to a product name corresponding to the file to be accessed. System files in an operating system usually include a specific product name corresponding to the type of the operating system. For example, the product name corresponding to the system file in the Windows operating system is usually "Windows" or "Microsoft", etc.
[0107] The last modification time can refer to the last modification time corresponding to the file to be accessed. Since the electronic device will not modify the system file in the normal operation process, the time interval between the last modification time of the system file and the current time is usually relatively long, and the time interval between the last modification time of the data file and the current time is relatively short, on the basis of which the last modification time can be used to determine the system file.
[0108] The file format structure can refer to the file format type of the file to be accessed. The system file usually corresponds to a specific format structure, for example, the Portable Executable (PE) format in the Windows operating system, which can specifically include the ".exe" and ".dll" format types.
[0109] In the embodiments of the present application, the file recognition program in the electronic device can read various types of attribute information of the file to be accessed, determine the file type based on the attribute information, and improve the accuracy of the file type determination. It should be noted that the attribute information of the file to be accessed can also include other types, which are not limited in the embodiments of the present application.
[0110] In a possible implementation, the identification of the target file type in step S302 can be achieved by the following steps (1) and / or (2):
[0111] (1) If the target path corresponds to the online software directory, the target file type of the file to be accessed is determined as the online software directory file.
[0112] In the embodiments of the present application, the online software directory can refer to the storage directory of the online software itself file. When the target path of the file to be identified is included in the online software directory, the file recognition program can determine the target file type of the file to be accessed as the online software directory file.
[0113] The online software directory can be dynamically updated and maintained by the file recognition program. In a possible implementation, the online software directory can be established and maintained by the following method:
[0114] When the application program is started, the application identifier and the installation directory corresponding to the application program are determined; the working directory corresponding to the application program is determined; the working directory and the installation directory are determined as the online software directory corresponding to the application program, and the application identifier and the online software directory are saved.
[0115] In the embodiments of the present application, the application identifier can refer to identifier information corresponding to the application program, for example, an application ID, an application name, etc. The installation directory can refer to the installation path of the application program in the system. The working directory can refer to the directory where the files needed to be used or generated by the application program are located.
[0116] Specifically, the file identification program in the electronic device can traverse the registry when the application program is started, determine the application identifier of the application program, and determine the installation directory corresponding to the application program. Then, the file identification program can record the specific working directory for each application program. Then, the file identification program can take the installation directory and the working directory of the application program as the online software directory of the application program. Subsequently, if the online software accesses the file in the online software directory, the file filtering driver can allow the access, so as to ensure the normal operation of the online software. If the non-online software creates or writes a file in the online software directory, the file filtering driver can intercept the access, so as to avoid data leakage.
[0117] (2) If the target path corresponds to a system directory, and the attribute information meets the preset condition, it is determined that the target file type of the to-be-accessed file is a system file.
[0118] In the embodiments of the present application, the system directory can refer to the directory where the system file is located. The preset condition can refer to the pre-set system file attribute information judgment condition, for example, the file owner is a preset account, the file digital signature is a preset digital signature, the file product name is a preset product name, etc. Specifically, if the file identification program in the electronic device determines that the target path of the to-be-identified file belongs to the system directory, and the attribute information of the to-be-identified file meets the preset condition, the file identification program can determine that the target file type of the to-be-accessed file is a system file.
[0119] Specifically, the file identification program judges the read-write permission corresponding to the file access request, and if the read-write permission is only to obtain file attributes, the access is allowed. If the to-be-accessed file is in a system directory and the file owner is a preset account, such as one of "SYSTEM", "TrustedInstaller", "LOCAL SERVICE", the file identification program can determine that the target file type of the to-be-accessed file is a system file. If the to-be-accessed file is in a system directory and the file digital signature is a preset digital signature, such as the to-be-accessed file has a Microsoft signature, the file identification program can determine that the target file type of the to-be-accessed file is a system file. If the to-be-accessed file is in a system directory and the file product name is a preset product name, such as the product name of the to-be-accessed file contains "Windows" or "Microsoft", the file identification program can determine that the target file type of the to-be-accessed file is a system file.
[0120] It should be noted that the file identification program in the electronic device can also directly determine whether the to-be-accessed file is a system file according to the attribute information of the to-be-accessed file. This identification method may need to identify and judge more files in the directory, and the identification of system files is more comprehensive, but the calculation amount is larger and the identification speed is slower. The file identification program identifies system files based on the system directory corresponding to the target path and the attribute information satisfying the preset condition, and the calculation amount is smaller and the identification speed is faster.
[0121] Exemplarily, Figure 4 A system file judgment logic diagram is provided for the embodiments of the present application. As shown in Figure 4 After obtaining the attribute information of the to-be-accessed file, the file identification program can determine whether the to-be-accessed file is a system file according to the target path and the attribute information of the to-be-accessed file. The file identification program can first determine whether the target path of the to-be-accessed file belongs to a system directory. If not, it can be determined that the to-be-accessed file is not a system file. If yes, the file identification program can further determine whether the file owner of the to-be-accessed file satisfies a preset condition. If yes, it can be determined that the to-be-accessed file is a system file. If not, the file identification program can further determine whether the file digital signature of the to-be-accessed file satisfies a preset condition. If yes, it can be determined that the to-be-accessed file is a system file. If not, the file identification program can further determine whether the file product name of the to-be-accessed file satisfies a preset condition. If yes, it can be determined that the to-be-accessed file is a system file. If not, the file identification program can determine that the to-be-accessed file is not a system file. Of course, Figure 4 The system file judgment process in the above is only an example, and more attribute information can be used for judgment in actual application, which is not limited in the embodiments of the present application.
[0122] In the embodiments of the present application, if the file identification program determines that the to-be-accessed file does not belong to the online software directory file nor the system file, it can determine that the to-be-accessed file is a data file. In this way, the file identification program in the electronic device identifies the file type of the to-be-accessed file based on the target path and attribute information of the to-be-accessed file, that is, identifies based on the file attribute and the directory where the file is located, without involving the file content of the to-be-accessed file, and has small calculation amount and faster identification speed, so that fast and accurate judgment of the file type can be achieved.
[0123] In addition, it should be noted that, since different application programs usually need to use the input method software, the file identification program can determine the file in the input method installation directory as a system file, so that subsequent false interception can be avoided and normal use of the online software can be ensured.
[0124] In S303, the application program to which the process identifier belongs is determined according to the process identifier, and the target access permission corresponding to the application process is determined according to the software type of the application program.
[0125] In the embodiments of the present application, the software type can refer to the specific type of the application program, and can include online software and non-online software, etc. Different software types can correspond to different target access permissions. After obtaining the process identifier of the application process, the file identification program can determine the application program to which the process identifier belongs, and then determine the target access permission corresponding to the application program according to the software type of the application program. In this way, the file identification program can quickly determine the target access permission of the application process based on the process identifier, thereby improving the efficiency of file access processing.
[0126] In a possible implementation, the file access method can further include the following steps:
[0127] The setting item of the registry prefetching function is adjusted to a target value, so that the application process cannot use the prefetching function.
[0128] In the embodiments of the present application, the registry can be used to store the settings, configuration information and other related data of the system and the application program. The prefetching function can refer to the function of the operating system to pre-read and cache the data of frequently used files and programs when the system is idle, so that these data can be loaded faster when needed. The prefetching function usually corresponds to a specific storage path, such as "C:\Windows\Prefetch\" in the Windows system, etc. The setting item of the prefetching function can refer to the setting option field in the registry for managing the prefetching function, and different values in the setting item can represent different functions. The target value can refer to the setting item value of the prefetching function used only by the operating system itself.
[0129] In this step, the electronic device adjusts the setting item of the registry prefetch function to a target value, which can ensure that only the system can use the prefetch function, and the application process cannot use the prefetch function, so that the online software cannot read the files in the storage path corresponding to the prefetch function. For example, in the Windows system, the electronic device can set the EnableSuperfetch of the registry PrefetchParameters to 2, that is, only the system can use the prefetch, so that the online software will not read the files under "C:\Windows\Prefetch\". In this way, the management loophole in the file access process can be avoided, and the data leakage risk is further reduced.
[0130] S304, if the target access permission does not match the target file type and the read-write permission, intercepting the file access request.
[0131] S305, if the target access permission matches the target file type and the read-write permission, allowing the application process to access the to-be-accessed file.
[0132] In the embodiment of the application, the file identification program in the electronic device determines the target file type of the to-be-accessed file and the read-write permission of the file access request, and determines the target access permission of the application process, and then matches the target access permission with the target file type and the read-write permission to obtain a matching result, and sends the matching result to the file filtering driver in the electronic device. If the matching is matched, the file filtering driver allows the application process to access the to-be-accessed file; if the matching is not matched, the file filtering driver does not allow the application process to access the to-be-accessed file, and intercepts the file access request. At this time, the application process can output a preset prompt information, such as "no permission, access failed" and the like, so that the user can intuitively determine the file access situation.
[0133] For example, Figure 5 A schematic diagram of an online software accessing a system file is provided for the embodiment of the application. As shown in Figure 5 When the application process of the online software attempts to access the system file, the file filtering driver intercepts the file access request and first inquires the file identification program; the matching result returned by the file identification program confirms that the access is allowed, and the file filtering driver allows the access, so that the application process of the online software can normally access the system file, and the normal operation of the online software can be ensured.
[0134] For example, Figure 6 A schematic diagram of an online software accessing an online software directory file is provided for the embodiment of the application. As shown in Figure 6As shown, when the application process of the online software attempts to access the online software self directory file, the file filtering driver intercepts the file access request and first inquires the file identification program; the matching result returned by the file identification program confirms that access is allowed, and the file filtering driver allows passing, so that the application process of the online software can normally access the online software self directory file, thereby ensuring normal operation of the online software.
[0135] Exemplarily, Figure 7 A schematic diagram of online software accessing data files is provided for the embodiments of the present application. As shown in Figure 7 As shown, when the application process of the online software attempts to access the data file, the file filtering driver intercepts the file access request and inquires the file identification program. The matching result returned by the file identification program is that access is not allowed, and the file filtering driver does not allow passing, so that the access fails. In this way, the application process of the online software cannot access the data file, thereby ensuring that the online software cannot upload or externally transmit the data file, and avoiding data leakage.
[0136] Exemplarily, Figure 8 A schematic diagram of non-online software modifying online software directory files is provided for the embodiments of the present application. As shown in Figure 8 As shown, when the application process of the non-online software attempts to modify or create the online software directory file (i.e., the read-write permission is write or create, etc.), the file filtering driver intercepts the file access request and inquires the file identification program. The matching result returned by the file identification program is that it is not matched and access is not allowed, and the file filtering driver does not allow passing, so that the access fails. In this way, the application process of the non-online software cannot create or modify the online software directory file, thereby avoiding the user copying the data file to the online software directory and externally transmitting it through the method in Figure 6 , avoiding control loopholes and further reducing the risk of data leakage.
[0137] Of course, in addition to the above Figure 5 , Figure 6 , Figure 7 , Figure 8 , there are also cases that the application process of the non-online software reads any file, or the application program of the non-online software writes a file outside the online software directory file, etc. The file identification program can determine whether the file filtering driver allows passing based on the matching of the target access permission and the target file type, the read-write permission, and of course other cases, which are not limited by the embodiments of the present application.
[0138] In the embodiment of the present application, the file identification program in the electronic device can accurately identify the online software directory file and the system file based on the attribute information and the target path of the to-be-accessed file, and can identify other files except the system file and the online software directory file as data files, and match and determine based on the target access permission of the application process, so that the online software is not allowed to access the data files, the effect of preventing the online software from exporting the data files is achieved, and effective data protection is realized. In this process, the electronic device does not need to be pre-learned, and does not need to be pre-set with a secret database, and the file access method supports the upgrade of the operating system and the online software well, and can cope with the challenges of secret business changes and user confusion of secret content.
[0139] In the embodiment of the present application, the file identification program is used for the to-be-accessed file, if the to-be-accessed file is in the operating system directory, the attribute information of the to-be-accessed file is read to determine whether the file belongs to the system file; if it is not a system file, and the file is not in the online software directory, the data file can be accurately and conveniently identified at this time, so that the protection of the data file is realized.
[0140] In the embodiment of the present application, the identification accuracy of the file identification program for the system file is high, and the module of the file access method in the embodiment of the present application is simple, convenient to deploy and implement, and can be realized based on the file filtering driver and the file identification program, without the need to configure sensitive keywords according to business rules, and without the need to configure a secret database, so the development and deployment cost is low. In addition, the file access method in the embodiment of the present application is simple to implement, does not involve data file format analysis or network transmission protocol analysis, has faster processing speed and higher efficiency; and has high compatibility, and is suitable for different types and different versions of operating systems.
[0141] In the embodiment of the present application, the electronic device can ensure that the user uses the online software on the secret desktop with peace of mind by intercepting the access of the online software to the data file, the security effect is stronger, there is no case of missing interception, the management and control vulnerability can be avoided, and the data leakage risk is further reduced.
[0142] In addition, the identification method for the system file in the embodiment of the present application can also be applied in the application layering scenario. Application layering means that the filtering driver can capture the write operation of the program in Windows to the file and the registry by using the interface provided by Windows, and modify the parameters of the write operation to point to another place, which is called redirection. In the administrator editing virtual machine image stage, the write operation of the software installation package can be redirected to a disk partition (called application layering disk). When Windows reads these files and registries, the two filtering drivers modify the parameters of the read operation to point to the path of the disk partition, so that Windows can normally access the files and registries.
[0143] In the scenario of applying layering, since the user can exist a modification process to the system disk, if the system files in the system disk are redirected, the system files in the split disk can be disordered, affecting the normal use of the user. Therefore, the electronic device can identify the system files, and not redirect and save in the layered disk for the modification of the system files, and the modification of other files can be redirected and saved in the layered disk, so that the data security and stability of applying layering can be ensured, and the normal reading and use of the user can be ensured.
[0144] Figure 9 A structural schematic diagram of a file access device provided by an embodiment of the present application is provided. Referring to Figure 9 , the file access device 90 can include:
[0145] The obtaining module 91 is configured to obtain a file access request of an application process, and determine a process identifier corresponding to the file access request, read-write permissions corresponding to the file access request, and a target path of a file to be accessed.
[0146] The first determining module 92 is configured to determine a target file type of the file to be accessed according to the target path.
[0147] The second determining module 93 is configured to determine a target access permission corresponding to the application process according to the process identifier.
[0148] The intercepting module 94 is configured to intercept the file access request if the target access permission does not match the target file type and the read-write permissions.
[0149] In a possible implementation, the first determining module 92 is specifically configured to:
[0150] determine the target file type according to at least one of attribute information of the file to be accessed and the target path; the target file type includes an online software directory file, a system file, and a data file, wherein a target file type other than the online software directory file and the system file is the data file.
[0151] In a possible implementation, the first determining module 92 is specifically configured to include:
[0152] if the target path corresponds to an online software directory, determine that the target file type of the file to be accessed is the online software directory file; and / or,
[0153] if the target path corresponds to a system directory and the attribute information satisfies a preset condition, determine that the target file type of the file to be accessed is the system file.
[0154] In a possible implementation, the device 90 is further configured to:
[0155] At the application startup, the application corresponding application identifier and installation directory are determined;
[0156] The working directory corresponding to the application is determined;
[0157] The working directory and the installation directory are determined as the online software directory corresponding to the application, and the application identifier and the online software directory are saved.
[0158] In a possible implementation, the attribute information includes at least one of the file owner, the file digital signature, the file product name, the last modification time, and the file format structure.
[0159] In a possible implementation, the apparatus 90 is further configured to:
[0160] The setting item of the registry pre-reading function is adjusted to the target value, so that the application process cannot use the pre-reading function.
[0161] In a possible implementation, the second determining module 93 is specifically configured to:
[0162] According to the process identifier, the application corresponding to the process identifier is determined;
[0163] According to the software type corresponding to the application, the target access permission corresponding to the application process is determined.
[0164] In a possible implementation, the apparatus 90 is further configured to:
[0165] If the target access permission matches the target file type and the read-write permission, the application process is allowed to access the to-be-accessed file.
[0166] The file access apparatus 90 provided by the embodiments of the present application can perform the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.
[0167] Figure 10 A structural diagram of a file access device provided by the embodiments of the present application is shown in FIG. 1. Figure 10 The file access device 100 can include a memory 1001 and a processor 1002. The memory 1001 and the processor 1002 are connected to each other through a bus 1003.
[0168] The memory 1001 is configured to store program instructions;
[0169] The processor 1002 is configured to execute the program instructions stored in the memory, and implement the file access method shown in the above embodiments.
[0170] Figure 10The file access device 100 shown can implement the technical solutions shown in the method embodiments described above, and the implementation principles and beneficial effects are similar, and thus will not be described again.
[0171] The embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer execution instructions. When the computer execution instructions are executed by a processor, the computer execution instructions are used to implement the file access method.
[0172] The embodiment of the present application can also provide a computer program product, including a computer program. When the computer program is executed by a processor, the computer program can implement the file access method.
[0173] The embodiment of the present application provides a chip. The chip stores a computer program. When the computer program is executed by the chip, the file access method is implemented.
[0174] It should be noted that the processor mentioned in the embodiment of the present application can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0175] It should be understood that the memory mentioned in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (Read-Only Memory, ROM), a programmable read-only memory (Programmable ROM, PROM), an erasable programmable read-only memory (Erasable PROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM) or a flash memory. The volatile memory can be a random access memory (Random Access Memory, RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), synchronous dynamic random access memory (Synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (Double Data Rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (Enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (Synch Link DRAM, SLDRAM) and direct memory bus random access memory (Direct Ram Bus RAM, DR RAM). It should be noted that when the processor is a general-purpose processor, a DSP, an ASIC, a FPGA or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, the memory (storage module) is integrated in the processor. It should be noted that the memory described herein is intended to include but not limited to these and any other suitable type of memory.
[0176] It should be understood that the size of the sequence number of each process described above in various embodiments of the present application does not mean the order of execution, and the execution order of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0177] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be realized by computer program instructions. These computer program instructions can be provided to the processing unit of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device produce a machine that implements the functions described in the flowcharts and / or block diagrams.Figure 1 one or more processes and / or blocks Figure 1 an apparatus for performing the functions specified in the flowchart
[0178] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the flowchart Figure 1 one or more processes and / or blocks Figure 1 an apparatus for performing the functions specified in the flowchart
[0179] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the flowchart Figure 1 one or more processes and / or blocks Figure 1 an apparatus for performing the functions specified in the flowchart
[0180] Each module / unit contained in each device / product described in the above embodiments can be a software module / unit, or a hardware module / unit, or part of a software module / unit and part of a hardware module / unit. Each device / product can be applied to or integrated in a chip, a chip module, or a terminal device. Illustratively, for each device / product applied to or integrated in a chip, each module / chip contained therein can be implemented in the form of hardware such as a circuit, or at least part of the modules / units can be implemented in the form of software running on a processor integrated in the chip, and the remaining part of the modules / units can be implemented in the form of hardware such as a circuit.
[0181] In this application, the term "comprising" and its variants are intended to mean non-limiting inclusion; the term "or" and its variants are intended to mean "and / or"; the terms "first", "second", and the like are used to distinguish similar objects, not necessarily in a particular order or sequence. In this application, "multiple" means two or more. "And / or", describes the associated relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents an "or" relationship between the front and rear associated objects.
[0182] The above merely some embodiments of the present application, it should be noted that for those skilled in the art, without departing from the principles of the present application, can make several improvements and refinements, these improvements and refinements should also be considered as the scope of protection of the present application.
Claims
1. A file access method, characterized in that: include: Obtaining a file access request from an application process, and determining a process identifier corresponding to the file access request, read and write permissions corresponding to the file access request, and a target path of a file to be accessed; Determining the target file type of the file to be accessed according to the target path; Determining target access rights corresponding to the application process according to the process identifier; If the target access permission does not match the target file type and the read and write permissions, the file access request is intercepted.
2. The method according to claim 1, characterized in that Determining the target file type of the file to be accessed according to the target path includes: The target file type is determined based on the attribute information of the file to be accessed and at least one of the target paths; the target file types include Internet software directory files, system files, and data files, wherein the target file types other than the Internet software directory files and the system files are data files.
3. The method according to claim 2, characterized in that The determining the target file type according to at least one of the attribute information of the file to be accessed and the target path includes: If the target path corresponds to an Internet software directory, determining that the target file type of the file to be accessed is a file in the Internet software directory; and / or, If the target path corresponds to a system directory and the attribute information meets a preset condition, it is determined that the target file type of the file to be accessed is the system file.
4. The method according to claim 3, characterized in that The method further comprises: When the application is started, determining the application identifier and installation directory corresponding to the application; Determine the working directory corresponding to the application; The working directory and the installation directory are determined as the Internet software directory corresponding to the application program, and the application identifier and the Internet software directory are saved.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: The setting item of the registry pre-reading function is adjusted to a target value so that the application process cannot use the pre-reading function.
6. The method according to claim 1, characterized in that Determining the target access permission corresponding to the application process according to the process identifier includes: Determining, based on the process identifier, the application to which the process identifier belongs; The target access permission corresponding to the application process is determined according to the software type corresponding to the application program.
7. The method according to claim 1, characterized in that The method further comprises: If the target access permission matches the target file type and the read and write permissions, the application process is allowed to access the file to be accessed.
8. A file access device, characterized in that: include: An acquisition module is used to obtain a file access request of an application process and determine a process identifier corresponding to the file access request, read and write permissions corresponding to the file access request, and a target path of a file to be accessed; A first determining module, configured to determine a target file type of the file to be accessed according to the target path; A second determining module is used to determine the target access permission corresponding to the application process according to the process identifier; An interception module is used to intercept the file access request if the target access permission does not match the target file type and the read and write permissions.
9. A file access device, characterized in that: include: Processor, memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the file access method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the file access method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
File protection technique based on Windows system files filtering drive
CN101256570A
Method and system for protecting user privacy in computer
CN104680084A
Multimedia file access control method, terminal and computer readable storage medium
CN107704766A
Application program network access control method, system, equipment and medium
CN117082147A
Application-specific access privileges in a file system
US20220188436A1
Cited By
Kernel layer-oriented file operation request discrimination method and device and storage medium
CN121902140A
