Website and code
Connect your code
Connect your website's GitHub repository or upload a copy of its code in Settings, so the Defense Agent can fix what the Attack Agent finds.
The Defense Agent fixes problems in your website's code, so it needs a copy of that code. In Settings > Code, under "Where the Defense Agent gets your code and sends its fixes.", owners and admins connect the website's GitHub repository (the place on GitHub where its code is stored) or upload a copy of the code. Members can see what is connected but cannot change it.
Two ways to give AgentProof your code
| Way | Best for | How fixes reach you |
|---|---|---|
| Connect GitHub | Code kept on GitHub | A pull request your team reviews, or a download on the run page |
| Upload a copy | Code kept anywhere else | A download on the run page |
When both are set, AgentProof uses the GitHub repository.
Before you connect your code
- Your website must be added as a project, with its domain verified and your confirmation that you may test it, and be the current project. See Add your website and verify its domain.
- The code you add belongs to that website. Each website has at most one GitHub repository and one uploaded copy, and a GitHub repository belongs to one project only.
- To have the Attack Agent audit a repository by itself, add it as a repository project in Setup instead. See Test a repository or an app file.
Connect a GitHub repository
Press Connect GitHub
Open Settings > Code, or go to /dashboard/settings/code/, and press Connect GitHub. Once your workspace has the AgentProof GitHub App installed, the button reads Add GitHub access.
Install the AgentProof GitHub App
GitHub asks where to install the AgentProof app and which repositories it may use. Choose your website's repository. GitHub then sends you back to Settings > Code.
Choose the repository
Under GitHub, choose the repository in Repository.
Press Add repository
The repository appears as
owner/name, with your website and the branch AgentProof uses, and the section says "Saved."
AgentProof uses the branch that was the repository's default branch when you connected it, usually main.
To give the app more repositories later, press Add GitHub access. The list of repositories can take up to a minute to show a change you made on GitHub.
Keys AgentProof uses in your repository
AgentProof asks GitHub for a new short-lived key for each job. Each key works for your one repository only, and only for what that job needs:
- Reading the code. For each Defense Agent run, AgentProof's server gets a one-hour key that can only read the repository. Before the agent starts, its computer uses that key to fetch one commit of your branch. The key is sent only with that one download and is not saved with the copy, so the agent cannot fetch or push with it. + Code audits of your connected repository read it the same way.
- Writing a fix. AgentProof's server writes the fix branch and opens the pull request itself, with a separate key that never reaches the agent's computer.
- Reporting a deploy test. AgentProof's server adds the AgentProof check to deployed commits. See Run a pentest after every deploy.
AgentProof never merges a pull request.
Upload a copy of your code
Make an archive of your code
Pack your website's code into a
.zipor.tar.gzfile. A ZIP downloaded from GitHub works as it is.Choose the file
In Settings > Code, under Copy of your code, choose the file in Code (.zip or .tar.gz).
Press Upload code
Press Upload code. When a copy is already saved, the button reads Replace the code. The section says "Saved."
The saved copy shows its file name, then its number of files, its size and when it was added.
Leave files with real secrets, such as a .env file with live passwords, out of the archive. The Defense Agent does not need them to fix code.
Limits for uploaded code
| What | Limit |
|---|---|
| File types | .zip, .tar.gz or .tgz |
| Archive size | 40 MB |
| Size once unpacked | 300 MB |
| Number of files | 30,000 |
Changes AgentProof makes to the archive
AgentProof packs your archive again before any agent sees it:
- It keeps ordinary files only. Links, shortcuts and special files are left out.
- It leaves out everything in
.gitand__MACOSXfolders. - When one folder holds everything, as in GitHub's downloads, it removes that outer folder.
- Each file keeps only whether it can run as a program. Other file permissions are dropped.
- It refuses an archive with a file whose path leads outside the archive's folder.
Each website has one copy. Uploading again replaces it. A run that already started keeps the copy it started with. To delete the copy, press Remove, then Confirm remove.
Get fixes as pull requests or downloads
Open pull requests for fixes decides what happens to a fix when your code is on GitHub. It is on by default. Owners and admins change it in Settings > Code and press Save.
- On, with a connected repository: AgentProof opens a pull request on a branch named
agentproof/fix-plus the run's ID, against your linked branch. The run page shows PULL REQUEST OPEN with a link. Your team reviews and merges it. After the merged fix is deployed, the Attack Agent tests the website again. - Off, or with an uploaded copy: the fix stays on the run page as FIX READY, with Download the fix. The download is a
.zipof the changed files, plusDELETED-FILES.txtwhen the fix deletes files. You apply it yourself. No retest follows a fix you download.
See Defense Agent for how repairs and retests work.
Files the Defense Agent may not change
The Defense Agent is told to make the smallest change that fixes each problem, in the style of the code around it, to leave secrets alone, to add a dependency only when the fix needs one, and to run your tests and linters when you have them.
AgentProof also checks every fix before it reaches you:
- A fix changes text files only: at most 50 files, each up to 1 MB, and 4 MB in all.
- A fix may not touch these paths at the top of your code:
.git/,.github/,.gitlab-ci.yml,.circleci/,.buildkite/,azure-pipelines.yml,bitbucket-pipelines.ymlorJenkinsfile. A branch in your repository could otherwise run workflow files with your repository's secrets.
A fix that breaks these rules is refused as a whole. The run page then shows NO FIX with the reason, for example "The fix was refused: the fix may not change ".github/workflows/deploy.yml"."
Add Build settings for code runs
When you connect a GitHub repository, Build settings appears under it. Build settings are environment variables your app needs to run, such as DATABASE_URL. AgentProof gives them to your app when the Attack Agent builds and runs your connected repository in a code audit.
Press Add setting
Under Build settings, press Add setting.
Fill in Name and Value
Name is the variable's name. Value is what your app reads from it.
Press Add
The name appears in the list, and the section says "Saved."
The rules:
- Name uses capital letters, digits and underscores, starts with a letter or an underscore, and is at most 128 characters long. It may not start with
AGENTPROOF_,BRIDGE_orDOCKER_. - Value is 1 to 8,192 bytes.
- Each repository holds up to 50 settings. Adding a name that already exists replaces its value.
How AgentProof handles them:
- They are write-only and stored encrypted. Members see the names only.
- AgentProof passes them to your app only when it starts your app in its sandbox, after the app's internet access is closed, and never while the app is being built.
- Only code audits of your connected repository receive them. Website runs and audits of a public repository address never do.
- Values of 8 characters or more are replaced with
[redacted]in the run's records and taken out of everything sent to the AI model. Shorter values stay hidden in Settings but are not redacted, so do not put a short secret here.
To delete a setting, press Remove, then Confirm remove. Removing the repository removes its Build settings too.
Test the website after every deploy
Once a repository is connected, owners and admins see two more choices in Settings > Code:
- Test after every deploy: Off, Production deployment (the default) or Push to your branch, for example Push to main.
- Fail the check at: High (the default), Medium or Low.
Press Save to keep them. Run a pentest after every deploy explains both and the GitHub Action.
Remove or change the connection
- Remove a repository: press Remove next to it, then Confirm remove. Its Build settings go with it.
- On GitHub: uninstalling the AgentProof app, or taking a repository away from it, removes that repository's link in AgentProof.
- Change your website: saving a different origin for the project in Settings > Website unlinks the repository. A copy uploaded for the old website is kept but not used, and Settings shows the copy for the current website only.
Without any code
Without a repository or an uploaded copy:
- Confirmed problems from the Attack Agent do not start a repair by the Defense Agent.
- Planned Defense Agent runs are skipped. The Calendar shows No code added, and the skip message reads "Add your code in Settings."
- Auto schedule plans Attack Agent runs only.
Fix problems with your code connection
"Only owners and admins can manage repositories." or "Only owners and admins can change the code."
Members cannot connect repositories, upload code or change these settings. Ask an owner or admin of your workspace. Build settings show "Only owners and admins can manage build settings."
"Add your website in Settings.", "Verify www.example.com in Settings first." or "Confirm you may test www.example.com in Settings."
Adding a repository or uploading code needs a website project with a verified domain and your confirmation, as the current project. Finish it in Setup first.
The repository is not in the list
The list shows only repositories you let the AgentProof app use on GitHub, and leaves out one that is already connected. Press Add GitHub access to choose more repositories, then wait up to a minute and open Settings > Code again.
"Your website already has a repository. Remove it first."
Each website can have one repository. Remove the one that is there, then add the new one.
"GitHub did not answer. Try again."
GitHub did not reply in time. Reload Settings > Code and try again.
"This GitHub installation is connected to another workspace."
One installation of the AgentProof app can belong to one AgentProof workspace only. Use the workspace it is connected to, or uninstall the app on GitHub and install it again from this workspace.
"Your GitHub account cannot manage this installation."
The GitHub account you used cannot manage that installation of the app. Sign in to GitHub as someone who can, then press Connect GitHub again.
"This GitHub link is not valid for this workspace." or "GitHub did not confirm the installation."
The link from GitHub did not match your session or was not confirmed. Start again with Connect GitHub in Settings > Code.
Upload messages
- "Upload a .zip or .tar.gz file." The file name must end in
.zip,.tar.gzor.tgz. - "The file is larger than 40 MB." or "Choose a .zip or .tar.gz file of your code, up to 40 MB." Make the archive smaller, for example by leaving out installed packages and build output.
- "The code is larger than 300 MB unpacked." or "The archive has more than 30,000 files." Leave out installed packages, build output and large media.
- "The archive has no files." The archive is empty, or holds only folders and links.
- "The archive has a file outside its folder." A path in the archive starts with
/or... Pack the archive again from inside your code's folder. - "The .zip file could not be read." or "The .tar.gz file could not be read." The file is damaged or not really that type. Make it again.
Build settings messages
- "Use capital letters, digits and underscores." The Name breaks the naming rules above.
- "Use 1 to 8192 bytes." The Value is longer than 8,192 bytes.
- "This repository has reached its limit of 50." Remove a setting first.
- "Connect the repository first." Build settings need a connected GitHub repository.
Related pages
Last updated