Skip to content

Commit af924ca

Browse files
cursoragentmorluto
andcommitted
Merge origin/main into cursor/mcp-startup-budgets-d806
Keep the MCP startup budget settings and the first-catalog deadline. Take the regex worker heap setting, and attribute doctor timeouts from owned abort and SDK timeout facts. Co-authored-by: morluto <morluto@users.noreply.github.com>
2 parents 40a302e + 9512a80 commit af924ca

294 files changed

Lines changed: 32472 additions & 1361 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/reverse-engineer-anything/SKILL.md‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ explicit path or endpoint and do not need it.
166166
Select JavaScript glue and candidate paths explicitly and preserve URL/path
167167
ambiguity. No implicit fetch or target execution; WAT is not original source.
168168
See the [WASM guide](https://github.com/morluto/rea/blob/main/docs/wasm-artifacts.md).
169+
- Explicit local Android APK (or ZIP/AAB) signing: `inspect_apk_signature`.
170+
Prefer its summary or selected signer/digest/lineage page; retain complete
171+
Evidence and use `inspect_analysis_view` kind `apk-signature` for follow-ups.
172+
Reports which schemes are present (v1 JAR, v2, v3, v3.1), each signer's
173+
certificate SHA-256 fingerprint (v1 included, from its PKCS#7 block), v3 key-rotation lineage, source stamp, and
174+
whether each signed digest still matches the bytes (self-consistency). This
175+
is identity and integrity, not a trust or authenticity verdict.
176+
See the [APK signature guide](https://github.com/morluto/rea/blob/main/docs/apk-signature.md).
169177
- Explicit local EVM bytecode carrier: `inspect_evm_interface` with caller-selected
170178
`raw` or `hex` encoding. The owned worker deadline is `timeout_ms` (default
171179
30000 ms, range 1..2147483647, next call). It does not raise the fixed byte,
@@ -219,12 +227,33 @@ explicit path or endpoint and do not need it.
219227
delivery requires `--evidence_output`.
220228
See the
221229
[Rust binary guide](https://github.com/morluto/rea/blob/main/docs/rust-binaries.md).
230+
- PE Authenticode certificate table: `inspect_pe_certificates` with the explicit
231+
local PE32/PE32+ file. This built-in target-free inspection requires no
232+
Windows SDK. Preserve WIN_CERTIFICATE ranges, types, payload SHA-256, and
233+
PKCS#7 signer/X.509 identity fields, including `subject_key_identifier_hex`
234+
when the signer uses that form. A missing security directory is observed
235+
absence of that table, not proof the image is unsigned in every catalog sense.
236+
Signatures are not verified. See the
237+
[PE certificate guide](https://github.com/morluto/rea/blob/main/docs/pe-certificates.md).
222238
- ELF note tables: `inspect_elf_notes` with the explicit local ELF32/ELF64
223239
file. This built-in target-free inspection requires no disassembler. Preserve
224240
PT_NOTE and SHT_NOTE ranges, owners, types, descriptor SHA-256, and GNU
225241
build-id or ABI-tag fields. A missing table is observed absence of those
226242
declarations, not proof the image never carried notes. See the
227243
[ELF notes guide](https://github.com/morluto/rea/blob/main/docs/elf-notes.md).
244+
- CPython 3.7–3.13 `.pyc` header, nested marshal code objects and bytecode
245+
identity: `inspect_python_pyc` with the explicit local file. This built-in
246+
target-free inspection requires no Python installation. Preserve magic,
247+
PEP 552 hash or mtime/size, nested names, and bytecode SHA-256. Bytecode is
248+
not decompiled, and a decoded header does not prove the matching `.py` is
249+
present. See the
250+
[CPython pyc guide](https://github.com/morluto/rea/blob/main/docs/python-pyc.md).
251+
- Erlang BEAM IFF container: `inspect_erlang_beam` with the explicit local
252+
`.beam` file. This built-in target-free inspection requires no Erlang
253+
installation. Preserve chunk names, atom order, export/import/lambda tables,
254+
and the Code header. Missing optional tables stay null. Bytecode is not
255+
executed. See the
256+
[Erlang BEAM guide](https://github.com/morluto/rea/blob/main/docs/erlang-beam.md).
228257

229258
- Explicit local SQLite database snapshot: `inspect_sqlite_database`. Inspect
230259
with Node.js 24.x >=24.15 or 26+ providing native SQLite limits. Read schema

‎.agents/skills/reverse-engineer-anything/references/native-and-artifacts.md‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,20 @@ dependencies. An omitted package kind stays null. A rustc commit hash is
9696
inferred from a read-only `/rustc/<40-hex>/` path and does not by itself
9797
identify the compiler. See [Rust binaries](https://github.com/morluto/rea/blob/main/docs/rust-binaries.md).
9898

99+
## PE Authenticode certificate tables
100+
101+
Use `inspect_pe_certificates` for an explicit local PE32/PE32+ image when the
102+
question concerns the Authenticode certificate table, WIN_CERTIFICATE types, or
103+
embedded PKCS#7 signer and X.509 identity fields. No `open_binary`, Windows SDK,
104+
or target execution is required. The CLI equivalent is
105+
`inspect-pe-certificates PATH`. Preserve artifact SHA-256, table file ranges,
106+
payload hashes, original validity-time spellings, and
107+
`subject_key_identifier_hex` when the signer uses that form. A missing
108+
`IMAGE_DIRECTORY_ENTRY_SECURITY` directory is observed absence of that table,
109+
not proof the image is unsigned in every catalog or overlay sense. Signatures,
110+
chains, timestamps, and Authenticode digest coverage remain unobserved. See
111+
[PE Authenticode certificate tables](https://github.com/morluto/rea/blob/main/docs/pe-certificates.md).
112+
99113
## ELF note tables
100114

101115
Use `inspect_elf_notes` for an explicit local ELF32/ELF64 image when the
@@ -107,6 +121,26 @@ absence of those declarations, not proof the image never carried notes in
107121
another container. See
108122
[ELF note tables](https://github.com/morluto/rea/blob/main/docs/elf-notes.md).
109123

124+
## CPython pyc files
125+
126+
Use `inspect_python_pyc` for an explicit local CPython 3.7–3.13 `.pyc` when the
127+
question concerns the header magic, PEP 552 source hash or timestamp, nested
128+
code-object names, or bytecode identity. No `open_binary`, Python installation,
129+
or target execution is required. The CLI equivalent is `inspect-python-pyc PATH`.
130+
Preserve artifact SHA-256, the 16-byte header fields, nested code names, and
131+
bytecode SHA-256. Bytecode is not decompiled. A decoded header does not prove
132+
the matching `.py` is present. See [CPython pyc inspection](https://github.com/morluto/rea/blob/main/docs/python-pyc.md).
133+
134+
## Erlang BEAM files
135+
136+
Use `inspect_erlang_beam` for an explicit local `FOR1`/`BEAM` file when the
137+
question concerns IFF chunks, atom names, exports, imports, lambdas, or the
138+
Code header. No `open_binary`, Erlang installation, or bytecode execution is
139+
required. The CLI equivalent is `inspect-erlang-beam PATH`. Preserve artifact
140+
SHA-256, chunk file ranges, 1-based atom indices, and original atom spellings.
141+
Missing optional tables stay null. See
142+
[Erlang BEAM files](https://github.com/morluto/rea/blob/main/docs/erlang-beam.md).
143+
110144
## SQLite snapshots
111145

112146
Use `inspect_sqlite_database` with an explicit local database snapshot for its
@@ -161,6 +195,30 @@ and tool profile. Text offsets count UTF-16 code units; follow `next_offset`.
161195
The complete source remains retained after an oversized MCP reply. No target
162196
execution or network acquisition is implied, and WAT is decoded representation.
163197

198+
## Offline APK signatures
199+
200+
Use `inspect_apk_signature` for a selected local APK/ZIP/AAB. Default MCP summaries
201+
retain complete Evidence. Select `view.collection: signers/digests/lineage`,
202+
with scheme or ID batches, fields and paging; use `inspect_analysis_view` kind
203+
`apk-signature` for retained reads after deletion. IDs retain artifact/scheme
204+
scope and signer links; `fields: []` keeps identity links. Empty pages preserve
205+
partial decoding reasons and unknown authenticity. CLI compact delivery needs
206+
`--evidence_output` to preserve the complete parent.
207+
It reads the APK
208+
Signing Block (v2/v3/v3.1) and v1 `META-INF` signing without executing anything,
209+
and reports each signer's certificate facts (for v1, the certificate the PKCS#7
210+
block's SignerInfo names), the declared v3 rotation lineage,
211+
the declared source-stamp certificate and, for SHA-256/SHA-512 digests, whether
212+
the declared content digest matches the current bytes. That match is not a
213+
signature verification: anyone who changes the bytes can recompute the digest.
214+
`posture` summarises v1-only signing (which cannot tell a v1-only APK from one
215+
whose v2/v3 block was removed), observed signer agreement across schemes,
216+
whether the v1 signer equals the block-scheme signer (`false` is notable),
217+
whether every differing signer appears in a declared (unverified) rotation
218+
lineage, and the strongest scheme.
219+
It never claims authenticity: no signature or lineage is cryptographically
220+
verified.
221+
164222
## Native targets
165223

166224
After `open_binary`, use focused search, procedure, or function tools directly.

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
browser: ${{ steps.plan.outputs.browser }}
7373
binary_layout: ${{ steps.plan.outputs.binary_layout }}
7474
evm: ${{ steps.plan.outputs.evm }}
75+
apk_signature: ${{ steps.plan.outputs.apk_signature }}
7576
javascript_recovery: ${{ steps.plan.outputs.javascript_recovery }}
7677
recorded_crash: ${{ steps.plan.outputs.recorded_crash }}
7778
web_network: ${{ steps.plan.outputs.web_network }}
@@ -384,6 +385,7 @@ jobs:
384385
needs.changes.outputs.browser == 'true' ||
385386
needs.changes.outputs.binary_layout == 'true' ||
386387
needs.changes.outputs.evm == 'true' ||
388+
needs.changes.outputs.apk_signature == 'true' ||
387389
needs.changes.outputs.javascript_recovery == 'true' ||
388390
needs.changes.outputs.recorded_crash == 'true' ||
389391
needs.changes.outputs.web_network == 'true' ||
@@ -1003,6 +1005,16 @@ jobs:
10031005
build_cache_artifact: rea-build-cache
10041006
remote_cache_write: ${{ inputs.remote_cache_write == true || (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')) }}
10051007

1008+
apk_signature:
1009+
needs: [changes, static, build]
1010+
if: needs.changes.outputs.apk_signature == 'true'
1011+
secrets:
1012+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
1013+
uses: ./.github/workflows/real-apk-signature.yml
1014+
with:
1015+
build_cache_artifact: rea-build-cache
1016+
remote_cache_write: ${{ inputs.remote_cache_write == true || (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')) }}
1017+
10061018
javascript_recovery:
10071019
needs: [changes, static, build]
10081020
if: needs.changes.outputs.javascript_recovery == 'true'
@@ -1103,6 +1115,7 @@ jobs:
11031115
browser,
11041116
binary_layout,
11051117
evm,
1118+
apk_signature,
11061119
javascript_recovery,
11071120
recorded_crash,
11081121
web_network,
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Real APK signature inspection
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build_cache_artifact:
7+
description: Portable build cache artifact from the calling CI run.
8+
required: false
9+
type: string
10+
default: ""
11+
remote_cache_write:
12+
description: Trusted release qualification may publish the remote cache.
13+
required: false
14+
type: boolean
15+
default: false
16+
secrets:
17+
TURBO_TOKEN:
18+
description: Remote cache token. Only trusted callers pass it.
19+
required: false
20+
workflow_dispatch:
21+
22+
permissions:
23+
contents: read
24+
25+
env:
26+
HUSKY: "0"
27+
# A called workflow sees the caller event, so workflow_call is not an event
28+
# name here. Writes when remote_cache_write is set, or on the default branch
29+
# for push, schedule, and manual dispatch. Open pull requests stay empty-token
30+
# and use the local cache only.
31+
TURBO_TOKEN: "${{ (inputs.remote_cache_write == true || (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'))) && secrets.TURBO_TOKEN || '' }}"
32+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
33+
TURBO_CACHE: "${{ (inputs.remote_cache_write == true || (github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'))) && 'local:rw,remote:rw' || 'local:rw' }}"
34+
NODE_OPTIONS: "--max-old-space-size=768"
35+
RAYON_NUM_THREADS: "1"
36+
GOMAXPROCS: "2"
37+
UV_THREADPOOL_SIZE: "2"
38+
JAVA_TOOL_OPTIONS: "-Xmx512m -XX:ActiveProcessorCount=2"
39+
40+
jobs:
41+
real-apk-signature:
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 12
44+
steps:
45+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
46+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
47+
with:
48+
node-version-file: .nvmrc
49+
- name: Cache npm package downloads
50+
id: npm-cache
51+
uses: ./.github/actions/npm-cache
52+
- run: npm ci
53+
- uses: ./.github/actions/portable-build-cache
54+
with:
55+
build_cache_artifact: ${{ inputs.build_cache_artifact }}
56+
- name: Prepare pinned SDK oracle without installing host software
57+
shell: bash
58+
run: |
59+
python3 - <<'PYTHON'
60+
import hashlib, os, urllib.request, zipfile
61+
from pathlib import Path
62+
root = Path(os.environ["RUNNER_TEMP"]) / "rea-apk-signature-sdk"
63+
packages = [
64+
("build-tools_r36.1_linux.zip", "a7b5889e4a79fcf3b0976bef40d401f4240fb1eed891d9d91169da1111e11d78", 64195204, "build-tools/36.1.0", {"apksigner", "aapt2", "lib/apksigner.jar", "source.properties"}),
65+
("platform-36_r02.zip", "37607369a28c5b640b3a7998868d45898ebcb777565a0e85f9acf36f29631d2e", 65878410, "platforms/android-36", {"android.jar", "source.properties"}),
66+
]
67+
for name, expected, expected_size, directory, selected in packages:
68+
archive = root / name
69+
archive.parent.mkdir(parents=True, exist_ok=True)
70+
digest = hashlib.sha256()
71+
total = 0
72+
with urllib.request.urlopen("https://dl.google.com/android/repository/" + name, timeout=60) as response, archive.open("wb") as output:
73+
while chunk := response.read(1024 * 1024):
74+
total += len(chunk)
75+
if total > expected_size:
76+
raise RuntimeError("SDK archive exceeds the pinned package size budget")
77+
digest.update(chunk)
78+
output.write(chunk)
79+
if total != expected_size or digest.hexdigest() != expected:
80+
raise RuntimeError("SDK oracle archive digest mismatch")
81+
extracted = set()
82+
with zipfile.ZipFile(archive) as source:
83+
for entry in source.infolist():
84+
relative = entry.filename.partition("/")[2]
85+
if relative not in selected:
86+
continue
87+
target = root / directory / relative
88+
target.parent.mkdir(parents=True, exist_ok=True)
89+
target.write_bytes(source.read(entry))
90+
target.chmod((entry.external_attr >> 16) & 0o777 or 0o644)
91+
extracted.add(relative)
92+
if extracted != selected:
93+
raise RuntimeError("Pinned SDK package is missing required oracle files")
94+
with Path(os.environ["GITHUB_ENV"]).open("a") as environment:
95+
environment.write("ANDROID_HOME=" + str(root) + "\n")
96+
PYTHON
97+
- run: npm run verify:apk-signature -- --require-tools

‎README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ Additional tools and host support depend on the target:
191191
| IL2CPP metadata | Unity global-metadata.dat assembly images, type and method names and index ranges | Built-in static decoding of versions 24, 27, 29, 31 and 39; no Unity required |
192192
| Godot PCK | Archive inventory and extraction, original header/directory facts and selected content identities | Built-in static formats 2, 3 and 4; no Godot required |
193193
| Rust binaries | Embedded cargo-auditable crate names, versions, sources and dependency edges | Built-in static ELF/PE/thin Mach-O inspection; [Rust binaries](docs/rust-binaries.md) |
194+
| PE certificates | Authenticode WIN_CERTIFICATE entries and PKCS#7 signer/X.509 identity fields | Built-in static PE inspection; [PE certificates](docs/pe-certificates.md) |
194195
| ELF notes | PT_NOTE/SHT_NOTE owners, types, GNU build-id and ABI-tag fields | Built-in static ELF inspection; [ELF notes](docs/elf-notes.md) |
196+
| Erlang BEAM | IFF chunks, atoms, exports, imports, lambdas and the Code header | Built-in static BEAM inspection; [Erlang BEAM](docs/erlang-beam.md) |
195197
| WASM artifact | Validation, sections, exact import/export WAT forms and decoded WAT | Caller-supplied WABT 1.0.42; `inspect_wasm_artifact` |
196198
| EVM bytecode | Dispatch selectors, byte offsets, inferred arguments and mutability | Local raw/hex carrier on Linux x64; [offline EVM guide](docs/evm-bytecode.md) |
197199
| SQLite databases | Tables, columns, indexes, views, triggers and selected ordinary-table rows | Local database/WAL snapshot; Node.js 24.x >=24.15 or 26+ with native SQLite limits |
@@ -201,6 +203,7 @@ Additional tools and host support depend on the target:
201203
| Saved network captures | Requests, responses, exposed payloads and source locations | HAR or Fiddler Everywhere SAZ; mitmdump on Linux for native mitmproxy; [capture guide](docs/web-network-captures.md) |
202204
| .NET assemblies | Metadata, CIL instructions, declared native dependencies and build comparisons | None (static only); [managed-code guide](docs/managed-code-analysis.md) |
203205
| Android APKs | Manifest declarations, classes, decompiled methods and references | Headless JADX and a full JDK on Linux/macOS/Windows x64; [Android guide](docs/android-analysis.md) |
206+
| APK signatures | v1/v2/v3/v3.1 signers, certificate fingerprints, key rotation and digest self-consistency | None (static only); `inspect_apk_signature` |
204207
| Android devices | Devices, packages, processes, logs, dumps, screen captures, and APK/file transfers | Caller-supplied adb (emulator or hardware); [ADB guide](docs/adb-device-analysis.md) |
205208
| JEB projects | Engine-backed project units, artifact digests and type/method pseudo-code | A caller-started JEB client serving MCP, selected with REA_JEB_MCP_URL; [JEB guide](docs/jeb-analysis.md) |
206209
| Android resources | Decoded manifest, string tables, locales and version facts | Caller-supplied Apktool launcher; [resource guide](docs/apktool-resource-analysis.md) |

‎docs/.vitepress/config.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export default defineConfig({
3232
{ text: "IL2CPP metadata", link: "/il2cpp-metadata" },
3333
{ text: "Model artifacts", link: "/model-artifacts" },
3434
{ text: "Rust dependencies", link: "/rust-binaries" },
35+
{ text: "PE certificates", link: "/pe-certificates" },
3536
{ text: "ELF notes", link: "/elf-notes" },
37+
{ text: "CPython pyc files", link: "/python-pyc" },
38+
{ text: "Erlang BEAM", link: "/erlang-beam" },
3639
{
3740
text: "JavaScript and Electron",
3841
link: "/javascript-artifact-reconstruction",

0 commit comments

Comments
 (0)