Skip to content

Commit 910965d

Browse files
authored
TypeScript and ESM migration, indent with deno
1 parent 7346578 commit 910965d

33 files changed

+3696
-5034
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,23 @@ on:
44
push:
55
pull_request:
66

7-
87
jobs:
98
build:
10-
119
runs-on: macos-latest
1210

1311
strategy:
1412
matrix:
15-
node-version: [ '16', '18', '20' ]
13+
node-version: ["18", "20"]
1614

1715
steps:
18-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v3
1917

20-
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: ${{ matrix.node-version }}
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ matrix.node-version }}
2422

25-
- run: npm install
26-
- run: npm test
27-
- run: npm run semi
28-
- run: npm run dist
23+
- run: npm install
24+
- run: npm run indent-check
25+
- run: npm test
26+
- run: npm run dist

README.linux.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ $ cargo install apple-codesign
1111

1212
You can read more about rcodesign and certificates in:
1313

14-
* https://pyoxidizer.readthedocs.io/en/latest/apple_codesign_certificate_management.html#apple-codesign-certificate-management
14+
- https://pyoxidizer.readthedocs.io/en/latest/apple_codesign_certificate_management.html#apple-codesign-certificate-management
1515

1616
```sh
1717
$ rcodesign generate-self-signed-certificate --person-name pancake > a.pem
@@ -26,7 +26,7 @@ $ rcodesign sign --pem-source a.pem --code-signature-flags runtime /path/to/bina
2626

2727
## Codesign Requirements
2828

29-
Apple requires a csreq to be signed inside the binary. this is an evaluated expression that defines
30-
the conditions that must
29+
Apple requires a csreq to be signed inside the binary. this is an evaluated
30+
expression that defines the conditions that must
3131

32-
* https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html
32+
- https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/RequirementLang/RequirementLang.html

README.md

Lines changed: 78 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
node-applesign
2-
===============
1+
# node-applesign
32

4-
NodeJS module and commandline utility for re-signing iOS applications (IPA files).
3+
NodeJS module and commandline utility for re-signing iOS applications (IPA
4+
files).
55

6-
Author
7-
------
6+
## Author
87

98
Sergi Alvarez Capilla aka pancake @ nowsecure.com
109

11-
Program Dependencies
12-
--------------------
10+
## Program Dependencies
1311

14-
* zip - re-create IPA
15-
* unzip - decompress IPA (see `npm run unzip-lzfse`)
16-
* codesign - sign and verify binary with new entitlements and identity
17-
* security - get entitlements from mobileprovision
18-
* insert_dylib - only if you want to use the -I,--insert flag
12+
- zip - re-create IPA
13+
- unzip - decompress IPA (see `npm run unzip-lzfse`)
14+
- codesign - sign and verify binary with new entitlements and identity
15+
- security - get entitlements from mobileprovision
16+
- insert_dylib - only if you want to use the -I,--insert flag
1917

20-
Usage
21-
-----
18+
## Usage
2219

2320
When running without arguments we get a short help message
2421

@@ -116,31 +113,31 @@ Installing in the device:
116113
117114
$ ideviceinstaller -i target-resigned.ipa
118115
$ ios-deploy -b target-resigned.ipa
119-
120116
```
121117

122118
List local codesign identities:
123119

124-
$ bin/applesign -L
120+
$ bin/applesign -L
125121

126122
Resign an IPA with a specific identity:
127123

128-
$ bin/applesign -i 1C4D1A442A623A91E6656F74D170A711CB1D257A foo.ipa
124+
$ bin/applesign -i 1C4D1A442A623A91E6656F74D170A711CB1D257A foo.ipa
129125

130126
Change bundleid:
131127

132-
$ bin/applesign -b org.nowsecure.testapp path/to/ipa
128+
$ bin/applesign -b org.nowsecure.testapp path/to/ipa
133129

134-
Signing methods
135-
---------------
130+
## Signing methods
136131

137-
There are different ways to sign an IPA file with applesign for experimental reasons.
132+
There are different ways to sign an IPA file with applesign for experimental
133+
reasons.
138134

139135
You may want to check the following options:
140136

141137
**-c, --clone-entitlements**
142138

143-
put the entitlements embedded inside the signed mobileprovisioning file provided by the user as the default ones to sign all the binaries
139+
put the entitlements embedded inside the signed mobileprovisioning file provided
140+
by the user as the default ones to sign all the binaries
144141

145142
**-S, --self-sign-provision**
146143

@@ -152,72 +149,81 @@ use the default entitlements plist. useful when troubleshooting
152149

153150
The default signing method does as follow:
154151

155-
* Grab entitlements from binary
156-
* Remove problematic entitlements
157-
* Grab entitlements from the provisioning
158-
* Adjust application-id and team-id of the binary with the provisioning ones
159-
* Copy the original mobileprovisioning inside the IPA
160-
* Creates ${AppName}.entitlements and signs all the mach0s
152+
- Grab entitlements from binary
153+
- Remove problematic entitlements
154+
- Grab entitlements from the provisioning
155+
- Adjust application-id and team-id of the binary with the provisioning ones
156+
- Copy the original mobileprovisioning inside the IPA
157+
- Creates ${AppName}.entitlements and signs all the mach0s
161158

162159
After some testing we will probably go for having -c or -E as default.
163160

164-
In addition, for performance reasons, applesign supports -p for parallel signing. The order of signing the binaries inside an IPA matters, so applesign creates a dependency list of all the bins and signs them in order. The parallel signing aims to run in parallel as much tasks as possible without breaking the dependency list.
161+
In addition, for performance reasons, applesign supports -p for parallel
162+
signing. The order of signing the binaries inside an IPA matters, so applesign
163+
creates a dependency list of all the bins and signs them in order. The parallel
164+
signing aims to run in parallel as much tasks as possible without breaking the
165+
dependency list.
165166

