joogy06/agent-foundry/ms-office-security-python

Claude Code and agent skill by joogy06/agent-foundry

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when hardening Python code that touches Microsoft Office files or Microsoft 365 APIs — covers the consolidated security checklist for the ms-office-python-* family, the YAML rule manifest (17 Office-specific rules), and the runnable Python validator (python3 -m ms_office_security_check). All output is advisory-only; defers generic SAST to bandit/semgrep, dependency CVEs to dep-currency-check/pip-audit, secrets to gitleaks/trufflehog, and SBOM to cyclonedx/syft. Part of the ms-office-python-* skill family.

Install

npx vskill@latest install joogy06/agent-foundry/ms-office-security-python

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as joogy06/agent-foundry/ms-office-security-python.

Microsoft Office Security — Python

Companion skill to ms-office-python (parent). For other areas see: ms-office-excel-python, ms-office-word-python, ms-office-powerpoint-python, ms-office-graph-python, ms-office-enterprise-sso-python.

This skill is the family's hardening surface. It ships THREE artifacts (Q1-A1 LOCKED):

  1. Markdown human-readable checklist — for code review walkthroughs and design docs (references/checklist.md).
  2. YAML rule manifest — machine-readable, the source of truth for what the validator detects (ms_office_security_check/rules.yaml).
  3. Runnable Python validator — python3 -m ms_office_security_check <project_root> [flags], mirroring dep-currency-check's shape.

ALL VALIDATOR OUTPUT IS ADVISORY ONLY — NOT A SECURITY GATE. The validator surfaces findings to inform code review; it does not replace bandit, pip-audit, gitleaks, or semgrep, all of which run alongside it in a healthy CI pipeline. See §3 (Defer-to-X table) for the explicit boundary list.

<HARD-RULE> Hardcoded client_secret, webhook URL, or bearer token in source code is a HALT-class finding (advisory output → CRITICAL severity → reviewer MUST resolve before merge). The validator emits these as CRITICAL with confidence: high — they are typically zero false positives. The remediation is invariably to move the value to a vault, Managed Identity, or OS credential store, NOT to bypass the validator's check with --ignore. See ms-office-enterprise-sso-python HARD-RULE 3 for the per-context replacement (Managed Identity on Azure compute, certificate-from-vault elsewhere). </HARD-RULE>

<HARD-RULE> Application Access Policy (AAP) is MANDATORY for any Graph application permission of the Mail.Send / Mail.ReadWrite / Calendars.ReadWrite / Files.ReadWrite.All / Sites.ReadWrite.All family. The validator's MSOSEC-C003 rule flags broad .ReadWrite.All / .All scope usage WITHOUT an allowlist entry in the project's [tool.ms-office-security.scopes] config — the allowlist forces a code-review conversation about whether the matching Application Access Policy is actually configured server-side. The validator cannot verify the server-side policy exists; the code-review conversation is the control. See ms-office-graph-python HARD-RULE 2 for the PowerShell pattern that creates the AAP. </HARD-RULE>

<HARD-RULE> .docm / .xlsm / .pptm ingestion paths require explicit, logged user-confirmed feature intent. Silent macro stripping (which python-docx, openpyxl, python-pptx do by default on save) is forbidden. Validator rules MSOSEC-OFFICE001 (openpyxl.load_workbook without keep_vba=False in untrusted-input contexts) and the per-skill HARD-RULEs (Word HR1, Excel guidance) backstop this with detection. The remediation is either to refuse macro-enabled files in the workflow OR to require an explicit --accept-macro-strip flag with a logged decision. </HARD-RULE>


1. Overview

The validator is narrowly scoped to Office / MSAL / Graph / Entra patterns — the things that bandit, semgrep, gitleaks, and pip-audit don't catch. It does NOT replace those tools; it complements them. Generic Python security issues, generic secret scanning, dependency CVE detection, and SBOM emission all belong elsewhere.

The validator runs entirely offline. No network calls, no live tenant validation, no token introspection. Output is JSON canonical (msosec.v1), with Markdown and SARIF as renderings.

