fastlane-plugin-wpmreleasetoolkit 15.1.0 → 15.2.0
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 +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/upload_build_to_apps_cdn.rb +11 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/macos/macos_sign_update.rb +89 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/macos/sparkle_helper.rb +73 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f58be700d1b16e0f0fcf2e02e094f2b955c3867631b86e2e618d77058ee07497
|
|
4
|
+
data.tar.gz: 4624f0dadd623572eb7fe502aeaeceb32bae95b9f5c2e3b5e6868782aa3174d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2096d4592bcd99537893357f1b052e659bf40a24bd907b24ea6ce9c0dd15329de58d4943d2324a4a48fd1290e0b067067a4d04330b818076a6babe740c2865c7
|
|
7
|
+
data.tar.gz: 8d05e52b500bb9a097a5f339bb00930ef38ef2fe3712af5ba7b8244bb3442c09e64e8efbe8684b46997021c092985444b8733b35e0314755746ab8f377389849
|
|
@@ -5,6 +5,7 @@ require 'net/http'
|
|
|
5
5
|
require 'uri'
|
|
6
6
|
require 'json'
|
|
7
7
|
require_relative '../../helper/apps_cdn_helper'
|
|
8
|
+
require_relative '../../helper/macos/sparkle_helper'
|
|
8
9
|
|
|
9
10
|
module Fastlane
|
|
10
11
|
module Actions
|
|
@@ -71,6 +72,7 @@ module Fastlane
|
|
|
71
72
|
post_status: params[:post_status], # Optional: may be nil
|
|
72
73
|
release_notes: params[:release_notes], # Optional: may be nil
|
|
73
74
|
sha: params[:sha], # Optional: may be nil
|
|
75
|
+
ed_signature: params[:ed_signature], # Optional: may be nil
|
|
74
76
|
error_on_duplicate: params[:error_on_duplicate] # defaults to false
|
|
75
77
|
}.compact
|
|
76
78
|
request_body, content_type = build_multipart_request(parameters: parameters, file_path: file_path)
|
|
@@ -311,6 +313,15 @@ module Fastlane
|
|
|
311
313
|
optional: true,
|
|
312
314
|
type: String
|
|
313
315
|
),
|
|
316
|
+
FastlaneCore::ConfigItem.new(
|
|
317
|
+
key: :ed_signature,
|
|
318
|
+
description: 'The base64 EdDSA signature of the uploaded archive, as returned by macos_sign_update',
|
|
319
|
+
optional: true,
|
|
320
|
+
type: String,
|
|
321
|
+
verify_block: proc do |value|
|
|
322
|
+
Helper::SparkleHelper.validate_ed_signature!(value)
|
|
323
|
+
end
|
|
324
|
+
),
|
|
314
325
|
FastlaneCore::ConfigItem.new(
|
|
315
326
|
key: :error_on_duplicate,
|
|
316
327
|
description: 'If true, the action will error if a build matching the same metadata already exists. If false, any potential existing build matching the same metadata will be updated to replace the build with the new file',
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'fastlane/action'
|
|
4
|
+
require_relative '../../helper/macos/sparkle_helper'
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
class MacosSignUpdateAction < Action
|
|
9
|
+
def self.run(params)
|
|
10
|
+
Helper::SparkleHelper.sign_update(
|
|
11
|
+
archive_path: params[:archive_path],
|
|
12
|
+
signing_tool: params[:signing_tool],
|
|
13
|
+
private_key: params[:private_key],
|
|
14
|
+
public_key: params[:public_key]
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.available_options
|
|
19
|
+
[
|
|
20
|
+
FastlaneCore::ConfigItem.new(
|
|
21
|
+
key: :archive_path,
|
|
22
|
+
description: 'The final Sparkle update archive (the zip or dmg users download) to sign, after code signing, notarizing and stapling',
|
|
23
|
+
type: String,
|
|
24
|
+
verify_block: proc do |value|
|
|
25
|
+
UI.user_error!("Archive not found at '#{value}'") unless File.file?(value)
|
|
26
|
+
end
|
|
27
|
+
),
|
|
28
|
+
FastlaneCore::ConfigItem.new(
|
|
29
|
+
key: :signing_tool,
|
|
30
|
+
description: 'The sign_update executable from the app\'s resolved Sparkle release',
|
|
31
|
+
type: String,
|
|
32
|
+
verify_block: proc do |value|
|
|
33
|
+
UI.user_error!("Sparkle signing tool is not executable at '#{value}'") unless File.file?(value) && File.executable?(value)
|
|
34
|
+
end
|
|
35
|
+
),
|
|
36
|
+
FastlaneCore::ConfigItem.new(
|
|
37
|
+
key: :public_key,
|
|
38
|
+
description: 'The SUPublicEDKey value embedded in the app being released',
|
|
39
|
+
type: String,
|
|
40
|
+
verify_block: proc do |value|
|
|
41
|
+
Helper::SparkleHelper.validate_public_key!(value)
|
|
42
|
+
end
|
|
43
|
+
),
|
|
44
|
+
FastlaneCore::ConfigItem.new(
|
|
45
|
+
key: :private_key,
|
|
46
|
+
env_name: 'SPARKLE_PRIVATE_KEY',
|
|
47
|
+
description: 'The exported Sparkle private key (required)',
|
|
48
|
+
type: String,
|
|
49
|
+
sensitive: true,
|
|
50
|
+
# Validate inside the helper: ConfigItem logs invalid values even when marked sensitive.
|
|
51
|
+
# Optional here also avoids prompting for a missing key in unattended release jobs.
|
|
52
|
+
optional: true
|
|
53
|
+
),
|
|
54
|
+
]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.description
|
|
58
|
+
'Sign the final Sparkle update archive with EdDSA'
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.details
|
|
62
|
+
'Pass the sign_update executable from the same Sparkle release used by the app. The private key is sent through standard input and the signature is verified against the app\'s public key. Upload the archive without modifying it after signing.'
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.return_value
|
|
66
|
+
'The canonical base64 EdDSA signature'
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def self.authors
|
|
70
|
+
['Automattic']
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.is_supported?(platform)
|
|
74
|
+
platform == :mac
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def self.example_code
|
|
78
|
+
[
|
|
79
|
+
'signature = macos_sign_update(
|
|
80
|
+
archive_path: "build/App.zip",
|
|
81
|
+
signing_tool: "build/SourcePackages/artifacts/sparkle/Sparkle/bin/sign_update",
|
|
82
|
+
public_key: get_info_plist_value(path: "App/Info.plist", key: "SUPublicEDKey")
|
|
83
|
+
)
|
|
84
|
+
# Pass signature as ed_signature to upload_build_to_apps_cdn.',
|
|
85
|
+
]
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'base64'
|
|
4
|
+
require 'open3'
|
|
5
|
+
require 'openssl'
|
|
6
|
+
|
|
7
|
+
module Fastlane
|
|
8
|
+
module Helper
|
|
9
|
+
module SparkleHelper
|
|
10
|
+
# Signs the final archive using the sign_update executable from the app's resolved Sparkle release.
|
|
11
|
+
# Capture output directly: sign_update can echo invalid keys in its diagnostics, and Action.sh logs output.
|
|
12
|
+
#
|
|
13
|
+
# @return [String] the canonical base64 EdDSA signature
|
|
14
|
+
def self.sign_update(archive_path:, signing_tool:, private_key:, public_key:)
|
|
15
|
+
key = private_key.to_s.strip
|
|
16
|
+
UI.user_error!('A Sparkle private key is required; set SPARKLE_PRIVATE_KEY or private_key') if key.empty?
|
|
17
|
+
unless canonical_base64?(key, lengths: [32, 96])
|
|
18
|
+
UI.user_error!('Sparkle private key must be base64 for a 32-byte seed or a 96-byte legacy key')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
archive_path = File.expand_path(archive_path)
|
|
22
|
+
signing_tool = File.expand_path(signing_tool)
|
|
23
|
+
stdout, _stderr, status = Open3.capture3(
|
|
24
|
+
{ 'SPARKLE_PRIVATE_KEY' => nil }, signing_tool, '-p', '--ed-key-file', '-', archive_path,
|
|
25
|
+
stdin_data: "#{key}\n"
|
|
26
|
+
)
|
|
27
|
+
UI.user_error!('Sparkle sign_update failed; check the signing tool and private key') unless status.success?
|
|
28
|
+
|
|
29
|
+
signature = stdout.strip
|
|
30
|
+
validate_ed_signature!(signature)
|
|
31
|
+
verify_signature!(signature: signature, public_key: public_key, archive_path: archive_path)
|
|
32
|
+
signature
|
|
33
|
+
rescue SystemCallError, IOError
|
|
34
|
+
# Do not retain a potentially sensitive exception as the cause in verbose error reports.
|
|
35
|
+
raise FastlaneCore::Interface::FastlaneError.new, 'Unable to run Sparkle sign_update or read the archive', cause: nil
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Verify against the public key embedded in the app, so a wrong CI key cannot publish an unusable update.
|
|
39
|
+
def self.verify_signature!(signature:, public_key:, archive_path:)
|
|
40
|
+
validate_public_key!(public_key)
|
|
41
|
+
# SubjectPublicKeyInfo for Ed25519: AlgorithmIdentifier (OID 1.3.101.112) and a 32-byte public key.
|
|
42
|
+
key = OpenSSL::PKey.read(['302a300506032b6570032100'].pack('H*') + Base64.strict_decode64(public_key))
|
|
43
|
+
return if key.verify(nil, Base64.strict_decode64(signature), File.binread(archive_path))
|
|
44
|
+
|
|
45
|
+
UI.user_error!("Sparkle signature does not verify against the app's public key and archive")
|
|
46
|
+
rescue OpenSSL::PKey::PKeyError
|
|
47
|
+
UI.user_error!("Unable to verify the Sparkle signature with the app's public key")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.validate_public_key!(value)
|
|
51
|
+
return if canonical_base64?(value, lengths: [32])
|
|
52
|
+
|
|
53
|
+
UI.user_error!('Sparkle public key must be canonical base64 for exactly 32 bytes')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Validate a signature without accepting whitespace, URL-safe encoding, or noncanonical padding.
|
|
57
|
+
def self.validate_ed_signature!(value)
|
|
58
|
+
return if canonical_base64?(value, lengths: [64])
|
|
59
|
+
|
|
60
|
+
UI.user_error!('EdDSA signature must be canonical base64 for exactly 64 bytes')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.canonical_base64?(value, lengths:)
|
|
64
|
+
return false unless value.is_a?(String)
|
|
65
|
+
|
|
66
|
+
decoded = Base64.strict_decode64(value)
|
|
67
|
+
lengths.include?(decoded.bytesize) && Base64.strict_encode64(decoded) == value
|
|
68
|
+
rescue ArgumentError
|
|
69
|
+
false
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fastlane-plugin-wpmreleasetoolkit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 15.
|
|
4
|
+
version: 15.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Automattic
|
|
@@ -333,6 +333,7 @@ files:
|
|
|
333
333
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_send_app_size_metrics.rb
|
|
334
334
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb
|
|
335
335
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb
|
|
336
|
+
- lib/fastlane/plugin/wpmreleasetoolkit/actions/macos/macos_sign_update.rb
|
|
336
337
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/macos/macos_verify_code_signing.rb
|
|
337
338
|
- lib/fastlane/plugin/wpmreleasetoolkit/env_manager/env_manager.rb
|
|
338
339
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_emulator_helper.rb
|
|
@@ -357,6 +358,7 @@ files:
|
|
|
357
358
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_linter_helper.rb
|
|
358
359
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_strings_file_validation_helper.rb
|
|
359
360
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb
|
|
361
|
+
- lib/fastlane/plugin/wpmreleasetoolkit/helper/macos/sparkle_helper.rb
|
|
360
362
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata/po_file_generator.rb
|
|
361
363
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb
|
|
362
364
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb
|