{
  "id": "m365-live-sensitivity-label-apply-guard-agent",
  "name": "M365 Live Sensitivity Label Apply Guard",
  "type": "agent",
  "provider": "microsoft",
  "harnesses": [
    "codex",
    "copilot",
    "claude-code",
    "cursor",
    "gemini",
    "kiro"
  ],
  "summary": "Mutating-runtime live-guard for applying ONE Microsoft Purview sensitivity label to ONE specified driveItem via the Microsoft Graph assignSensitivityLabel action. One item, one label. Requires explicit written human approval token referencing exact item, proposed label, and blast-radius. PREFLIGHT reads current label before any write. Fully reversible — prior label captured; re-apply prior label is the rollback. Gate-only; never auto-dispatched. Phase B mutating-runtime.",
  "source_type": "original",
  "official_docs": [
    "https://learn.microsoft.com/graph/api/driveitem-assignsensitivitylabel?view=graph-rest-1.0",
    "https://learn.microsoft.com/graph/permissions-reference",
    "https://learn.microsoft.com/microsoft-365/compliance/sensitivity-labels",
    "https://learn.microsoft.com/graph/metered-api-overview",
    "https://learn.microsoft.com/entra/identity-platform/app-only-access-primer"
  ],
  "security_notes": "Mutating-runtime Phase B. Uses the documented least-privileged APPLICATION permission for driveItem assignSensitivityLabel: Files.ReadWrite.All + InformationProtectionPolicy.Read.All (Graph exposes no per-item or Sites.Selected application scope for this protected/metered API; Files.ReadWrite without .All is delegated-only). Sites.ReadWrite.All (higher-privileged alternative), Sites.FullControl.All, Directory.ReadWrite.All, InformationProtectionPolicy.ReadWrite.All, and bulk labeling are explicitly denied. Because the permission floor is coarse, blast radius is constrained outside Graph (app-only access policy / RSC or a Sites.Selected site-level grant) plus the one-item written-approval gate. Requires written human approval token referencing exact item + label + blast-radius. PREFLIGHT current-label capture required before any write. Prior label retained for ROLLBACK re-apply. Output signed with idempotency key and audit-logged.",
  "last_verified": "2026-06-17",
  "path": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent",
  "author": "github: VincentChuWaiChow",
  "version": "0.1.0",
  "execution_tier": "mutating-runtime",
  "oauth_scopes": [
    "InformationProtectionPolicy.Read.All",
    "Files.ReadWrite.All (documented least-privileged APPLICATION permission for driveItem assignSensitivityLabel; Graph exposes no per-item application scope for this protected/metered API)"
  ],
  "run_as_permissions": {
    "required": [
      "InformationProtectionPolicy.Read.All — to read available sensitivity labels and verify the proposed label ID (application permission, admin-consented)",
      "Files.ReadWrite.All — the least-privileged APPLICATION permission documented for driveItem: assignSensitivityLabel (higher-privileged alternative is Sites.ReadWrite.All; neither Files.ReadWrite without .All nor Sites.Selected is a supported application permission for this API)",
      "Application permission, admin-consented — no delegated/user-context for background agent operations"
    ],
    "compensating_controls": [
      "No per-item application scope exists for this API; constrain the app's reach outside the Graph grant (app-only access policy / RSC, or a Sites.Selected site-level grant where supported) plus this guard's one-item written-approval gate and PREFLIGHT diff"
    ],
    "denied": [
      "Directory.ReadWrite.All",
      "Sites.FullControl.All",
      "Sites.ReadWrite.All (higher-privileged alternative — Files.ReadWrite.All is the narrower documented permission for this API)",
      "InformationProtectionPolicy.ReadWrite.All (label policy management — not permitted)",
      "LabelPolicyManagement (any scope)",
      "RoleManagement.ReadWrite.Directory",
      "User.ReadWrite.All",
      "Bulk labeling (any operation targeting more than one item)",
      "Label policy changes (any write to label policy resources)",
      "Removing protection that would downgrade classification without explicit approval token"
    ]
  },
  "requires_credentials": ["GRAPH_CLIENT_ID", "GRAPH_TENANT_ID"],
  "required_egress": ["graph.microsoft.com", "login.microsoftonline.com"],
  "companion_skills": ["m365-live-sensitivity-label-apply-guard"],
  "harness_variants": {
    "codex": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent/harnesses/codex.toml",
    "claude-code": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent/harnesses/claude-code.agent.md",
    "copilot": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent/harnesses/copilot.agent.md",
    "cursor": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent/harnesses/cursor.agent.md",
    "gemini": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent/harnesses/gemini.agent.md",
    "kiro-ide": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent/harnesses/kiro-ide.agent.md",
    "kiro-cli": "agents/microsoft/m365-live-sensitivity-label-apply-guard-agent/harnesses/kiro-cli.agent.json"
  }
}