2. The 17 v1 rules (narrowed from validator design doc's 32)

Per master design doc §8, bob ships exactly 17 rules in v1 (range 15-19 acceptable). The narrowing applies the following category-level rules: KEEP all Office-specific Auth (6 rules), KEEP Office-specific Transport (1), KEEP all Graph Scopes (3), DROP generic Secrets (defer to gitleaks / dep-currency-check), KEEP all Deprecated APIs (5), DROP Supply chain (defer to dep-currency-check / pip-audit), ADD Office documents (2).

The manifest is at ms_office_security_check/rules.yaml. Summary table — each rule has a stable ID (forever), severity, detection mechanism, and references back to the design.

rule_idcategoryseverityruledetection
MSOSEC-A001AuthCRITICALadal package imported anywhere (EOL since June 2023)AST
MSOSEC-A002AuthHIGHOn Windows-targeting code, msal imported but msal[broker] / msal-broker not in pinned requirementsmanifest
MSOSEC-A003AuthHIGHPublicClientApplication instantiated without enable_broker_on_windows=True (WAM SSO opt-in)AST
MSOSEC-A004AuthCRITICALConfidentialClientApplication instantiated with client_credential=<str-literal> (plaintext secret in source)AST
MSOSEC-A009AuthCRITICALjwt.decode(...) called with options={"verify_signature": False} or verify=FalseAST
MSOSEC-A010AuthCRITICALjwt.decode(...) called WITHOUT explicit algorithms=[...] (algorithm pinning)AST
MSOSEC-A013AuthHIGHIssuer (iss) claim not validated — jwt.decode missing issuer= kwarg; for multi-tenant, also missing tid validationAST
MSOSEC-B001TransportCRITICALOffice-specific CA bundle disabled — requests.<verb>(<graph URL>, verify=False) or httpx.<verb>(<graph URL>, verify=False)AST (URL-pattern filtered)
MSOSEC-C001Graph scopesHIGHA Graph scope literal in code that is NOT in the project's declared scope allowlist ([tool.ms-office-security.scopes])regex+config
MSOSEC-C002Graph scopesMEDIUM.default scope used in conjunction with PublicClientApplication (delegated context — .default is for client-credentials only)AST
MSOSEC-C003Graph scopesHIGHUse of any scope ending in .ReadWrite.All or .All (broad consent) without an explicit allow-rule in the config — reminds reviewer that Application Access Policy MUST be configured server-sideregex+config
MSOSEC-E001Deprecated APIsMEDIUMimport exchangelib / from exchangelib import ... in code paths that don't carry the on-prem-Exchange comment marker — EWS retiring for Exchange Online (per Microsoft's announced schedule, disabled-by-default 2026-10-01 with permanent shutdown 2027-04-01; verify before treating as hard deadline)AST
MSOSEC-E002Deprecated APIsINFO(Suppressed-by-A001 duplicate marker — kept for category alignment; documented in §2 of the validator design as deliberate dedup. The validator suppresses E002 emission when A001 fires on the same import site.)suppressed
MSOSEC-E003Deprecated APIsINFOpywin32 win32com.client.Dispatch("Outlook.Application") (COM automation) — flag as deprecated approach; refer to GraphAST
MSOSEC-E004Deprecated APIsHIGHimport requests_kerberos / from requests_kerberos import ... — legacy; superseded by requests-gssapi + pyspnegoAST
MSOSEC-E005Deprecated APIsHIGHimport pymsteams / from pymsteams import ... — targets retired O365 Connectors API; migrate to Workflows OR Graph chatMessageAST
MSOSEC-OFFICE001Office docsMEDIUMopenpyxl.load_workbook(...) without keep_vba=False for untrusted-input contexts (heuristic on file-path provenance)AST
MSOSEC-OFFICE002Office docsHIGHOOXML XML parsing path without defusedxml neutralization (heuristic — lxml.etree.parse / xml.etree.ElementTree.parse on Office file content)AST

