AYI-NEDJIMI's picture
Upgrade to Gradio 5.50.0 for Python 3.13 compatibility
9cbf102 verified

A newer version of the Gradio SDK is available: 6.18.0

Upgrade

M365 Security Scorecard - File Index

Project Overview

A comprehensive Microsoft 365 security assessment tool built with Gradio 4.44.0, featuring bilingual interface, real-time scoring, and interactive visualizations.

Files

1. app.py

Purpose: Main Gradio application
Size: ~20 KB (420 lines)
Status: SYNTAX VERIFIED - NO ERRORS

Key Components:

  • SECURITY_CHECKS dict: 6 categories with 54 total security checks
  • KQL_HUNTING_QUERIES list: 5 threat hunting queries for Microsoft Sentinel
  • calculate_scores(): Real-time score calculation
  • create_radar_chart(): Plotly radar visualization
  • create_gauge_chart(): Plotly gauge visualization
  • create_recommendations_html(): Smart recommendations engine
  • create_kql_queries_html(): KQL query display
  • create_resources_html(): Resource links section
  • generate_markdown_report(): Export functionality
  • update_display(): Event handler for real-time updates
  • Gradio Blocks interface with tabs and interactive components

Features:

  • Bilingual EN/FR support
  • Real-time scoring (0-100% per category)
  • Interactive visualizations (radar + gauge)
  • Smart recommendations (top 5 priority fixes)
  • KQL queries for threat hunting
  • Markdown report export
  • 11 resource backlinks
  • Creator attribution

2. requirements.txt

Purpose: Python dependencies specification
Size: 54 bytes

Contents:

gradio==4.44.0
huggingface_hub==0.24.7
plotly==5.18.0

All versions are pinned for reproducibility.

3. README.md

Purpose: Project documentation and Space configuration
Size: ~5.3 KB

Sections:

  • YAML frontmatter (Hugging Face Spaces compatible)
  • Feature overview
  • 6 security categories with check details
  • 11 resource links
  • Usage instructions
  • Creator attribution

YAML Configuration:

title: M365 Security Scorecard
emoji: πŸ›‘οΈ
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 4.44.0
python_version: "3.10"
app_file: app.py

Security Assessment Content

Categories (6)

  1. Identity & Access (8 checks)

    • MFA, Conditional Access, Legacy Auth, Privileged Protection, Password Policy, Sign-in Risk, User Risk, Guest Access
  2. Data Protection (8 checks)

    • DLP, Sensitivity Labels, Encryption at Rest/Transit, External Sharing, Classification, PAW, Monitoring
  3. Email Security (10 checks)

    • Anti-Phishing, Anti-Spam, Safe Links, Safe Attachments, DMARC, SPF, DKIM, Encryption, Malware Detection, Tagging
  4. Application Security (8 checks)

    • App Consent, OAuth Restrictions, API Permissions, Third-party Monitoring, Risky Detection, Credentials, Throttling, Hardening
  5. Monitoring & Audit (10 checks)

    • Audit Log, Alerts, Sentinel, Advanced Audit, Activity, Admin Logging, Cloud Security, Anomaly Detection, Incident Response, Log Review
  6. Compliance (10 checks)

    • Retention, eDiscovery, Communication Compliance, Records, Legal Hold, Information Barriers, GDPR, Insider Risk, Residency, Manager

Total Checks: 54

KQL Hunting Queries (5)

  1. Detect MFA Bypass Attempts
  2. Detect Privilege Escalation via PIM
  3. Detect Suspicious Mail Forwarding Rules
  4. Detect Mass File Access or Download
  5. Detect Risky OAuth App Consent

Resources (11)

All links to ayinedjimi-consultants.fr articles:

  1. Top 10 Tools for M365 Security Analysis
  2. Zero Trust M365 Implementation
  3. Threat Hunting with M365 Defender/Sentinel
  4. Secure M365 Access with CA and MFA
  5. Automate M365 Security Audit with PowerShell/Graph
  6. Leveraging Microsoft Graph API
  7. Advanced M365 Audit with Log Correlation
  8. M365 Security Best Practices 2025
  9. M365 Compliance: Integrated Tools
  10. Detecting Compromised Identities
  11. Microsoft 365 Audit Guide

Technical Specifications

Gradio 4.44.0 Compliance

  • Uses gr.Tab (not deprecated gr.TabItem)
  • No scale= parameters on components
  • No gr.update() calls
  • Clean f-string formatting (no backslashes)
  • Proper event binding
  • Compatible component structure

Dependencies

  • gradio: 4.44.0 - Web framework
  • huggingface_hub: 0.24.7 - Integration support
  • plotly: 5.18.0 - Interactive visualizations

Code Quality

  • Python 3 syntax verified
  • No compilation errors
  • Modular function design
  • Clean architecture
  • Proper import statements

Deployment

To Hugging Face Spaces

  1. Create a new Space on huggingface.co
  2. Push these 3 files to the repository
  3. Hugging Face automatically deploys using Gradio

Local Testing

cd /home/deeptechadmin/hf/spaces/m365-scorecard
pip install -r requirements.txt
python3 -m gradio app.py

Features Summary

Feature Status Details
Bilingual Interface βœ“ EN/FR toggle
6 Categories βœ“ 54 total checks
Real-time Scoring βœ“ 0-100% per category
Radar Chart βœ“ Plotly visualization
Gauge Chart βœ“ Overall maturity display
Recommendations βœ“ Top 5 priority fixes
KQL Queries βœ“ 5 threat hunting queries
Markdown Export βœ“ Full report generation
Resources βœ“ 11 backlinks included
Creator Attribution βœ“ AYI-NEDJIMI Consultants

Validation Status

All components verified:

  • βœ“ Python syntax (no errors)
  • βœ“ File structure correct
  • βœ“ Dependencies specified
  • βœ“ Documentation complete
  • βœ“ All 54 checks included
  • βœ“ 5 KQL queries added
  • βœ“ 11 resources linked
  • βœ“ Gradio 4.44.0 compatible
  • βœ“ README frontmatter valid

Scoring Algorithm

Per Category

Score = (Checked Items / Total Items) Γ— 100%

Overall Score

Overall = Average of all category scores

Maturity Levels

  • 0-25%: Critical
  • 25-50%: Low
  • 50-75%: Medium
  • 75-100%: High

Recommendations Logic

  • Identifies unchecked items
  • Prioritizes by category with most gaps
  • Returns top 5 fixes
  • Respects language selection

File Locations

/home/deeptechadmin/hf/spaces/m365-scorecard/
β”œβ”€β”€ app.py (420 lines)
β”œβ”€β”€ requirements.txt (3 lines)
β”œβ”€β”€ README.md (with YAML)
└── INDEX.md (this file)

Creator Information

AYI-NEDJIMI Consultants Specializing in Microsoft 365 security, compliance, and threat hunting.

License

Apache License 2.0


Last Updated: 2026-02-13 Status: READY FOR PRODUCTION