mirror of
https://github.com/morluto/rea.git
synced 2026-12-02 11:33:10 +00:00
test(android): share package report fixtures (#15785)
This commit is contained in:
1 parent
6caa141b36
commit
4bee4d199c
3 files changed
+101
-134
No files matched your search
@@ -1,7 +1,10 @@
|
||||
import {
|
||||
androidPackageComponent as component,
|
||||
androidPackageReport as report,
|
||||
} from "../../../tests/fixtures/androidPackageReport.js";
|
||||
import { expect, it } from "vitest";
|
||||
import { createEvidence } from "../evidence.js";
|
||||
import { projectAnalysisError } from "../analysisErrorProjection.js";
|
||||
import type { JsonValue } from "../jsonValue.js";
|
||||
import { projectAnalysisView } from "./analysisView.js";
|
||||
import type { AnalysisViewParent } from "./analysisViewParent.js";
|
||||
import {
|
||||
@@ -10,84 +13,6 @@ import {
|
||||
} from "./summarySchemas/androidSummarySchemas.js";
|
||||
import { analysisViewRequestSchema } from "./analysisViewRequest.js";
|
||||
|
||||
const component = (name: string, extra: Record<string, JsonValue> = {}) => ({
|
||||
kind: "activity",
|
||||
declared_name: name,
|
||||
name,
|
||||
exported: null,
|
||||
exported_default: null,
|
||||
permission: null,
|
||||
permission_source: "none",
|
||||
intent_filter_count: 0,
|
||||
actions: [] as string[],
|
||||
categories: [],
|
||||
foreground_service_type: null,
|
||||
authorities: null,
|
||||
target_activity: null,
|
||||
declaration_coverage: "complete",
|
||||
declaration_index: 0,
|
||||
location: null,
|
||||
enabled: null,
|
||||
enabled_declaration: null,
|
||||
process: null,
|
||||
grant_uri_permissions: null,
|
||||
grant_uri_permissions_declaration: null,
|
||||
intent_filters: [],
|
||||
meta_data: [],
|
||||
...extra,
|
||||
});
|
||||
const report = (
|
||||
items = [
|
||||
component("example.One", {
|
||||
declared_name: ".One",
|
||||
exported: true,
|
||||
actions: ["VIEW"],
|
||||
declaration_index: 10,
|
||||
declaration_coverage: "complete",
|
||||
}),
|
||||
component("example.Boot", {
|
||||
kind: "receiver",
|
||||
exported_default: true,
|
||||
actions: ["BOOT"],
|
||||
declaration_index: 20,
|
||||
}),
|
||||
component("example.One", {
|
||||
declared_name: ".One",
|
||||
exported: false,
|
||||
actions: ["VIEW"],
|
||||
declaration_index: 30,
|
||||
declaration_coverage: "partial",
|
||||
}),
|
||||
],
|
||||
) => ({
|
||||
engine: {
|
||||
name: "jadx",
|
||||
version: null,
|
||||
artifact_sha256: "e".repeat(64),
|
||||
source_revision: null,
|
||||
worker_count: 1,
|
||||
heap_limit_mib: null,
|
||||
},
|
||||
package_name: "example",
|
||||
version_name: null,
|
||||
version_code: null,
|
||||
min_sdk: null,
|
||||
target_sdk: "35",
|
||||
permissions: [],
|
||||
manifest: {
|
||||
status: "complete",
|
||||
text: "<manifest/>",
|
||||
reported_total_bytes: 11,
|
||||
},
|
||||
components: {
|
||||
status: "partial",
|
||||
items,
|
||||
limitations: ["Producer component limit"],
|
||||
},
|
||||
class_count: 3,
|
||||
resource_count: 0,
|
||||
signature_verification: "not_performed",
|
||||
});
|
||||
const parent = (value = report()): AnalysisViewParent => {
|
||||
const evidence = createEvidence(
|
||||
{ path: "/retained.apk", sha256: "a".repeat(64), format: "apk" },
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import {
|
||||
androidPackageComponent,
|
||||
androidPackageReport,
|
||||
} from "../../fixtures/androidPackageReport.js";
|
||||
import { unknownTarget } from "../../../src/domain/targetIdentity.js";
|
||||
import { fileIdentity } from "../../fixtures/evidenceSubject.js";
|
||||
import {
|
||||
@@ -614,61 +618,17 @@ it("delivers the selected retained page in one analysis and reads it later witho
|
||||
{
|
||||
operation: "inspect_android_package",
|
||||
parameters: { path: "/never-reopened.apk" },
|
||||
result: {
|
||||
engine: {
|
||||
name: "jadx",
|
||||
version: null,
|
||||
artifact_sha256: "b".repeat(64),
|
||||
source_revision: null,
|
||||
worker_count: 1,
|
||||
heap_limit_mib: null,
|
||||
},
|
||||
package_name: "example",
|
||||
version_name: null,
|
||||
version_code: null,
|
||||
min_sdk: null,
|
||||
target_sdk: "35",
|
||||
permissions: [],
|
||||
manifest: {
|
||||
status: "complete",
|
||||
text: "<manifest/>",
|
||||
reported_total_bytes: 11,
|
||||
},
|
||||
components: {
|
||||
status: "complete",
|
||||
limitations: [],
|
||||
items: [
|
||||
{
|
||||
kind: "activity",
|
||||
declared_name: ".Main",
|
||||
name: "example.Main",
|
||||
exported: true,
|
||||
exported_default: null,
|
||||
permission: null,
|
||||
permission_source: "none",
|
||||
intent_filter_count: 1,
|
||||
actions: ["VIEW"],
|
||||
categories: [],
|
||||
foreground_service_type: null,
|
||||
authorities: null,
|
||||
target_activity: null,
|
||||
declaration_coverage: "complete",
|
||||
declaration_index: 0,
|
||||
location: null,
|
||||
enabled: null,
|
||||
enabled_declaration: null,
|
||||
process: null,
|
||||
grant_uri_permissions: null,
|
||||
grant_uri_permissions_declaration: null,
|
||||
intent_filters: [],
|
||||
meta_data: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
class_count: 1,
|
||||
resource_count: 0,
|
||||
signature_verification: "not_performed",
|
||||
},
|
||||
result: androidPackageReport(
|
||||
[
|
||||
androidPackageComponent("example.Main", {
|
||||
declared_name: ".Main",
|
||||
exported: true,
|
||||
intent_filter_count: 1,
|
||||
actions: ["VIEW"],
|
||||
}),
|
||||
],
|
||||
{ engineDigest: "b".repeat(64), classCount: 1, complete: true },
|
||||
),
|
||||
},
|
||||
);
|
||||
const provider = {
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
import type { JsonValue } from "../../src/domain/jsonValue.js";
|
||||
|
||||
export const androidPackageComponent = (
|
||||
name: string,
|
||||
extra: Record<string, JsonValue> = {},
|
||||
) => ({
|
||||
kind: "activity",
|
||||
declared_name: name,
|
||||
name,
|
||||
exported: null,
|
||||
exported_default: null,
|
||||
permission: null,
|
||||
permission_source: "none",
|
||||
intent_filter_count: 0,
|
||||
actions: [] as string[],
|
||||
categories: [],
|
||||
foreground_service_type: null,
|
||||
authorities: null,
|
||||
target_activity: null,
|
||||
declaration_coverage: "complete",
|
||||
declaration_index: 0,
|
||||
location: null,
|
||||
enabled: null,
|
||||
enabled_declaration: null,
|
||||
process: null,
|
||||
grant_uri_permissions: null,
|
||||
grant_uri_permissions_declaration: null,
|
||||
intent_filters: [],
|
||||
meta_data: [],
|
||||
...extra,
|
||||
});
|
||||
export const androidPackageReport = (
|
||||
items = [
|
||||
androidPackageComponent("example.One", {
|
||||
declared_name: ".One",
|
||||
exported: true,
|
||||
actions: ["VIEW"],
|
||||
declaration_index: 10,
|
||||
declaration_coverage: "complete",
|
||||
}),
|
||||
androidPackageComponent("example.Boot", {
|
||||
kind: "receiver",
|
||||
exported_default: true,
|
||||
actions: ["BOOT"],
|
||||
declaration_index: 20,
|
||||
}),
|
||||
androidPackageComponent("example.One", {
|
||||
declared_name: ".One",
|
||||
exported: false,
|
||||
actions: ["VIEW"],
|
||||
declaration_index: 30,
|
||||
declaration_coverage: "partial",
|
||||
}),
|
||||
],
|
||||
{ engineDigest = "e".repeat(64), classCount = 3, complete = false } = {},
|
||||
) => ({
|
||||
engine: {
|
||||
name: "jadx",
|
||||
version: null,
|
||||
artifact_sha256: engineDigest,
|
||||
source_revision: null,
|
||||
worker_count: 1,
|
||||
heap_limit_mib: null,
|
||||
},
|
||||
package_name: "example",
|
||||
version_name: null,
|
||||
version_code: null,
|
||||
min_sdk: null,
|
||||
target_sdk: "35",
|
||||
permissions: [],
|
||||
manifest: {
|
||||
status: "complete",
|
||||
text: "<manifest/>",
|
||||
reported_total_bytes: 11,
|
||||
},
|
||||
components: complete
|
||||
? { status: "complete", limitations: [], items }
|
||||
: { status: "partial", items, limitations: ["Producer component limit"] },
|
||||
class_count: classCount,
|
||||
resource_count: 0,
|
||||
signature_verification: "not_performed",
|
||||
});
|
||||
Reference in new issue
Block a user