id: aikido-security-exception-approval
namespace: company.security
inputs:
- id: issue_group_id
type: STRING
defaults: "5004"
description: Aikido issue group the requester wants suppressed.
- id: requester
type: STRING
defaults: dev@acme.io
description: Who is asking for the exception. Recorded in the Aikido snooze
reason so the suppression is attributable.
- id: justification
type: STRING
defaults: Not exploitable in our deployment, compensating WAF rule in place.
description: Why the requester believes this finding can wait.
- id: requested_days
type: INT
defaults: 90
description: How long the exception is requested for. Policy caps this per severity.
variables:
api_base: https://app.aikido.dev
token_url: https://app.aikido.dev/api/oauth/token
max_days_high: 30
max_days_medium: 90
tasks:
- id: authenticate
type: io.kestra.plugin.core.http.Request
description: Obtain a bearer token for the Aikido public API.
uri: "{{ vars.token_url }}"
method: POST
contentType: application/json
body: '{"grant_type": "client_credentials"}'
options:
auth:
type: BASIC
username: "{{ secret('AIKIDO_CLIENT_ID') }}"
password: "{{ secret('AIKIDO_CLIENT_SECRET') }}"
timeout:
connectTimeout: PT10S
readIdleTimeout: PT30S
retry:
type: constant
interval: PT5S
maxAttempts: 3
- id: issue_detail
type: io.kestra.plugin.core.http.Request
description: Read the finding so policy is evaluated against Aikido's own data
rather than the requester's description of it.
uri: "{{ vars.api_base }}/api/public/v1/issues/{{ inputs.issue_group_id }}"
method: GET
headers:
Authorization: "Bearer {{ fromJson(outputs.authenticate.body).access_token }}"
options:
timeout:
connectTimeout: PT10S
readIdleTimeout: PT30S
- id: policy_check
type: io.kestra.plugin.core.debug.Return
description: Decide whether this finding is even eligible for an exception, and
cap the duration by severity.
format: |
{{
{
"severity": fromJson(outputs.issue_detail.body).severity ?? 'low',
"score": fromJson(outputs.issue_detail.body).severity_score ?? 0,
"reachability": fromJson(outputs.issue_detail.body).reachability_status ?? 'unknown',
"exploitability": fromJson(outputs.issue_detail.body).exploitability ?? 'no_known_exploit',
"repo": fromJson(outputs.issue_detail.body).code_repo_name ?? 'unknown',
"title": fromJson(outputs.issue_detail.body).title ?? 'unknown finding',
"eligible": (
(fromJson(outputs.issue_detail.body).exploitability ?? 'no_known_exploit') != 'actively_exploited'
and (fromJson(outputs.issue_detail.body).severity ?? 'low') != 'critical'
),
"granted_days": (
(fromJson(outputs.issue_detail.body).severity ?? 'low') == 'high'
) ? min(inputs.requested_days, vars.max_days_high) : min(inputs.requested_days, vars.max_days_medium)
} | toJson
}}
- id: eligibility
type: io.kestra.plugin.core.flow.If
description: An actively exploited or critical finding is refused before it ever
reaches a human, so nobody can approve it by accident.
condition: "{{ fromJson(outputs.policy_check.value).eligible }}"
else:
- id: auto_denied
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: |
{
"text": "Exception request auto-denied by policy",
"blocks": [
{"type": "header", "text": {"type": "plain_text", "text": "Exception denied by policy"}},
{"type": "section", "text": {"type": "mrkdwn", "text": "*Requester* {{ inputs.requester }}\n*Finding* {{ fromJson(outputs.policy_check.value).title }}\n*Repository* {{ fromJson(outputs.policy_check.value).repo }}"}},
{"type": "section", "text": {"type": "mrkdwn", "text": "Policy refuses exceptions for critical or actively exploited findings. Severity is {{ fromJson(outputs.policy_check.value).severity }} and exploitability is {{ fromJson(outputs.policy_check.value).exploitability }}. Remediate instead, or escalate to the security lead out of band."}}
]
}
then:
- id: security_review
type: io.kestra.plugin.ee.flow.HumanTask
description: Route the request to the security group. Only a member of that
group can grant the exception.
assignment:
groups:
- security-approvers
pauseDuration: P3D
behavior: FAIL
onResume:
- id: decision
type: SELECT
values:
- approve
- deny
defaults: deny
description: Grant or refuse the exception.
- id: reviewer_note
type: STRING
defaults: ""
description: Reviewer rationale, stored alongside the suppression in Aikido.
- id: apply_decision
type: io.kestra.plugin.core.flow.If
condition: "{{ (outputs.security_review.onResume is defined) and
outputs.security_review.onResume.decision == 'approve' }}"
else:
- id: notify_denied
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: |
{
"text": "Exception request for {{ fromJson(outputs.policy_check.value).title }} was denied by security review. Reviewer note: {{ outputs.security_review.onResume.reviewer_note ?? 'none given' }}. The finding stays open and on the clock."
}
then:
- id: snooze_with_audit
type: io.kestra.plugin.aikido.issues.Snooze
description: Record the exception in Aikido itself, so the justification travels
with the finding rather than living in a chat thread.
clientId: "{{ secret('AIKIDO_CLIENT_ID') }}"
clientSecret: "{{ secret('AIKIDO_CLIENT_SECRET') }}"
issueGroupId: "{{ inputs.issue_group_id }}"
until: "{{ now() | dateAdd(fromJson(outputs.policy_check.value).granted_days,
'DAYS') }}"
reason: "Exception granted via Kestra execution {{ execution.id }}. Requested by
{{ inputs.requester }}: {{ inputs.justification }} Reviewer note:
{{ outputs.security_review.onResume.reviewer_note ?? 'none given'
}} Granted for {{
fromJson(outputs.policy_check.value).granted_days }} days
(requested {{ inputs.requested_days }})."
- id: schedule_recheck
type: io.kestra.plugin.core.flow.Subflow
description: Hand the expiry to a follow-up flow so the exception is revisited
on purpose instead of silently lapsing.
namespace: company.security
flowId: aikido-reachability-gated-triage
wait: false
inputs:
issue_group_id: "{{ inputs.issue_group_id }}"
labels:
exception_expiry: "{{ now() |
dateAdd(fromJson(outputs.policy_check.value).granted_days,
'DAYS') | date('yyyy-MM-dd') }}"
granted_to: "{{ inputs.requester }}"
- id: notify_granted
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: |
{
"text": "Security exception granted",
"blocks": [
{"type": "header", "text": {"type": "plain_text", "text": "Exception granted"}},
{"type": "section", "fields": [
{"type": "mrkdwn", "text": "*Finding*\n{{ fromJson(outputs.policy_check.value).title }}"},
{"type": "mrkdwn", "text": "*Repository*\n{{ fromJson(outputs.policy_check.value).repo }}"},
{"type": "mrkdwn", "text": "*Requested by*\n{{ inputs.requester }}"},
{"type": "mrkdwn", "text": "*Granted for*\n{{ fromJson(outputs.policy_check.value).granted_days }} days of {{ inputs.requested_days }} requested"}
]},
{"type": "section", "text": {"type": "mrkdwn", "text": "{{ outputs.snooze_with_audit.snoozedSingleIssuesAmount }} individual issues suppressed. Expiry recorded as an execution label so the recheck is auditable."}}
]
}
triggers:
- id: exception_requested
type: io.kestra.plugin.core.trigger.Webhook
description: A developer portal, a Slack shortcut, or a Backstage action posts
the exception request here.
key: "{{ secret('EXCEPTION_WEBHOOK_KEY') }}"
errors:
- id: request_failed
type: io.kestra.plugin.slack.notifications.SlackIncomingWebhook
url: "{{ secret('SLACK_WEBHOOK') }}"
payload: |
{
"text": ":warning: Exception request from {{ inputs.requester }} for issue group {{ inputs.issue_group_id }} could not be processed. The finding was NOT suppressed and remains open. Execution {{ execution.id }}."
}
outputs:
- id: granted_days
type: INT
value: "{{ fromJson(outputs.policy_check.value).granted_days }}"
- id: eligible
type: BOOL
value: "{{ fromJson(outputs.policy_check.value).eligible }}"