Chuyển đến nội dung
Skillpedia
Bảo mật35k · #7710

building-role-mining-for-rbac-optimization

Skill này làm gì

Công cụ này phân tích cách mọi người sử dụng quyền truy cập trong hệ thống. Nó tìm các nhóm quyền có thể gộp thành “vai trò” (role) để đơn giản hóa kiểm soát truy cập và đảm bảo mỗi người chỉ có quyền họ thật sự cần.

Khi nào nên dùng

  • ✓Khi có quá nhiều vai trò truy cập và chúng chồng chéo nhau.
  • ✓Khi thiết lập hệ thống kiểm soát truy cập mới.
  • ✓Để xem xét và cải thiện bảo mật hiện có.

Liên kết skill

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/building-role-mining-for-rbac-optimization/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/building-role-mining-for-rbac-optimization/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Phân tích các quyền truy cập hiện tại của chúng tôi và đề xuất các vai trò truy cập đơn giản hơn.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ xem xét các quyền nào được dùng cùng nhau bởi các nhóm người. Nó dùng phương pháp phân cụm (clustering) và phân tích toán học để tìm mẫu và tạo ra các vai trò truy cập hiệu quả, an toàn hơn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Building Role Mining for RBAC Optimization

Overview

Role mining is the process of analyzing existing user-permission assignments to discover optimal roles for a Role-Based Access Control (RBAC) system. Organizations accumulate excessive permissions over time through job changes, project assignments, and ad-hoc access grants, leading to "role explosion" where thousands of granular roles exist with significant overlap. Role mining uses data analysis -- including clustering algorithms, formal concept analysis, and graph-based methods -- to consolidate permissions into a minimal set of roles that accurately represent business functions while enforcing least privilege.

When to Use

  • When deploying or configuring building role mining for rbac optimization capabilities in your environment
  • When establishing security controls aligned to compliance requirements
  • When building or improving security architecture for this domain
  • When conducting security assessments that require this implementation

Prerequisites

  • Export of current user-permission assignments (CSV/database)
  • Identity governance platform or directory service access
  • Python 3.9+ with pandas, scikit-learn, numpy
  • Understanding of organizational structure and job functions
  • Stakeholder access for role validation workshops

Core Concepts

Role Mining Approaches

Approach Description Best For
Bottom-Up Analyze existing permissions to discover common patterns Large datasets with organic permission growth
Top-Down Design roles from business requirements and job descriptions Greenfield RBAC or organizational restructuring
Hybrid Combine bottom-up analysis with top-down business validation Most production environments

Role Mining Algorithms

1. Permission Clustering: Group users with similar permission sets using k-means or hierarchical clustering. Users in the same cluster share a common role.

2. Formal Concept Analysis (FCA): Mathematical framework that identifies complete set of concepts (user groups sharing exact permission sets) from a binary user-permission matrix.

3. Graph-Based Mining: Model users and permissions as a bipartite graph, then find dense subgraphs representing candidate roles.

4. Boolean Matrix Decomposition: Decompose the user-permission matrix U into U ≈ R × P where R maps users to roles and P maps roles to permissions.

Role Mining Metrics

Metric Formula Target
Role Count Total distinct roles after mining Minimize
Coverage Permissions explained by mined roles / Total permissions > 95%
Weighted Structural Complexity (WSC) Sum of role-user + role-permission assignments Minimize
Deviation Extra permissions not covered by assigned roles < 5%

Workflow

Step 1: Extract User-Permission Data

Collect the current access state from all identity sources:

import pandas as pd
import numpy as np

# Load user-permission assignments
# Format: user_id, permission_id (one row per assignment)
assignments = pd.read_csv("user_permissions.csv")

# Create binary user-permission matrix (UPA matrix)
upa_matrix = assignments.pivot_table(
    index="user_id",
    columns="permission_id",
    aggfunc="size",
    fill_value=0
)
upa_matrix = (upa_matrix > 0).astype(int)

print(f"Users: {upa_matrix.shape[0]}")
print(f"Permissions: {upa_matrix.shape[1]}")
print(f"Assignments: {assignments.shape[0]}")
print(f"Density: {upa_matrix.values.sum() / upa_matrix.size:.2%}")

Step 2: Bottom-Up Role Discovery Using Clustering

from sklearn.cluster import AgglomerativeClustering
from sklearn.metrics import silhouette_score

def find_optimal_clusters(matrix, max_k=50):
    """Find optimal number of roles using silhouette analysis."""
    scores = []
    for k in range(2, min(max_k, matrix.shape[0])):
        clustering = AgglomerativeClustering(
            n_clusters=k, metric="jaccard", linkage="average"
        )
        labels = clustering.fit_predict(matrix)
        score = silhouette_score(matrix, labels, metric="jaccard")
        scores.append((k, score))

    optimal_k = max(scores, key=lambda x: x[1])[0]
    return optimal_k, scores

def mine_roles_clustering(upa_matrix, n_clusters):
    """Mine roles using hierarchical clustering on Jaccard distance."""
    clustering = AgglomerativeClustering(

…
Câu hỏi thường gặp

“Role explosion” là gì?

Đây là khi số lượng vai trò truy cập trở nên quá lớn và khó hiểu, với nhiều vai trò giống nhau hoặc thừa.

“Least privilege” là gì?

Đây là nguyên tắc bảo mật đảm bảo mỗi người dùng chỉ có những quyền tối thiểu cần để làm việc, không hơn.

Cần dữ liệu gì?

Bạn cần danh sách cho biết người dùng nào có quyền nào trong hệ thống hiện tại.

Chi tiết

Mô tả gốc của tác giả

Apply bottom-up and top-down role mining techniques, including clustering algorithms and formal concept analysis, to discover optimal RBAC roles from existing user-permission assignments, consolidating overlapping roles and enforcing least privilege. Use when an identity program needs to reduce role explosion or redesign its RBAC role set from access data.

repo: mukul975/Anthropic-Cybersecurity-Skills

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#7710
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự