cocoapods-privacy 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6483e616caac6ef86430a25f23bc8f9dd0ea9b61677392d2dbe348170d679d37
4
- data.tar.gz: 07a796d452a9ad9a6e9e8b0883612c9ec9fb38b40d9dce46a6ecd290026b7a6d
3
+ metadata.gz: c4f7ccdf608fd542826f1c394ff71582844055dcc56b89640eeeafa1f145fab3
4
+ data.tar.gz: 8fa3fd48b5af2c593fa3d3228430b7e14adbb896c16e3f5361ff78c4c211b390
5
5
  SHA512:
6
- metadata.gz: a529a41b248f662a4ad21b55a73902875c0b8d530128fe36c472b36888cd511ff5e6a15c7ec1d7a8f8f6f28592dfc3055b8216b8f050c466bc00954973283581
7
- data.tar.gz: 12c36de4eee58b504c3bd6725ba16cb71db052560882264507289a46381ecf8f980533e10b21582fc9349aa2c709f13cfaed83494c0b887179a596d8c0421b1e
6
+ metadata.gz: be57d03bef6be72e12048d92e0b78b9b0557db7af38e209bd38207f7bd895ffbc4dfa65548fe7437fbfae88207b4b57300f3ebb5f7783191ea3511e7c240dc53
7
+ data.tar.gz: 191b66a04667d812add2a3b621b5aec81540363f08481040e4407d2a2624c932d66edebe618f525512e88e5a36ea956f66fdf50d028e7b2d3cef459eb34eb610
@@ -4,6 +4,8 @@ module Pod
4
4
  class Config
5
5
  attr_accessor :privacy_folds
6
6
  attr_accessor :is_privacy
7
+ attr_accessor :is_query
8
+ attr_accessor :is_all
7
9
  end
8
10
  end
9
11
 
@@ -16,6 +18,8 @@ module Pod
16
18
  [
17
19
  ['--privacy', '使用该参数,会自动生成并更新PrivacyInfo.xcprivacy'],
18
20
  ['--privacy-folds=folds', '指定文件夹检索,多个文件夹使用逗号","分割'],
21
+ ['--query', '仅查询隐私api,不做写入'],
22
+ ['--all', '忽略黑名单和白名单限制,查询工程所有组件'],
19
23
  ].concat(origin_options)
20
24
  end
21
25
  end
@@ -24,10 +28,14 @@ module Pod
24
28
  def initialize(argv)
25
29
  privacy_folds = argv.option('privacy-folds', '').split(',')
26
30
  is_privacy = argv.flag?('privacy',false)
31
+ is_query = argv.flag?('query',false)
32
+ is_all = argv.flag?('all',false)
27
33
  privacy_origin_initialize(argv)
28
34
  instance = Pod::Config.instance
29
35
  instance.privacy_folds = privacy_folds
30
36
  instance.is_privacy = is_privacy
37
+ instance.is_query = is_query
38
+ instance.is_all = is_all
31
39
  end
32
40
  end
33
41
  end
@@ -13,11 +13,18 @@ module Pod
13
13
  def self.options
14
14
  [
15
15
  ["--folds=folds", '传入自定义搜索文件夹,多个文件目录使用“,”分割'],
16
+ ['--query', '仅查询隐私api,不做写入'],
17
+ ['--all', '忽略黑名单和白名单限制,查询工程所有组件'],
16
18
  ].concat(super)
17
19
  end
18
20
 
19
21
  def initialize(argv)
20
22
  @folds = argv.option('folds', '').split(',')
23
+ is_query = argv.flag?('query',false)
24
+ is_all = argv.flag?('all',false)
25
+ instance = Pod::Config.instance
26
+ instance.is_query = is_query
27
+ instance.is_all = is_all
21
28
  super
22
29
  end
23
30
 
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPrivacy
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -77,6 +77,10 @@ module PrivacyHunter
77
77
 
78
78
 
79
79
  def self.write_to_privacy(json_data,privacy_path)
80
+
81
+ # 如果指定了--query 参数,那么不进行写入操作,仅用来查询
82
+ return if Pod::Config.instance.is_query
83
+
80
84
  # 转换 JSON 为 plist 格式
81
85
  plist_data = `echo '#{json_data}' | plutil -convert xml1 - -o -`
82
86
 
@@ -227,7 +231,7 @@ module PrivacyHunter
227
231
  apis_found = {}
228
232
  all_files.each_with_index do |file_path, index|
229
233
  api_contains = contains_apis?(file_path, apis)
230
- apis_found = apis_found.merge(api_contains)
234
+ apis_found = apis_found.merge(api_contains) unless Pod::Config.instance.is_query # 如果指定了--query 参数,那么不进行写入操作,仅用来查询
231
235
 
232
236
  unless api_contains.empty?
233
237
  log = "File #{file_path} contains the keyword '#{api_contains.keys}'.\n"
@@ -28,6 +28,9 @@ module Pod
28
28
  return false
29
29
  end
30
30
 
31
+ # 如果指定了--all 参数,那么忽略黑名单白名单,全部检索
32
+ return true if Pod::Config.instance.is_all
33
+
31
34
  # 判断域名白名单 和 黑名单,确保该组件是自己的组件,第三方sdk不做检索
32
35
  config = Privacy::Config.instance
33
36
  git_source_whitelisted = config.source_white_list.any? { |item| git_source.include?(item) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-privacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - youhui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-04 00:00:00.000000000 Z
11
+ date: 2024-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
- version: '0'
80
+ version: 2.7.0
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - ">="