Log date · Mon
Can AI clone your app? How to measure the risk
Published on · Updated
Define the target first. Our two quote-function imitations passed 30% and 100% of ten cases; neither score describes a whole app.
Define the clone before measuring it
To assess whether AI can clone an app, define whether the target is its interface, business behavior, data or service access, then test that claim. In ten cases for a quote function we wrote, a format-only imitation passed 3 (30%); an implementation written from observed inputs and outputs passed 10 (100%).
The same output fields do not imply the same rules; a perfect score establishes agreement on these ten cases. OWASP describes a threat model as a subject, assumptions, threats, mitigations and a way to validate them. [1]
| Question | Finding |
|---|---|
| Does matching the format match behavior? | No: the format-only version passed 3/10. |
| Can observed inputs and outputs inform a reimplementation? | The observed version passed 10/10; observations overlap acceptance cases. |
| Does that establish a complete app clone? | No; assess other assets separately. |
Sample, observations and acceptance set
Our fictional quote function takes a quantity and returns a USD total in cents: a fixed fee of 500, plus 100 per item for quantities 1 through 9 or 90 per item for 10 through 100. Other inputs return an error. We ran three functions and fixed expected values using Node.js 20.19.5. The experiment covers this small function only; it used no AI, real app, network service or timing, and measured no attack cost.
function reference(n) {
if (!Number.isInteger(n) || n < 1 || n > 100)
return { error: 'invalid quantity' };
return { total: 500 + n * (n >= 10 ? 90 : 100), currency: 'USD' };
}We used results for 1, 2, 9, 10, 100, 0, 101, 1.5 and the string “10” as observations. We wrote both imitations: the first copies the successful response fields and always charges 100 per item; the second infers the range, prices and error handling from the examples. It lives in the same file as the reference, so this is not evidence of author isolation.
The acceptance set has separately fixed expected values for ordinary inputs, the tier boundary, endpoints and invalid types. Eight of its ten inputs also appear in the observations; 4 and 11 are the only unseen valid quantities. Consequently the score is not an independent test of generalization.
Read the passes and failures
The reference first passes every expected value, checking that the fixtures agree with the written rule. On successful responses both imitations can return total and currency, but at 10 items the format-only version still uses the old price. It also fails to return the agreed error for invalid inputs.
== fixed acceptance cases ==
minimum | 1 | {"total":600,"currency":"USD"} | PASS | PASS | PASS
ordinary | 4 | {"total":900,"currency":"USD"} | PASS | PASS | PASS
below tier | 9 | {"total":1400,"currency":"USD"} | PASS | PASS | PASS
tier starts | 10 | {"total":1400,"currency":"USD"} | PASS | FAIL | PASS
above tier | 11 | {"total":1490,"currency":"USD"} | PASS | FAIL | PASS
maximum | 100 | {"total":9500,"currency":"USD"} | PASS | FAIL | PASS
zero | 0 | {"error":"invalid quantity"} | PASS | FAIL | PASS
over maximum | 101 | {"error":"invalid quantity"} | PASS | FAIL | PASS
fraction | 1.5 | {"error":"invalid quantity"} | PASS | FAIL | PASS
string | "10" | {"error":"invalid quantity"} | PASS | FAIL | PASS
== scores: reference | format-only | observed-input-output ==
10/10 (100%) | 3/10 (30%) | 10/10 (100%)The totals for 9 and 10 happen to be the same: 1,400 cents. Looking only for an increasing price could miss the tier change. At the unseen valid input of 11, the observed version still gives 1,490 while the format-only version fails. Keep concrete inputs and expectations on both sides of a boundary, not just a summary percentage.
Every case here has equal weight, and comparison uses exact JSON serialization including property order. In production, define which fields, types, order and tolerances matter to users; when object key order is irrelevant, Node offers strict deep assertions for structured comparisons. [3] A serious failure in money, authorization or an irreversible operation should not be canceled out by several easy passes.
Turn the threat into testable targets
Start with assets. Whether a screen can be imitated, a core rule substituted, user data read, or a service operation invoked without authorization each requires different evidence. NIST’s draft on data-centric threat modeling focuses risk assessment on selected data. [2] The same asset-first habit is useful for business logic, but NIST did not certify this experiment.
For each target, record what the evaluator can access: public screens, a test account, a package, documentation or a limited number of normal queries. Specify limits, budget, time, version and success criteria. A budget can be person-hours, query count or cost; scores under different conditions are not directly comparable. Record repeatable observations, such as an input and expected response, rather than substituting “AI can break it” for evidence.
Distinguish analysis from delivery: explaining a rule, producing a visual demo, passing a subset of tests and delivering a maintainable workflow are different outcomes. Service access also requires testing server authorization boundaries; a similar client screen does not establish access to accounts, data or operations.
Recommendations by risk
These are recommendations, not effects measured by the function experiment. Decide the potential loss and acceptable failure first, then choose an assessment.
| Concern | Recommendation |
|---|---|
| Interface imitation | Fix device and state; compare key flows and accessibility. |
| Core calculation | Reserve hidden cases and boundaries; compare outputs and errors individually. |
| User data | Map data flows and permissions; test isolation with test accounts. |
| Server operations | Verify identity, authorization, limits and audit records; record denials. |
| Offline behavior | Test disconnection, expiry and recovery; define acceptable limits. |
If a rule must run offline in the client, treat its behavior as observable and assess replication effort and business impact. If the feature can be online, server-side execution can reduce the rules shipped to the client, at the cost of latency, availability and operations. In either architecture, test authorization and data isolation separately.
Run an acceptance test on your app
We built a small sample and ran acceptance cases, inspecting each result rather than just the total. Select a high-value flow you are authorized to test, write fixed inputs, expected outputs and errors using test data, and put the acceptance cases in your own script.
node --version
node path/to/your-app/acceptance-test.jsSeparate the test author from the implementer: freeze the public observation set and reserve some boundaries, errors and end-to-end flows as hidden acceptance cases without disclosing expectations before scoring. Validate the reference first, then run the same cases against each implementation. Keep the version, environment, access conditions, individual outcomes and failure details, along with implementer time and query count; mark missing data as unrecorded.
Define the pass threshold for the actual business: monetary results may require exact agreement, text may allow equivalent wording, and security-related denials may each be mandatory. Freeze the suite and access budget before a rerun; when rules or app versions change, retain the old result and establish a new baseline. The reported number then has a comparable denominator and tells the team where to investigate next.
Your checklist
- List interface, rules, data and service permissions as separate assets.
- Freeze the version, access conditions, budget and success criteria.
- Prepare normal, boundary, error and hidden acceptance cases.
- Record reference and imitation results case by case.
- Test authorization, offline recovery and data isolation separately.
- Establish a new baseline when versions or rules change.
Primary sources
- OWASP: Threat Modeling · Checked 2026-11-11
- NIST SP 800-154: Guide to Data-Centric System Threat Modeling (initial public draft) · Checked 2026-11-11
- Node.js: Assert · Checked 2026-11-11