Integrate with Semgrep
Support level: Community
What is Semgrep?
Semgrep AppSec Platform helps teams find, triage, and manage code, dependency, and secrets findings across repositories and developer workflows.
Preparation
The following placeholders are used in this guide:
authentik.companyis the FQDN of the authentik installation.some.companyis the email domain used by users who sign in to Semgrep.
This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application.
authentik configuration
To support the integration of Semgrep with authentik, you need to create several property mappings and an application/provider pair in authentik.
Create property mappings
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Customization > Property Mappings and click Create. Create the following SAML Provider Property Mappings:
- ID Mapping:
- Name:
semgrep-id - SAML Attribute Name:
id - Expression:
return request.user.email
- Name:
- Email Mapping:
- Name:
semgrep-email - SAML Attribute Name:
email - Expression:
return request.user.email
- Name:
- Name Mapping:
- Name:
semgrep-name - SAML Attribute Name:
name - Expression:
return request.user.name
- Name:
- First Name Mapping:
- Name:
semgrep-first-name - SAML Attribute Name:
firstName - Expression:
return request.user.name.split(" ", 1)[0] if request.user.name else request.user.username
- Name:
- Last Name Mapping:
- Name:
semgrep-last-name - SAML Attribute Name:
lastName - Expression:
return request.user.name.rsplit(" ", 1)[-1] if " " in request.user.name else ""
- Name:
- ID Mapping:
Create an application and provider in authentik
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Applications > Applications and click New Application to open the application wizard.
- Application: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings.
- Choose a Provider type: select SAML Provider as the provider type.
- Configure the Provider: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations:
- Set the ACS URL to
https://temp.temp. - Set the Audience to
https://temp.temp. - Under Advanced protocol settings:
- Select an available Signing Certificate.
- Add the five Property mappings that you created in the previous section.
- Set NameID Property Mapping to
semgrep-email.
- Set the ACS URL to
- Configure Bindings (optional): you can create a binding (policy, group, or user) to manage the listing and access to applications on a user's Application Dashboard page.
- Click Create Application to save the new application and provider.
Semgrep configuration
- Log in to Semgrep AppSec Platform as an administrator.
- Navigate to Settings > Access > Login methods.
- In the Single sign-on (SSO) section, set Email domain to
some.companyand click Initialize. - In the Configure Single Sign-On dialog, select Custom SAML.
- When Semgrep shows the service provider values, copy the following values and keep this window open:
- SSO URL
- Audience URL (SP Entity ID)
Configure the remaining information in authentik
- Log in to authentik as an administrator and open the authentik Admin interface.
- Navigate to Applications > Providers and click the provider that you created in the previous step.
- Click Edit.
- Under Protocol settings, set the value of the ACS URL to the SSO URL value from Semgrep. Then, set the value of the Audience to the Audience URL (SP Entity ID) value from Semgrep.
- Click Update.
Enable SSO in Semgrep
- In Semgrep AppSec Platform, continue through the Configure Single Sign-On dialog.
- When prompted for authentik's identity provider details, enter the following values:
- IdP SSO URL:
https://authentik.company/application/saml/<application_slug>/ - IdP Issuer ID:
https://authentik.company/application/saml/<application_slug>/metadata/ - Upload/paste certificate: from the authentik SAML provider page, under Related objects > Download signing certificate, click Download and upload the downloaded certificate.
- IdP SSO URL:
- Follow Semgrep's prompts to test the SAML sign-in flow.
- After the test succeeds, close the test page, confirm the connection details, and finish the setup.
- Confirm that the connection status is active under Settings > Access > Login methods.
Configuration verification
To confirm that authentik is properly configured with Semgrep, log out of Semgrep and open the Semgrep login page in a private or incognito browser window. Start the SSO sign-in flow, enter an email address for the domain you configured, and confirm that you are redirected to authentik for authentication and then back to Semgrep.