feat: 接入 iOSGuard LLVM 混淆工具链与 IPA 加固门禁,按分支策略兼容旧版本打包
- 新增 toolchain_manager:构建前自愈校验 LLVM opt 工具链,按 Xcode 版本与渠道隔离 obj_cache - readoor31/readoor31OtherPay Archive 透传 IG_DIST_CHANNEL/IG_OBF_MODE/IG_ALL_GUARD_OFF/IG_RELEASE_SEED - Archive 前核对分发渠道编译条件:上架包缺失 IG_APPSTORE_DISTRIBUTION 即阻断,非上架包带该条件仅告警,未接入 anti_tamper 的分支跳过 - 导出后执行 IPA 加固门禁审计,失败阻断上传;持久化 dSYM、混淆映射、诊断事件码与审计报告 - 混淆是否执行改由分支 AutoPacking/build_policy.json 声明:force_obfuscation=true 强制,否则按任务勾选,兼容旧分支/旧 Tag;恢复打包页混淆勾选框 - 分支未自带混淆脚本时回退服务端脚本并告警;同步更新服务端 L1 混淆脚本 - .gitignore 忽略 iosguard_cache 与 artifacts 运行时目录;README 补充分支打包策略说明
This commit is contained in:
@@ -50,6 +50,9 @@ describe('BuildView.vue', () => {
|
||||
expect(wrapper.text()).toContain('打包类型')
|
||||
expect(wrapper.text()).toContain('代码分支')
|
||||
expect(wrapper.text()).toContain('代码混淆')
|
||||
expect(wrapper.text()).toContain('build_policy.json')
|
||||
expect(wrapper.find('#obfuscation').exists()).toBe(true)
|
||||
expect(wrapper.find('#obfuscation').element.checked).toBe(true)
|
||||
})
|
||||
|
||||
it('加载 apps 和 schemes', async () => {
|
||||
@@ -118,7 +121,7 @@ describe('BuildView.vue', () => {
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.vm.form.build_type).toBe('')
|
||||
expect(wrapper.vm.form.obfuscation).toBe(false)
|
||||
expect(wrapper.vm.form.obfuscation).toBe(true)
|
||||
expect(wrapper.vm.form.branch).toBe('main')
|
||||
})
|
||||
|
||||
@@ -154,12 +157,41 @@ describe('BuildView.vue', () => {
|
||||
expect(fetch).toHaveBeenCalledWith('/api/tasks', expect.objectContaining({
|
||||
method: 'POST',
|
||||
}))
|
||||
const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST')
|
||||
expect(JSON.parse(post[1].body).obfuscation).toBe(true)
|
||||
expect(wrapper.text()).toContain('打包任务已创建,正在排队,请勿重复点击。')
|
||||
expect(wrapper.vm.form.app_id).toBe('')
|
||||
expect(wrapper.vm.form.build_type).toBe('')
|
||||
expect(wrapper.vm.form.scheme_id).toBe('')
|
||||
})
|
||||
|
||||
it('取消勾选混淆时提交 obfuscation=false(旧分支按勾选执行)', async () => {
|
||||
fetch.mockImplementation((url, opts) => {
|
||||
if (url === '/api/tasks' && opts?.method === 'POST') {
|
||||
return Promise.resolve({ ok: true, json: () => Promise.resolve({ id: 'test-id', status: 'pending' }) })
|
||||
}
|
||||
const responses = {
|
||||
'/api/apps': { '1': { name: '测试App', server: '测试环境', certificates: { Ad_Hoc: {} } } },
|
||||
'/api/schemes': { '1': { name: 'testScheme' } },
|
||||
'/api/branches': ['main', 'dev'],
|
||||
'/api/tasks': [],
|
||||
}
|
||||
return Promise.resolve({ json: () => Promise.resolve(responses[url] || {}) })
|
||||
})
|
||||
|
||||
const wrapper = mountBuildView()
|
||||
await flushPromises()
|
||||
wrapper.vm.selectedServer = '测试环境'
|
||||
await wrapper.vm.$nextTick()
|
||||
wrapper.vm.form.app_id = '1'
|
||||
await wrapper.find('#obfuscation').setValue(false)
|
||||
await wrapper.find('.btn-primary').trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
const post = fetch.mock.calls.find(([url, opts]) => url === '/api/tasks' && opts?.method === 'POST')
|
||||
expect(JSON.parse(post[1].body).obfuscation).toBe(false)
|
||||
})
|
||||
|
||||
it('未选择 App 时提示', async () => {
|
||||
window.alert = vi.fn()
|
||||
const wrapper = mountBuildView()
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
<input type="checkbox" id="obfuscation" v-model="form.obfuscation">
|
||||
<label for="obfuscation">启用混淆</label>
|
||||
</div>
|
||||
<div class="obfuscation-hint">分支声明强制混淆(AutoPacking/build_policy.json)时始终启用,此勾选仅对旧分支/旧 Tag 生效</div>
|
||||
</div>
|
||||
<p v-if="submitNotice" class="submit-notice" role="status" aria-live="polite">{{ submitNotice }}</p>
|
||||
<button class="btn btn-primary" @click="submitTask" :disabled="submitting">
|
||||
@@ -203,7 +204,7 @@ const form = ref({
|
||||
app_id: '',
|
||||
build_type: '',
|
||||
scheme_id: '',
|
||||
obfuscation: false,
|
||||
obfuscation: true,
|
||||
branch: 'main',
|
||||
})
|
||||
const submitting = ref(false)
|
||||
@@ -380,7 +381,7 @@ const submitTask = async () => {
|
||||
const res = await authFetch('/api/tasks', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ ...form.value, obfuscation: supportsObfuscation.value && form.value.obfuscation }),
|
||||
body: JSON.stringify({ ...form.value, obfuscation: Boolean(supportsObfuscation.value && form.value.obfuscation) }),
|
||||
})
|
||||
if (res.ok) {
|
||||
const task = await res.json()
|
||||
@@ -392,7 +393,7 @@ const submitTask = async () => {
|
||||
app_id: '',
|
||||
build_type: '',
|
||||
scheme_id: '',
|
||||
obfuscation: false,
|
||||
obfuscation: Boolean(supportsObfuscation.value),
|
||||
branch: branches.value[0] || 'main',
|
||||
}
|
||||
} else {
|
||||
@@ -472,6 +473,7 @@ const errorCategoryHint = (cat) => {
|
||||
.form-group select:focus { outline: none; border-color: #1890ff; }
|
||||
.checkbox-group { display: flex; align-items: center; gap: 8px; }
|
||||
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; }
|
||||
.obfuscation-hint { margin-top: 6px; color: #999; font-size: 12px; line-height: 1.4; }
|
||||
.btn { padding: 10px 20px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; width: 100%; }
|
||||
.btn-primary { background: #1890ff; color: white; }
|
||||
.btn-primary:hover { background: #40a9ff; }
|
||||
|
||||
Reference in New Issue
Block a user