--- title: "数据控制规则在按源代码匹配时对JAR文件不起作用" slug: "data-control-rule-doesn-t-work-on-jar-file-when-match-by-source-code" updated: 2026-07-30T03:29:58Z published: 2026-07-30T03:29:58Z canonical: "knowledge.catonetworks.com/data-control-rule-doesn-t-work-on-jar-file-when-match-by-source-code" --- > ## Documentation Index > Fetch the complete documentation index at: https://knowledge.catonetworks.com/llms.txt > Use this file to discover all available pages before exploring further. # 数据控制规则在按源代码匹配时对JAR文件不起作用 ## 问题 当配置为按文件属性匹配且内容类型为"源代码"时,数据控制规则对.JAR文件不起作用。 ## 故障排查 以下数据控制规则被设置为阻止下载内容类型标识为"source_code"的文件。 ![dlp.jpg](https://cdn.document360.io/81d0367c-2b69-4ba8-b412-1c8f46ce677e/Images/Documentation/13207613566621.jpeg?sv=2026-02-06&spr=https&st=2026-11-19T05%3A31%3A24Z&se=2026-11-19T06%3A31%3A24Z&sr=b&sp=r&sig=cCbghCBosyVi03ZLFXML0laeiWQnqWJklN6Q%2FcuJciA%3D) 接下来,我们继续下载两个.jar文件: 1. `java-1.0.jar` 2. `sample.jar` **观察**: `java-1.0.jar`的下载已成功完成。 ![successfuldl.jpg](https://cdn.document360.io/81d0367c-2b69-4ba8-b412-1c8f46ce677e/Images/Documentation/13207588787229.jpeg?sv=2026-02-06&spr=https&st=2026-11-19T05%3A31%3A24Z&se=2026-11-19T06%3A31%3A24Z&sr=b&sp=r&sig=JdMT9AQYtWPMUiOJxFoPwSWiYO04OuAdps2DXGfQEh4%3D) 然而,`sample.jar`的下载被阻止了。 ![blocksourcecode.jpg](https://cdn.document360.io/81d0367c-2b69-4ba8-b412-1c8f46ce677e/Images/Documentation/13207613572381.jpeg?sv=2026-02-06&spr=https&st=2026-11-19T05%3A31%3A24Z&se=2026-11-19T06%3A31%3A24Z&sr=b&sp=r&sig=8l4fj8MZG3e2qFFBFGc%2BAWd4y64dEh6ikhRw%2FT9bkBg%3D) 为什么同一规则会对这两个.jar文件进行不同的处理? ## 解决方案 The reason is because a .jar file can either be a Zip archive or a specialized Java archive (JAR) file. 当识别为Zip存档时,配置为按文件属性匹配且内容类型为"源代码"的上述规则因此不匹配。 这解释了为什么第一个文件`java-1.0.jar`在下载过程中没有被阻止。 我们可以在Linux中使用`File`命令来找出.jar文件的内容类型。 **$ file java-1.0.jar** ![](https://cdn.document360.io/81d0367c-2b69-4ba8-b412-1c8f46ce677e/Images/Documentation/13207433498141.png?sv=2026-02-06&spr=https&st=2026-11-19T05%3A31%3A24Z&se=2026-11-19T06%3A31%3A24Z&sr=b&sp=r&sig=ncbOxG0xEZSO%2FE8Pc5V7rZmqXNlnmC6WjAl3Ls57rBY%3D) **$ file sample.jar** **![](https://cdn.document360.io/81d0367c-2b69-4ba8-b412-1c8f46ce677e/Images/Documentation/13207426744733.png?sv=2026-02-06&spr=https&st=2026-11-19T05%3A31%3A24Z&se=2026-11-19T06%3A31%3A24Z&sr=b&sp=r&sig=1V7LNEq8Sy8%2F6dVtmiSNDaUqTuLW6iz4Fw0fzlSJi0A%3D)** 如果意图是阻止所有JAR文件,而不管内容类型如何,那么解决方案就是在规则中也包括"Archives"内容类型。 请注意,这也会匹配所有存档文件,如cab, tar, zip, gzip等。 ![](https://cdn.document360.io/81d0367c-2b69-4ba8-b412-1c8f46ce677e/Images/Documentation/13207575615261.png?sv=2026-02-06&spr=https&st=2026-11-19T05%3A31%3A24Z&se=2026-11-19T06%3A31%3A24Z&sr=b&sp=r&sig=0Q1zjEbFLx66SCKvc3nZmXev17QC7bYbIs%2FVVXuLz4E%3D)