SuperAPI AI 工具集

dd-audit-ai-activity

安全与审计

查看项目

更新于 10-15 14:23

技能介绍

用途

本技能用于审计 Datadog 组织内 Bits AI 助手(MCP 服务器)的活动。Datadog 的每次 MCP 工具调用都会记录在 Audit Trail 的 Bits AI SRE 类别下,本技能据此呈现 AI 助手在组织内做过什么:哪些用户调用、调用了哪些工具、影响了哪些资源,并提供异常标记以支持 AI 治理。

主要能力

  • 查询指定时间窗口内的全部 MCP 工具活动,输出时间戳、用户、actor 类型、动作、资源类型、资源 ID、客户端 IP 与国家。
  • 按用户统计活动量,识别使用 AI 助手最多的用户。
  • 查询被 AI 工具调用修改(created / modified / deleted)的资源。
  • 查询特定用户的 AI 活动。
  • 生成周度汇总报告,包含总工具调用数、唯一用户数、Top 用户、动作分布与资源类型分布。
  • 提供异常标记(Anomaly Flags)与治理关注点对照,例如 AI 对监控或仪表盘执行删除操作、AI 以 SUPPORT_USER 身份行动、首次调用 AI 工具的新用户、短窗口内高频工具调用、AI 访问超出用户常规范围的资源。
  • 提供输出格式模板,包含组织、日期范围、总调用数、唯一用户数、Top 用户、动作分布、受影响资源类型与异常列表。

使用方式

前置条件:

pup auth login   # OAuth2 (recommended)
# or set DD_API_KEY + DD_APP_KEY with audit_logs_read scope

查询示例(保留原始命令):

全部 MCP 工具活动:

pup audit-logs search --query "@evt.name:\"MCP Server\"" --from 7d --limit 500 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      actor_type: .attributes.attributes.evt.actor.type,
      action: .attributes.attributes.action,
      resource_type: .attributes.attributes.asset.type,
      resource_id: .attributes.attributes.asset.id,
      ip: .attributes.attributes.network.client.ip,
      country: .attributes.attributes.network.client.geoip.country.name
    }]'

按用户统计活动:

pup audit-logs search --query "@evt.name:\"MCP Server\"" --from 30d --limit 1000 -o json \
  | jq '[.data[] | .attributes.attributes.usr.email]
    | group_by(.)
    | map({user: .[0], tool_calls: length})
    | sort_by(-.tool_calls)'

被 AI 工具调用修改的资源:

pup audit-logs search \
  --query "@evt.name:\"MCP Server\" @action:(created OR modified OR deleted)" \
  --from 7d --limit 500 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      user: .attributes.attributes.usr.email,
      action: .attributes.attributes.action,
      resource_type: .attributes.attributes.asset.type,
      resource_id: .attributes.attributes.asset.id
    }]'

特定用户的 AI 活动:

pup audit-logs search \
  --query "@evt.name:\"MCP Server\" @usr.email:user@example.com" \
  --from 30d --limit 500 -o json \
  | jq '[.data[] | {
      timestamp: .attributes.timestamp,
      action: .attributes.attributes.action,
      resource_type: .attributes.attributes.asset.type,
      resource_id: .attributes.attributes.asset.id
    }]'

周度汇总报告:

pup audit-logs search --query "@evt.name:\"MCP Server\"" --from 7d --limit 1000 -o json \
  | jq '{
      total_tool_calls: (.data | length),
      unique_users: ([.data[] | .attributes.attributes.usr.email] | unique | length),
      top_users: (
        [.data[] | .attributes.attributes.usr.email]
        | group_by(.)
        | map({user: .[0], calls: length})
        | sort_by(-.calls)
        | .[:5]
      ),
      actions_breakdown: (
        [.data[] | .attributes.attributes.action]
        | group_by(.)
        | map({action: .[0], count: length})
        | sort_by(-.count)
      ),
      resource_types: (
        [.data[] | .attributes.attributes.asset.type]
        | group_by(.)
        | map({type: .[0], count: length})
        | sort_by(-.count)
      )
    }'

异常标记

信号 治理关注点
AI 对监控或仪表盘执行删除操作 审查破坏性 AI 操作是否符合预期
AI 以 SUPPORT_USER 身份行动 Datadog 支持人员代表组织使用 AI
首次调用 AI 工具的用户 新用户访问 AI 助手
短窗口内高频工具调用 自动化/批量 AI 使用
AI 访问超出用户常规范围的资源 可能存在权限过大的 AI 会话

输出格式

AI Activity Audit — [Org] — [Date Range]

Total MCP tool calls: [N]
Unique users: [N]

Top users:
  [user@example.com]: [N] calls

Actions breakdown:
  accessed: [N]
  modified: [N]
  created: [N]
  deleted: [N]

Resource types affected:
  dashboard: [N]
  monitor: [N]

Anomalies:
  [List any flagged events with timestamp, user, action, resource]

适用场景

  • 安全审查:验证 AI 操作已获授权且处于预期范围内。
  • 合规审计:证明 AI 活动已被记录并可归因到具体用户。
  • 治理报告:了解 AI 助手在组织内的采用情况与风险面。

限制

资料未提供除上述查询与异常标记之外的其他功能、收费、价格或平台支持信息。