Skip to content

Commit 98cc8ba

Browse files
committed
PR changes
1 parent 739dcdb commit 98cc8ba

11 files changed

+38
-41
lines changed

signingscript/Dockerfile

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,9 @@ COPY ["version.jso[n]", "/app/"]
2424
# Install msix
2525
# Install rcodesign
2626
RUN chown -R app:app /app \
27-
&& cd /app/scriptworker_client \
28-
&& pip install /app/scriptworker_client \
29-
&& pip install -r requirements/base.txt \
30-
&& pip install . \
3127
&& cd /app/signingscript/docker.d \
3228
&& bash build_libdmg_hfsplus.sh /usr/bin \
33-
&& bash build_rcodesign.sh /usr/bin \
29+
&& bash install_rcodesign.sh /usr/bin \
3430
&& bash build_msix_packaging.sh
3531

3632
# Set user and workdir
@@ -39,8 +35,8 @@ WORKDIR /app
3935

4036
# Install signingscript + configloader + widevine
4137
RUN python -m venv /app \
42-
&& cd signingscript \
4338
&& /app/bin/pip install /app/scriptworker_client \
39+
&& cd signingscript \
4440
&& /app/bin/pip install -r requirements/base.txt \
4541
&& /app/bin/pip install . \
4642
&& python -m venv /app/configloader_venv \

signingscript/docker.d/apple_signing_creds.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ in:
1010
$match:
1111
'ENV == "prod" && scope_prefix':
1212
'${scope_prefix[0]}cert:release-signing':
13-
- "app_credentials": {"$eval": "APPLE_APP_SIGNING_CREDENTIALS"}
14-
"installer_credentials": {"$eval": "APPLE_INSTALLER_SIGNING_CREDENTIALS"}
15-
"password": {"$eval": "APPLE_SIGNING_CREDS_PASSWORD"}
13+
- "app_pkcs12_bundle": {"$eval": "APPLE_APP_SIGNING_PKCS12"}
14+
"installer_pkcs12_bundle": {"$eval": "APPLE_INSTALLER_SIGNING_PKCS12"}
15+
"pkcs12_password": {"$eval": "APPLE_SIGNING_PKCS12_PASSWORD"}
1616
'${scope_prefix[0]}cert:nightly-signing':
17-
- "app_credentials": {"$eval": "APPLE_APP_SIGNING_CREDENTIALS"}
18-
"installer_credentials": {"$eval": "APPLE_INSTALLER_SIGNING_CREDENTIALS"}
19-
"password": {"$eval": "APPLE_SIGNING_CREDS_PASSWORD"}
17+
- "app_pkcs12_bundle": {"$eval": "APPLE_APP_SIGNING_PKCS12"}
18+
"installer_pkcs12_bundle": {"$eval": "APPLE_INSTALLER_SIGNING_PKCS12"}
19+
"pkcs12_password": {"$eval": "APPLE_SIGNING_PKCS12_PASSWORD"}
2020
'ENV != "prod" && scope_prefix':
2121
'${scope_prefix[0]}cert:dep-signing':
22-
- "app_credentials": {"$eval": "APPLE_APP_SIGNING_DEP_CREDENTIALS"}
23-
"installer_credentials": {"$eval": "APPLE_INSTALLER_SIGNING_DEP_CREDENTIALS"}
24-
"password": {"$eval": "APPLE_SIGNING_DEP_CREDS_PASSWORD"}
22+
- "app_pkcs12_bundle": {"$eval": "APPLE_APP_SIGNING_DEP_PKCS12"}
23+
"installer_pkcs12_bundle": {"$eval": "APPLE_INSTALLER_SIGNING_DEP_PKCS12"}
24+
"pkcs12_password": {"$eval": "APPLE_SIGNING_DEP_PKCS12_PASSWORD"}
Binary file not shown.

signingscript/src/signingscript/script.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -143,33 +143,33 @@ def setup_apple_signing_credentials(context):
143143
if len(scope_credentials) != 1:
144144
raise SigningScriptError("There should only be 1 scope credential, %s found." % len(scope_credentials))
145145

