Generic Git Integration
Overview
Section titled “Overview”The generic Git integration lets you connect any Git-compatible repository to Fencer for code scanning. Use it for Git servers that are not directly supported through a dedicated integration, including:
- Self-hosted Git servers (Gitea, Gogs, cgit, Forgejo)
- AWS CodeCommit
- Any server accessible via HTTPS or SSH clone URLs
Fencer clones the repository using the credentials you provide and runs all configured code scanners against it. Scans can be triggered manually or run on a schedule.
Prerequisites
Section titled “Prerequisites”- An active Fencer organization with a valid subscription.
- The Administrator role in your Fencer organization.
- A clone URL for your repository (HTTPS or SSH).
- Credentials to clone the repository (SSH key, access token, or username/password), unless the repository is public.
How it works
Section titled “How it works”Fencer stores the connection credentials you provide (encrypted at rest) and uses them to clone the repository when a scan is triggered. Scheduled scans clone a fresh copy of the repository at the default branch, run all enabled code scanners, and report results.
There are four authentication methods:
- None — For public repositories that require no authentication.
- SSH Key — Fencer uses your private key to clone via SSH (e.g.,
git@git.example.com:org/repo.git). Keys with passphrases are supported. Both OpenSSH and PEM formats are accepted. - Access Token — Fencer embeds the token in the HTTPS clone URL as
https://oauth2:{token}@git.example.com/org/repo.git. Works with personal access tokens, deploy tokens, and machine user tokens. - Basic Auth — Fencer embeds the username and password in the HTTPS clone URL. Use this when your server requires HTTP basic authentication.
Usage / Configuration
Section titled “Usage / Configuration”Connecting a Git Repository
Section titled “Connecting a Git Repository”- Go to Admin > Integrations.
- Under Available Integrations, click the Git (Code) card, then click Continue.
- Fill in the connection form:
- Connection Name: A display name for this connection (e.g., “Internal Git Server” or “CodeCommit”).
- Authentication Method: Choose the method that matches your server’s requirements.
- Provide the credentials for your chosen method (see below).
- Repository Clone URL: The URL used to clone the repository. For SSH, use the SSH URL
(e.g.,
git@git.example.com:org/repo.git). For HTTPS, use the HTTPS URL (e.g.,https://git.example.com/org/repo.git). - Repository Web URL: The URL where the repository can be browsed in a web interface. Fencer uses this to generate links to files when vulnerabilities are found.
- Repository Name: A display name, typically in
org/repoformat. - Default Branch: The branch Fencer scans by default (e.g.,
mainormaster).
- Click Connect. Fencer creates the connection and the repository, and triggers an initial code scan.
Authentication Methods
Section titled “Authentication Methods”SSH Key
Section titled “SSH Key”- Select SSH Key as the authentication method.
- Paste your SSH private key into the SSH Private Key field. Both OpenSSH format
(
-----BEGIN OPENSSH PRIVATE KEY-----) and PEM format (-----BEGIN RSA PRIVATE KEY-----) are accepted. - If your key is encrypted with a passphrase, enter it in the SSH Key Passphrase field.
- Use an SSH clone URL (e.g.,
git@git.example.com:org/repo.git).
Access Token
Section titled “Access Token”- Select Access Token as the authentication method.
- Paste the token into the Access Token field.
- Use an HTTPS clone URL (e.g.,
https://git.example.com/org/repo.git).
This works with:
- Gitea / Forgejo: Create a personal access token under Settings > Applications with
read:repositoryscope. - AWS CodeCommit: Use an HTTPS Git credential generated in IAM under your IAM user’s security credentials (select Basic Auth (username & password) instead of Access Token for CodeCommit).
Basic Auth
Section titled “Basic Auth”- Select Basic Auth (username & password) as the authentication method.
- Enter the Username and Password.
- Use an HTTPS clone URL.
None (Public Repositories)
Section titled “None (Public Repositories)”- Select None (Public Repository) as the authentication method.
- Use the public HTTPS clone URL.
Adding More Repositories
Section titled “Adding More Repositories”A single Git connection can hold multiple repositories that share the same credentials. To add additional repositories:
- Go to Admin > Integrations and click Edit on your Git connection.
- Click Add repositories and fill in the Repository Clone URL, Repository Web URL, Repository Name, and Default Branch.
- Click Add repository. Fencer triggers an initial scan on the new repository.
If your repositories use different credentials (e.g., different deploy keys for each repo), create a separate Git connection for each set of credentials.
Editing a Repository
Section titled “Editing a Repository”- From the Git connection edit page, find the repository under Connected repositories.
- Click Edit repository to update the clone URL, web URL, name, or default branch, then click Save.
Suspending and Resuming Scans
Section titled “Suspending and Resuming Scans”- From the Git connection edit page, find the repository.
- Click Suspend. Fencer stops scheduling scans for this repository.
- Click Resume to start scanning it again.
Removing a Repository
Section titled “Removing a Repository”- From the Git connection edit page, find the repository.
- Click Remove repository and confirm with Remove. Fencer stops scanning the repository and soft-deletes it; existing scan results are preserved.
Updating Connection Credentials
Section titled “Updating Connection Credentials”- Go to Admin > Integrations and click Edit on your Git connection.
- Update the connection name, authentication method, or credentials as needed. Leave credential fields blank to keep the existing values.
- Click Save changes.
Triggering a Manual Scan
Section titled “Triggering a Manual Scan”- Go to Posture > Code and open the repository.
- Click Run scan.
- Fencer clones the repository at the branch you are viewing (the default branch unless you picked another) and runs all enabled code scanners.
Disconnecting
Section titled “Disconnecting”- Go to Admin > Integrations and find your Git connection.
- Click Remove on the connection and confirm with Remove.
- Fencer clears stored credentials and soft-deletes all associated repositories.
Examples
Section titled “Examples”Connecting a Gitea server with an SSH key
Section titled “Connecting a Gitea server with an SSH key”- On your Gitea instance, generate a deploy key for the repository under Settings > Deploy Keys.
- In Fencer, go to Admin > Integrations, click the Git (Code) card, and click Continue.
- Set Connection Name to “Gitea - Internal”.
- Select SSH Key and paste the deploy key’s private key.
- Set Repository Clone URL to
git@gitea.example.com:myorg/myrepo.git. - Set Repository Web URL to
https://gitea.example.com/myorg/myrepo. - Set Repository Name to
myorg/myrepoand Default Branch tomain. - Click Connect. Fencer connects and starts the initial scan.
Connecting an AWS CodeCommit repository
Section titled “Connecting an AWS CodeCommit repository”- In the AWS IAM console, go to your IAM user’s Security Credentials tab.
- Under HTTPS Git credentials for AWS CodeCommit, click Generate credentials.
- Note the username and password.
- In Fencer, go to Admin > Integrations, click the Git (Code) card, and click Continue.
- Set Connection Name to “AWS CodeCommit”.
- Select Basic Auth (username & password) and enter the IAM-generated username and password.
- Set Repository Clone URL to the CodeCommit HTTPS URL (e.g.,
https://git-codecommit.us-east-1.amazonaws.com/v1/repos/my-repo). - Set Repository Web URL to the CodeCommit console URL, and fill in Repository Name and Default Branch.
- Click Connect.
Troubleshooting
Section titled “Troubleshooting”- Clone fails with “Permission denied (publickey)”: Verify the SSH private key matches a deploy
key or SSH key registered on the Git server. Ensure the clone URL uses the SSH format
(
git@host:org/repo.git), not HTTPS. - Clone fails with “SSL certificate problem”: If your Git server uses a self-signed certificate, this is not currently supported. Use SSH key authentication instead.
- Clone fails with “repository not found”: Double-check the clone URL. For SSH, ensure the path
is correct (some servers use
git@host:org/repo.git, others usegit@host:/org/repo.git). - Clone fails with “Authentication failed”: Verify the token, username/password, or SSH key is correct. Ensure the credentials have read access to the repository.
- SSH key passphrase error: Ensure the passphrase is correct. Fencer normalizes key formats internally — both OpenSSH and PEM formats are supported.