166-
Mangling
167-
--------
167+
## Mangling
168168

169-
It is possible with `--force-family` to remove the UISupportedDevices from the Info.plist and replace the entitlement information found in the mobileprovisioning and then carefully massage the rest of entitlements to drop the privileged ones (`--massage-entitlements`).
169+
It is possible with `--force-family` to remove the UISupportedDevices from the
170+
Info.plist and replace the entitlement information found in the
171+
mobileprovisioning and then carefully massage the rest of entitlements to drop
172+
the privileged ones (`--massage-entitlements`).
170173

171174
Other interesting manipulations that can be done in the IPA are:
172175

173176
**-I, --insert [frida.dylib]**
174177

175-
Allows to insert a dynamic library in the main executable. This is how Frida can be injected to introspect iOS applications without jailbreak.
178+
Allows to insert a dynamic library in the main executable. This is how Frida can
179+
be injected to introspect iOS applications without jailbreak.
176180

177181
**-l, --lipo [arm64|armv7]**
178182

179-
Thinifies an IPA by removing all fatmach0s to only contain binaries for one specified architecture. Also this is helpful to identify non-arm binaries embedded inside IPA that can be leaked from development or pre-production environments.
183+
Thinifies an IPA by removing all fatmach0s to only contain binaries for one
184+
specified architecture. Also this is helpful to identify non-arm binaries
185+
embedded inside IPA that can be leaked from development or pre-production
186+
environments.
180187

181-
In order to thinify the final IPA even more, applesign allows to drop the watchapp extensions which would not be necessary for non Apple Watch users.
188+
In order to thinify the final IPA even more, applesign allows to drop the
189+
watchapp extensions which would not be necessary for non Apple Watch users.
182190

183-
Performance
184-
-----------
191+
## Performance
185192

186-
Sometimes the time required to run the codesigning step matters, so applesign allows to skip some steps and speedup the process.
193+
Sometimes the time required to run the codesigning step matters, so applesign
194+
allows to skip some steps and speedup the process.
187195

188196
See `--dont-verify` and `--parallel` commandline flags.
189197

190198
Enabling those options can result on a 35% speedup on ~60MB IPAs.
191199

192-
API usage
193-
---------
200+
## API usage
194201

195202
Here's a simple program that resigns an IPA:
196203

197204
```js
198-
const Applesign = require('applesign');
205+
const Applesign = require("applesign");
199206

200207
const as = new Applesign({
201-
identity: '81A24300FE2A8EAA99A9601FDA3EA811CD80526A',
202-
mobileprovision: '/path/to/dev.mobileprovision',
203-
withoutWatchapp: true
204-
});
205-
as.events.on('warning', (msg) => {
206-
console.log('WARNING', msg);
207-
})
208-
.on('message', (msg) => {
209-
console.log('msg', msg);
208+
identity: "81A24300FE2A8EAA99A9601FDA3EA811CD80526A",
209+
mobileprovision: "/path/to/dev.mobileprovision",
210+
withoutWatchapp: true,
210211
});
211-
212-
as.signIPA('/path/to/app.ipa')
213-
.then(_ => {
214-
console.log('ios-deploy -b', as.config.outfile);
212+
as.events.on("warning", (msg) => {
213+
console.log("WARNING", msg);
215214
})
216-
.catch(e => {
217-
console.error(e);
218-
process.exitCode = 1;
219-
});
215+
.on("message", (msg) => {
216+
console.log("msg", msg);
217+
});
220218

219+
as.signIPA("/path/to/app.ipa")
220+
.then((_) => {
221+
console.log("ios-deploy -b", as.config.outfile);
222+
})
223+
.catch((e) => {
224+
console.error(e);
225+
process.exitCode = 1;
226+
});
221227
```
222228

223229
To list the developer identities available in the system:
@@ -233,31 +239,30 @@ try {
233239
}
234240
```
235241

236-
Bear in mind that the Applesign object can tuned to use different
237-
configuration options:
242+
Bear in mind that the Applesign object can tuned to use different configuration
243+
options:
238244

239245
```js
240246
const options = {
241-
file: '/path/to/app.ipa',
242-
outfile: '/path/to/app-resigned.ipa',
243-
entitlement: '/path/to/entitlement',
244-
bundleid: 'app.company.bundleid',
245-
identity: 'hash id of the developer',
246-
mobileprovision: '/path/to/mobileprovision file',
247+
file: "/path/to/app.ipa",
248+
outfile: "/path/to/app-resigned.ipa",
249+
entitlement: "/path/to/entitlement",
250+
bundleid: "app.company.bundleid",
251+
identity: "hash id of the developer",
252+
mobileprovision: "/path/to/mobileprovision file",
247253
ignoreVerificationErrors: true,
248-
withoutWatchapp: true
254+
withoutWatchapp: true,
249255
};
250256
```
251257

252-
Further reading
253-
---------------
258+
## Further reading
254259

255260
See the Wiki: https://github.com/nowsecure/node-applesign/wiki
256261

257-
* https://github.com/maciekish/iReSign
258-
* https://github.com/saucelabs/isign
259-
* https://github.com/phonegap/ios-deploy
262+
- https://github.com/maciekish/iReSign
263+
- https://github.com/saucelabs/isign
264+
- https://github.com/phonegap/ios-deploy
260265

261266
Pre iOS9 devices will require a developer account:
262267

263-
* http://dev.mlsdigital.net/posts/how-to-resign-an-ios-app-from-external-developers/
268+
- http://dev.mlsdigital.net/posts/how-to-resign-an-ios-app-from-external-developers/

bin/applesign.js

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)