146-
context.apple_app_signing_creds_path = os.path.join(
146+
context.apple_app_signing_pkcs12_path = os.path.join(
147147
os.path.dirname(context.config["apple_signing_configs"]),
148148
"apple_app_signing_creds.p12",
149149
)
150-
unlink(context.apple_app_signing_creds_path)
151-
context.apple_installer_signing_creds_path = os.path.join(
150+
unlink(context.apple_app_signing_pkcs12_path)
151+
context.apple_installer_signing_pkcs12_path = os.path.join(
152152
os.path.dirname(context.config["apple_signing_configs"]),
153153
"apple_installer_signing_creds.p12",
154154
)
155-
unlink(context.apple_installer_signing_creds_path)
156-
context.apple_signing_creds_pass_path = os.path.join(
155+
unlink(context.apple_installer_signing_pkcs12_path)
156+
context.apple_signing_pkcs12_pass_path = os.path.join(
157157
os.path.dirname(context.config["apple_signing_configs"]),
158158
"apple_signing_creds_pass.passwd",
159159
)
160-
unlink(context.apple_signing_creds_pass_path)
160+
unlink(context.apple_signing_pkcs12_pass_path)
161161

162162
# Convert dataclass to dict so json module can read it
163163
creds_config = asdict(scope_credentials[0])
164-
_write_text(context.apple_app_signing_creds_path, base64.b64decode(creds_config["app_credentials"]))
164+
_write_text(context.apple_app_signing_pkcs12_path, base64.b64decode(creds_config["app_pkcs12_bundle"]))
165165

166166
# Defaults to using the app credentials (ie: on Try)
167-
if creds_config.get("installer_credentials"):
168-
_write_text(context.apple_installer_signing_creds_path, base64.b64decode(creds_config["installer_credentials"]))
167+
if creds_config.get("installer_pkcs12_bundle"):
168+
_write_text(context.apple_installer_signing_pkcs12_path, base64.b64decode(creds_config["installer_pkcs12_bundle"]))
169169
else:
170-
context.apple_installer_signing_creds_path = context.apple_app_signing_creds_path
170+
context.apple_installer_signing_pkcs12_path = context.apple_app_signing_pkcs12_path
171171

172-
_write_text(context.apple_signing_creds_pass_path, creds_config["password"])
172+
_write_text(context.apple_signing_pkcs12_pass_path, creds_config["pkcs12_password"])
173173

174174

175175
def main():

signingscript/src/signingscript/sign.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1657,12 +1657,13 @@ async def apple_app_hardened_sign(context, path, *args, **kwargs):
16571657
for file in os.scandir(signing_dir):
16581658
if file.is_dir() and file.name.endswith(".app"):
16591659
# Developer ID Application certificate
1660-
creds = context.apple_app_signing_creds_path
1660+
creds = context.apple_app_signing_pkcs12_path
16611661
elif file.is_file() and file.name.endswith(".pkg"):
16621662
# Use installer credentials
1663-
creds = context.apple_installer_signing_creds_path
1663+
creds = context.apple_installer_signing_pkcs12_path
16641664
else:
16651665
# If not pkg AND not a directory (.app) - then skip file
1666+
log.info(f"Skipping unsupported file at root: {file.path}")
16661667
continue
16671668

16681669
bundle_path = os.path.join(signing_dir, file.path)
@@ -1679,7 +1680,7 @@ async def apple_app_hardened_sign(context, path, *args, **kwargs):
16791680
context.config["work_dir"],
16801681
bundle_path,
16811682
creds,
1682-
context.apple_signing_creds_pass_path,
1683+
context.apple_signing_pkcs12_pass_path,
16831684
hardened_sign_config,
16841685
)
16851686
signed = True

signingscript/src/signingscript/utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class AppleNotarization:
3838
class AppleSigning:
3939
"""Apple signing configuration object."""
4040

41-
app_credentials: str
42-
installer_credentials: str
43-
password: str
41+
app_pkcs12_bundle: str
42+
installer_pkcs12_bundle: str
43+
pkcs12_password: str
4444

4545

4646
def mkdir(path):

signingscript/tests/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def context(tmpdir):
5959
context.config["apple_signing_configs"] = APPLE_CONFIG_PATH
6060
context.autograph_configs = load_autograph_configs(SERVER_CONFIG_PATH)
6161
context.apple_credentials_path = os.path.join(tmpdir, "fakepath")
62-
context.apple_app_signing_creds_path = os.path.join(tmpdir, "apple_app.p12")
63-
context.apple_installer_signing_creds_path = os.path.join(tmpdir, "apple_installer.p12")
62+
context.apple_app_signing_pkcs12_path = os.path.join(tmpdir, "apple_app.p12")
63+
context.apple_installer_signing_pkcs12_path = os.path.join(tmpdir, "apple_installer.p12")
6464
context.apple_signing_creds_path = os.path.join(tmpdir, "apple_p12.passwd")
6565
mkdir(context.config["work_dir"])
6666
mkdir(context.config["artifact_dir"])
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"project:releng:signing:cert:dep-signing": [{
3-
"app_credentials": "abcdef",
4-
"installer_credentials": "abcdef",
5-
"password": "verysecret"
3+
"app_pkcs12_bundle": "abcdef",
4+
"installer_pkcs12_bundle": "abcdef",
5+
"pkcs12_password": "verysecret"
66
}]
77
}

signingscript/tests/test_rcodesign.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ async def test_rcodesign_sign(context, mocker):
179179
app_path.mkdir()
180180
(app_path / "samplefile").touch()
181181
(app_path / "samplefile2").touch()
182-
context.apple_app_signing_creds_path = workdir / "test_cred.p12"
183-
context.apple_signing_creds_pass_path = workdir / "test_cred.passwd"
182+
context.apple_app_signing_pkcs12_path = workdir / "test_cred.p12"
183+
context.apple_signing_pkcs12_pass_path = workdir / "test_cred.passwd"
184184
entitlement_file = workdir / "test.xml"
185185
entitlement_file.touch()
186186

@@ -204,8 +204,8 @@ async def test_rcodesign_sign(context, mocker):
204204
await rcodesign.rcodesign_sign(
205205
context.config["work_dir"],
206206
str(app_path),
207-
context.apple_app_signing_creds_path,
208-
context.apple_signing_creds_pass_path,
207+
context.apple_app_signing_pkcs12_path,
208+
context.apple_signing_pkcs12_pass_path,
209209
hardened_sign_config,
210210
)
211211
download.assert_called_once()

0 commit comments

Comments
 (0)