# Test a repository or an app file

Add a repository or an app file as a project, and the Attack Agent audits it on every run, answering the question you set for the project.

A repository project or an app project has the Attack Agent read source code or one app file instead of testing a website. Each project has a question, such as "Can one customer read another customer's orders?", and every run answers it from the code or the file. Add these projects in [Setup](/docs/projects/). Owners and admins add them; anyone in the workspace can start their runs.

Their runs are planned like any other: press **Run now**, plan one with **+ Attack** or on the **Calendar**, or let **Autopilot** plan them. They need an active plan with agent hours, but no verified website. App projects get Attack runs only. A repository connected through GitHub also gets Defense runs that fix what the Attack Agent finds (see [Fixes for a GitHub repository](#fixes-for-a-github-repository)). Swarms work on website projects only.

## Audit a repository

### Add the repository in Setup
Open **Setup**, choose **Repository**, then choose your GitHub repository or type a public address. See [Add a repository](/docs/projects/#add-a-repository).

### Write the question
In **Question**, write what you want to know, in at least five words. A question is filled in for you.

### Start a run
Press **Add repository**, then **Run now** at the top of the sidebar. The dashboard says "Attack Agent starts in a moment."

The **Repository** mode of the box on AgentProof's home page opens Setup with the address you typed already filled in.

### Which repositories you can audit

**A public repository.** The address must:

- start with `https://` and end in `.git`
- use a public host name, not an IP address or a local name, on the standard port
- have no user name, password, `?` or `#` in it
- be at most 512 characters long

AgentProof downloads it without signing in. It audits the repository's default branch.

**A GitHub repository.** Choose it in Setup after you connect GitHub. This works for private repositories too. AgentProof audits the repository's default branch, shown on the project in Setup and in **Settings > Code**. For the download, it gets a read-only key for that one repository, valid for one hour. The key is used only for the download. It is never written into the copy or shown to the agent. See [Connect your code](/docs/connect-your-code/).

In both cases:

- AgentProof picks the commit when the run starts and keeps it, so the run reads one fixed version of the code.
- It downloads only that commit, without its history. Submodules are not downloaded, and Git LFS files stay as their small pointer files.
- The download may be at most 512 MiB. A larger repository fails the run with **Target not ready**.
- The agent's copy is read-only. The agent records each problem with the file and line where it is.

### Build and run the app

A repository run can also build your repository, start it and test the running copy. This happens in a sandbox: a separate container on the agent's computer that cannot reach that computer, its files or the run's keys and secrets.

Before the agent hears of the sandbox, AgentProof runs a self-check on it. If any part of the check fails, the run continues as a code-only audit: the agent reads the code but does not build or run it, and says so in its report.

When the sandbox passes its check:

- The agent builds the app from the repository's own setup: its compose file, Dockerfile or `.env.example`, with throwaway local values. It may add a Dockerfile, a compose file or a `.env` to a working copy.
- While it builds, the app may reach public internet addresses, for example to download packages. Once it runs, it cannot reach anything outside the sandbox. The agent reaches it only at `127.0.0.1` on the agent's own computer.
- The agent fills the app with fake data only: an admin-like account, an ordinary account, a second team or tenant where the app has them, and sample records.
- The agent attacks only this local copy. Services your app calls, the website in **Settings** and every other host are out of scope.
- The agent reads the code while the app builds, so a build that fails still leaves a full code audit.

#### Time and size limits in the sandbox

| Step | Limit |
|---|---|
| Building, all attempts together | 20 minutes, and it must end 25 minutes before the run's end |
| Starting, until the app answers | 5 minutes |
| Each command run inside the app, such as a database setup | 5 minutes |
| Last start of the app | 10 minutes before the run's end |
| App stopped for the report | 5 minutes before the run's end |
| Space for the sandbox's images and data | 20 GiB |
| Ports the app may open | 3 |

A repository run can take a few minutes longer to start than other runs while the sandbox is set up and checked.

#### Settings for your running app

For a GitHub repository only, owners and admins can add **Build settings** in **Settings > Code** while the repository's project is the current one: names and values your app needs to run, such as a test API key. Members see the names only. AgentProof passes them into the app when it starts, never while it builds. Values of 8 characters or more are hidden in every record of the run. Runs on a public address get no build settings. See [Connect your code](/docs/connect-your-code/).

#### Problems found in the code and in the running app

Each problem from a repository run says where it was found:

- **In the code**: the code shows it, at a file and line.
- **In the running app**: a request to the running copy showed it.

A problem the agent says it found in the running app counts as confirmed only when AgentProof itself saw the app answer on its port. Otherwise it is recorded as unconfirmed.

## Analyse a mobile app or an app file

### Add the app in Setup
Open **Setup** and choose **Mobile app** (Android or iOS) or **App file** (a program for a computer). Choose the file, of up to 200 MB. See [Add a mobile app](/docs/projects/#add-a-mobile-app).

### Write the question
In **Question**, write what you want to know, in at least five words.

### Start a run
Press **Add app**, then **Run now**.

### File types you can upload

AgentProof reads the start of the file to decide its type. The file name's ending must agree with it, so a renamed file is refused.

| File type | File name ending |
|---|---|
| Android APK | `.apk` |
| Android App Bundle | `.aab` |
| iOS IPA | `.ipa` |
| ZIP bundle that holds a native program | `.zip` |
| ELF program or library (Linux) | `.so`, `.bin`, `.elf`, `.out`, or no ending |
| Windows PE program or library | `.exe`, `.dll`, `.sys` |
| Mach-O program or library (Apple) | `.dylib`, `.bundle`, or no ending |

The file stays with the project: every run of the project reads the same file, and it counts once toward your workspace's storage. To test a new build, open the project in Setup, choose the **New version** and press **Upload**. A mobile app's file must match its platform: `.apk` or `.aab` for Android, `.ipa` for iOS. An Android or iOS file cannot be added as an **App file**.

### How the agent studies the file

The agent studies the file without running it. It reads its headers, manifests, signatures and text, and takes the code apart to read it. It never runs, installs, launches or emulates the app or anything inside it, and no phone, emulator or simulator is available to it. When your question needs the app running, the agent says so in its report instead of guessing.

For an iOS app whose main program is encrypted by Apple, the agent says that the encrypted code was not analysed. It never tries to remove the encryption.

Each problem's evidence names the file's SHA-256, a fingerprint that identifies the exact file.

## Fixes for a GitHub repository

A repository project connected through GitHub gets the Defense Agent too:

- When an Attack run confirms problems, a **Repair** run by the Defense Agent starts on its own. It changes the code in its own copy of the repository and opens a pull request, or keeps the fix to download when **Open pull requests for fixes** is off in **Settings > Code**. See [Connect your code](/docs/connect-your-code/).
- A Defense run planned on the **Calendar** or by **Autopilot** reviews the code, fixes the project's open problems first, then other problems it can confirm.
- After you merge the pull request, a **Retest** run of the Attack Agent reads the code again on that branch and marks each problem fixed or still open.

A repository added with a public address, a mobile app and an app file get no Defense runs: AgentProof cannot write to them.

## What repository and app runs do not do

These runs read code or a file. Unlike Attack runs on a website, they:

- do not test your website
- open no pull request themselves: only a Defense run does, for a GitHub repository
- keep their own notes under the project, apart from your websites' notes (see [Agent memory](/docs/agent-memory/))
- have no swarm copies
- never receive your test accounts and keys
- do not write the weekly summary

## When a run cannot start

**Run now** and the plan buttons refuse a run, with one of these messages, when:

- **Choose a plan to plan runs.** The workspace has no plan. An owner or admin chooses one in **Settings > Billing**.
- **No agent hours left to plan another run.** Your hours, and the extra hours your spending cap allows, are used up or planned. See [Plans](/docs/plans/).
- **Upload the app file.** or **Connect the repository on GitHub.** The project is missing its file, or its GitHub repository is no longer connected.
- **The Defense Agent works on websites and on repositories connected through GitHub.** An app file or a public address has Attack runs only.

The Attack Agent runs one run at a time in each project, and can work on several projects at once. A run planned while it is busy in this project starts when it is free. A planned run that still cannot start is marked **Skipped** on the Calendar with the reason, such as **No code added** when the project's file or repository is gone.

The messages you can meet while adding the project are on [Projects and Setup](/docs/projects/#messages-in-setup).

## Where repository and app runs appear

- The dashboard's feed says "Attack Agent is checking code" or "Attack Agent is checking an app" while the run is going, and the work panel is titled with the project's name.
- The **Running** and **Done** lists in the dashboard panel add "· code" or "· app" to the run.
- **Reports** and the **Calendar**'s day lists label them CODE and APP.
- The run page names the repository or the file in its heading, shows the **PROJECT**, and shows **Code** or **App** as the run's **ORIGIN** under **More about this run**.
- A repository run page shows **REPOSITORY** (the connected repository's name, or the address), **BRANCH** and **COMMIT** (the first 7 characters).
- An app run page shows **FILE**, **FILE TYPE** and **SHA-256** (the first 12 characters).
- A repository run that tried the sandbox has a section, **What happened when the agent ran the app.**, with:
  - **BUILT**: **Yes**, **No** with the reason, or **Not tried**
  - **REMOVED**: risky settings the sandbox took out of the repository's compose file, such as access to the computer's files
  - **RAN**: **Yes, on 127.0.0.1** and the port, **No** with the reason, or **Not started**
  - **SEEDED**: how many fake accounts of each role, teams and records the agent added
  - **APP**: shown instead when the sandbox failed its self-check: "Could not be run: the sandbox failed its checks", with the names of the checks

## When the run cannot get the code or file

If AgentProof cannot download the repository or prepare the file, the run ends as **Failed** and its page shows: "The repository or application file for this run could not be prepared." Common causes are a repository larger than 512 MiB, an address that stopped answering, a branch or repository that no longer exists, or a GitHub repository that is no longer connected. Check the project in Setup and the connection in **Settings > Code**, then start the run again.

- [Projects and Setup](/docs/projects/) Add a repository or an app as a project.
- [Attack Agent](/docs/attack-agent/) What the Attack Agent tests on your website.
- [Connect your code](/docs/connect-your-code/) Connect GitHub and add build settings.
- [Runs and reports](/docs/runs-and-reports/) Read a run page and its report.
