M365 live sensitivity label apply guard

From VincentChuWaiChow/vanguard-frontier-agentic · View interactive version

M365 live sensitivity label apply guard is an AI agent skill from the GitHub repository VincentChuWaiChow/vanguard-frontier-agentic. Mutating-runtime live-guard for applying ONE Microsoft Purview sensitivity label to ONE specified item (file/driveItem) via the Microsoft Graph assignSensitivityLabel action. Strictly scoped — one item, one label application. Requires explicit written human approval token referencing the exact item,

How to use this skill

Skill file

M365 Live Sensitivity Label Apply Guard

Purpose

Act as the live mutating-runtime Microsoft Purview sensitivity label application guard. On receipt of an explicit written human approval token, authenticate via Microsoft Graph application permissions, capture the current sensitivity label of the target item (PREFLIGHT), and call assignSensitivityLabel to apply the ONE approved label to the ONE identified driveItem. Emit a signed, idempotency-keyed attestation and update the audit log. Reverse path is always available — re-apply the prior label.

When to use

Gate-only classification

This skill id contains -live- and ends in -guard. The maestro MUST NOT auto-dispatch this skill. Invocation requires:

  1. An explicit written human approval token that references:
  1. Completion of PREFLIGHT (GET current label, confirm item exists, confirm scope)
  2. Prior-label capture before any write

Strict-control contract

Critical permission note

The Graph assignSensitivityLabel API for driveItem is a metered, protected API that requires:

Per the official permissions table, the least-privileged application permission for this API is Files.ReadWrite.All (the higher-privileged alternative is Sites.ReadWrite.All). Graph does not expose a per-item or Sites.Selected application permission for this specific protected API, and Files.ReadWrite (without .All) is delegated-only. Because the permission floor is unavoidably coarse, the blast radius is constrained outside the Graph grant: via an app-only access policy / RSC, or a Sites.Selected site-level grant where the tenant supports it, combined with this guard's one-item written-approval gate, PREFLIGHT diff, and idempotency-keyed attestation. Sites.ReadWrite.All, Sites.FullControl.All, and Directory.ReadWrite.All remain explicitly denied.

Credential posture

PREFLIGHT (dry-run) requirements

Before issuing the assignSensitivityLabel action:

  1. Authenticate and confirm the application user identity and consented permissions.
  2. Perform a GET on the target driveItem to retrieve the CURRENT sensitivity label:

```http

GET https://graph.microsoft.com/v1.0/drives/{driveId}/items/{itemId}?$select=id,name,sensitivityLabel

Authorization: Bearer <token>

```

  1. Confirm the item exists (200 OK). If 404, stop — the item does not exist.
  2. Emit the current label (id, display name, assignment method) vs the proposed label.
  3. If the proposed label would lower the classification tier, flag this explicitly and confirm justification text is present in the approval token.
  4. Present the current vs proposed label to the approver for final confirmation before writing.

Write operation

POST https://graph.microsoft.com/v1.0/drives/{driveId}/items/{itemId}/assignSensitivityLabel
Authorization: Bearer <token>
Content-Type: application/json

{
  "sensitivityLabelId": "<approved-label-id>",
  "assignmentMethod": "standard",
  "justificationText": "<justification from approval token>"
}

Note: assignSensitivityLabel is an async action on the Graph API. The response is a long-running operation. Poll the operation status URL until completion before recording the attestation result.

Rollback path

Output attestation

Every completed run must emit:

Lean operating rules

Refuse conditions

Immediately refuse and do not proceed if:

Official sources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.