Code Security Integration with Jira
You can use Spectral to scan the content of Jira issues, including summaries, descriptions, comments, and attachments. The integration uses a Lambda function in AWS Amazon® Web Services. Public cloud platform that offers global compute, storage, database, application and other cloud services. and a webhook in Jira.
Integration Environment Variables
Variable |
Required |
Description |
---|---|---|
|
Yes |
Your Spectral DSN retrieved from SpectralOps |
|
Yes |
A token used to identify the sender, should be identical to the webhook token sent in the webhook_token param to the webhook endpoint |
|
No |
The email matching the Jira API token. If this is not provided, attachments will not be scanned |
|
No |
Tags list to run Spectral with, separated by commas (eg base,iac,audit). Default is 'base' |
|
No |
In case of active remediation - a custom message to replace findings |
|
No |
How to handle findings (Valid values: "Not active" / "Redact finding") |
|
No |
A Jira api token to scan attachments as well. If this is not provided, attachments will not be scanned |
|
No |
A comma delimited list of project keys that you want to exclude from being scanned |
|
No |
A comma delimited list of project keys that you want to scan. No other projects except these will be scanned |
Configuration
Prerequisite
The Lambda function requires these permissions in AWS:
cloudformation:DescribeStacks
iam:CreateRole
iam:DeleteRole
apigateway:POST
logs:CreateLogGroup
iam:PutRolePolicy
To integrate Spectral with Jira:
-
Use one of these methods to deploy the Lambda function:
-
Copy the function gateway API URL.
-
In your Jira instance, add a new webhook in System Settings > Webhooks to send events. For example:
https://YOUR_ORG_NAME.atlassian.net/plugins/servlet/webhooks
-
Mark these events for the webhook to send:
-
issue->create+update
-
comment->create+update
-
attachment-> create
-
-
Copy the Lambda URL from AWS and use it as the webook URL. Make sure to copy the full URL and a query string parameter for the webhook secret you entered when you installed the Lambda function. For example:
https://random1.execute-api.us-east-1.amazonaws.com/prod/api/jira_event?webhook_token=[YOUR WEBHOOK SECRET]
-
To test the integration, open a Jira issue with a fake secret (for example:
AKIA4HK52OLF2AAN9KWV
).