Arithmetic: 6 Auth (A001, A002, A003, A004, A009, A010, A013 — that's 7) + 1 Transport (B001) + 3 Graph scopes (C001, C002, C003) + 5 Deprecated (E001, E002 suppressed, E003, E004, E005 — 4 active emitting) + 2 Office docs (OFFICE001, OFFICE002) = 7 + 1 + 3 + 4 + 2 = 17 rules (E002 listed but always suppressed when A001 fires — counted as 1, design §8 dedup note).

Rule-overlap check (WP-8 acceptance criterion): every retained rule covers an Office-specific or MSAL/Graph/Entra-specific pattern that bandit (B501 verify=False generic, B105 hardcoded password), semgrep (Python ruleset), gitleaks (generic secret regex), pip-audit (CVE), or dep-currency-check (currency + CVE) does not catch. The retained set is intentionally narrow.

3. Defer-to-X (what this validator does NOT do)

ConcernTool to use instead
Generic Python SAST (verify=False on non-Graph URLs, hardcoded passwords, broad exception handling, shell=True, eval/exec)bandit -r .
Custom security rule patterns (org-specific banned APIs)semgrep --config=auto .
Hardcoded secrets, API keys, AWS keys, generic high-entropy stringsgitleaks detect / trufflehog filesystem
Dependency CVEs in msal, msgraph-sdk, cryptography, lxml, pyjwt, etc.pip-audit / dep-currency-check
Stale library versions, deprecation timelines for non-Office libsdep-currency-check
SBOM emission (CycloneDX / SPDX)cyclonedx-py / syft
Live token validation against a tenantn/a (the validator is offline by design; live validation belongs in the runtime)
Generic OAuth/OIDC client misconfiguration for non-Microsoft IdPspython-auth-security skill + your IdP's tooling

4. CLI

bash
python3 -m ms_office_security_check <project_root> [flags]

Module name: ms_office_security_check (underscores). Skill directory: ms-office-security-python/. The Python package layout mirrors dep-currency-check/dep_currency_check/.

Flags (mirror dep-currency-check shape)
flagpurpose
--severity {critical,high,medium,info,all}Minimum severity to report. Default: high.
--format {json,md,sarif}Output format. Default: json (canonical). md and sarif are renderings.
--rule <id>Run only this rule (repeatable). Useful for development.
--ignore <id>Skip this rule (repeatable). Combines with project config [tool.ms-office-security.ignore].
--config <yaml>Path to project config (default: ms-office-security.yaml at root, else pyproject.toml).
--changed-files <list>Comma-separated; delta mode for pre-commit (only scan these files).
--mode {advisory,strict}Blocking criteria for exit code 1. Default: advisory.
--rules-yaml <path>Override the bundled rules YAML (for skill development + alf evolution).
--output <path>Write report to file instead of stdout.
--quietSuppress non-finding output.
--no-colorDisable ANSI in md rendering.
--versionPrint validator + schema versions and exit 0.
Exit codes (mirror dep-currency-check)
CodeMeaning
0Pass — no strict-blocking findings (advisory findings still printed)
1STRICT BLOCK — at least one CRITICAL finding AND --mode strict
2Soft finding — reportable but not blocking; or strict mode with HIGH/MEDIUM only
3Environmental error — parse failure, broken AST, missing rules YAML, malformed config
Suppression

# msosec: ignore MSOSEC-A009 at end-of-line OR on the previous line. # msosec: ignore MSOSEC-A009, MSOSEC-A010 for multiple. # msosec: ignore file at top of file suppresses ALL rules in that file. Project-level allowlist via [tool.ms-office-security.ignore] in pyproject.toml or ms-office-security.yaml.

5. Output schema (msosec.v1)

JSON canonical:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
2
7-day trend score
5

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/joogy06/agent-foundry/ms-office-security-python/badge)](https://verified-skill.com/skills/joogy06/agent-foundry/ms-office-security-python)

Something wrong with this skill or its page? Tell us.