app-info 3.4.0 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8240bf7236451c5971d0ee28d067689605f6470b0f64cd3ff21d54f3dac415c7
4
- data.tar.gz: bb88f65d0f66be67b0f94ddfa4d1061346b974b1974eb36b7be7c2fbe8be3c73
3
+ metadata.gz: 8741e1605402e8fc7436eaca068ad3de7a2c7006a98759cf02e57427aaa33ac8
4
+ data.tar.gz: 9dcb7617f9c02ebff05e138ac2959a294b107e6fbf97c378a2ec7a1d5be65a52
5
5
  SHA512:
6
- metadata.gz: 9bea1da034bd88f84768c0d899cf5b03d4bc746e90fc1252d55e01d9006095287c83b23f3e5e865fb97386eb49d659f4ac475c8812c04bad30b39ee4b7a78f5a
7
- data.tar.gz: 7ffeba0577eefc612f8963fd85005ecc763df7bf03f368807276a5537d00902e2ed2ce48da4297c331cc2b688c5e56024716c8a8ecf9fdbdc08f7167b1f809b2
6
+ metadata.gz: ee7e70a2f9cdf8fd167e166cf3ed97e69813a6f4afcd008f5749235e2f1197570761acf49d2be5bd6dfde0007a570faec8af200776687a50a1705afd64d768f4
7
+ data.tar.gz: b7b816b5efbc6c54f77ec7098dc597136c9a88e0142e0e1f3b5cb08ed7805e15bc26d98fbd04bd149e3a1e7df98c9c5f959c72d7334337ea78cef022eeeb6377
data/CHANGELOG.md CHANGED
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
 
10
10
  > List all changes before release a new version.
11
11
 
12
+ ## [3.4.1] (2026-10-31)
13
+
14
+ ### Fixed
15
+
16
+ - Fix APK Signature Scheme v2/v3 verification falsely reports `content_digest_mismatch` when the signing block contains Android verity digest algorithms (`0x0421`/`0x0423`/`0x0425`). Those digest records are now skipped because the plain SHA-256 content digest cannot verify them without the Android verity tree digest.
17
+
12
18
  ## [3.4.0] (2026-09-27)
13
19
 
14
20
  ### Added
data/README.md CHANGED
@@ -522,9 +522,9 @@ It is possible to use this gem as a command line interface to parse mobile app:
522
522
  ```
523
523
  > app-info
524
524
 
525
- app-info (3.4.0)> p = AppInfo.parse('/path/to/app')
525
+ app-info (3.4.1)> p = AppInfo.parse('/path/to/app')
526
526
  => #<AppInfo::APK::......>
527
- app-info (3.4.0)> p.name
527
+ app-info (3.4.1)> p.name
528
528
  => "AppName"
529
529
  ```
530
530
 
@@ -91,6 +91,12 @@ module AppInfo::Helper
91
91
  max_bytes: AppInfo::Android::Signature::UINT64_SIZE
92
92
  ) do |digest|
93
93
  algorithm = digest.read(AppInfo::Android::Signature::UINT32_SIZE).unpack('C*')
94
+ if verity_algorithm?(algorithm)
95
+ logger.debug "Skip verity content digest algorithm 0x#{algorithm.pack('C*').unpack1('H*')} " \
96
+ 'because its digest can not be verified without Android verity tree digest'
97
+ next
98
+ end
99
+
94
100
  digest_name = algorithm_match(algorithm)
95
101
  next unless digest_name
96
102
 
@@ -150,6 +156,12 @@ module AppInfo::Helper
150
156
  logger: logger
151
157
  ) do |signature|
152
158
  algorithm = signature.read(AppInfo::Android::Signature::UINT32_SIZE).unpack('C*')
159
+ if verity_algorithm?(algorithm)
160
+ logger.debug "Skip verity signature algorithm 0x#{algorithm.pack('C*').unpack1('H*')} " \
161
+ 'because its content digest can not be verified without Android verity tree digest'
162
+ next
163
+ end
164
+
153
165
  digest = algorithm_match(algorithm)
154
166
  next unless digest
155
167
 
@@ -182,6 +194,16 @@ module AppInfo::Helper
182
194
  SIG_STRIPPING_PROTECTION_ATTR_ID = [0x0d, 0xf0, 0xef, 0xbe].freeze # 0xbeeff00d
183
195
  SIG_PROOF_OF_ROTATION_ATTR_ID = [0x8c, 0x6f, 0xa0, 0x3b].freeze # 0x3ba06f8c
184
196
 
197
+ # Verity digest algorithms. Their digest records are 40 bytes long
198
+ # (32 bytes digest + 8 bytes file size) and can NOT be verified against
199
+ # the plain SHA-256 content digest computed over the file. Skipping them
200
+ # keeps the signer verification on standard algorithm records.
201
+ SIG_VERITY_ALGORITHMS = [
202
+ SIG_VERITY_RSA_PKCS1_V1_5_WITH_SHA256,
203
+ SIG_VERITY_ECDSA_WITH_SHA256,
204
+ SIG_VERITY_DSA_WITH_SHA256
205
+ ].freeze
206
+
185
207
  def best_algorithem(algorithems)
186
208
  algorithems.max_by { |algorithem| algorithem_priority(algorithem[:id]) || -1 }
187
209
  end
@@ -195,6 +217,10 @@ module AppInfo::Helper
195
217
  end
196
218
  end
197
219
 
220
+ def verity_algorithm?(algorithm)
221
+ SIG_VERITY_ALGORITHMS.include?(algorithm)
222
+ end
223
+
198
224
  def algorithem_priority(algorithm)
199
225
  case algorithm
200
226
  when SIG_RSA_PSS_WITH_SHA256,
@@ -111,7 +111,6 @@ module AppInfo
111
111
 
112
112
  def _dump_sections(dimensions: false)
113
113
  pos = @io.header.size
114
- optimized = false
115
114
  [].tap do |sections|
116
115
  while pos < @io.size
117
116
  type = @io[pos + 4, 4]
@@ -120,10 +119,7 @@ module AppInfo
120
119
  crc = @io[pos + 8 + length, 4].unpack1('N')
121
120
  pos += length + 12
122
121
 
123
- if type == 'CgBI'
124
- optimized = true
125
- next
126
- end
122
+ next if type == 'CgBI'
127
123
 
128
124
  if type == 'IHDR'
129
125
  width = data[0, 4].unpack1('N')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppInfo
4
- VERSION = '3.4.0'
4
+ VERSION = '3.4.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app-info
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
@@ -227,6 +227,20 @@ dependencies:
227
227
  - - ">="
228
228
  - !ruby/object:Gem::Version
229
229
  version: '10.0'
230
+ - !ruby/object:Gem::Dependency
231
+ name: logger
232
+ requirement: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ type: :development
238
+ prerelease: false
239
+ version_requirements: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
230
244
  description: Teardown tool for ipa, apk, aab, hap mobile files and Windows, macOS
231
245
  and dSYM file, even support for info.plist and .mobileprovision files
232
246
  email:
@@ -320,7 +334,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
320
334
  - !ruby/object:Gem::Version
321
335
  version: '0'
322
336
  requirements: []
323
- rubygems_version: 3.6.9
337
+ rubygems_version: 4.0.20
324
338
  specification_version: 4
325
339
  summary: Teardown tool for all most app, analysis metedata like version, name, icon
326
340
  test_files: []