Buckets:

AnonymousSpottedToad/securityPatternsRecovery / ground_truth /python /authentication_pwd__Clinical-Genomics_statina.json
download
raw
10.1 kB
{
"role_mappings": [
{
"patternRole": "Subject",
"entity": "",
"file": "",
"lines": "",
"notes": "Implicit; sends username+password via OAuth2PasswordRequestForm to POST /v2/token, or registration form to POST /v2/user/register",
"status": "external",
"nodeId": null
},
{
"patternRole": "Enforcer",
"entity": "login_for_access_token",
"file": "statina/API/v2/endpoints/user.py",
"lines": "85–104",
"notes": "OAuth2PasswordBearer extracts bearer token; get_current_user() decodes JWT, fetches user from DB, and checks security scopes before granting access",
"status": "present",
"nodeId": null
},
{
"patternRole": "Verification manager",
"entity": "authenticate_user",
"file": "statina/API/external/api/deps.py",
"lines": "26",
"notes": "Fetches user via crud.find.users.user(), then delegates to passlib bcrypt verify_password(plain, hashed). Called by login_for_access_token()",
"status": "present",
"nodeId": null
},
{
"patternRole": "Comparator",
"entity": "verify",
"file": "statina/API/external/api/deps.py",
"lines": "19",
"notes": "passlib CryptContext(schemes=['bcrypt']) provides constant-time comparison internally",
"status": "external",
"nodeId": null
},
{
"patternRole": "Hasher",
"entity": "verify",
"file": "statina/API/external/api/deps.py",
"lines": "19",
"notes": "passlib CryptContext with bcrypt scheme; salt generation is implicit in passlib",
"status": "external",
"nodeId": null
},
{
"patternRole": "Password store",
"entity": "",
"file": "statina/API/external/api/deps.py",
"lines": "28",
"notes": "User model has hashed_password: str persisted in MongoDB user collection via insert_user() and find_one()",
"status": "present",
"nodeId": null
},
{
"patternRole": "Pepper store",
"entity": "",
"file": "",
"lines": "",
"notes": "Not found; no pepper or application-level secret is concatenated with the password before hashing",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Encrypter",
"entity": "verify",
"file": "statina/API/external/api/deps.py",
"lines": "19",
"notes": "Creates JWT access tokens with sub, scopes, and exp claims; signed with settings.secret_key using configurable algorithm",
"status": "external",
"nodeId": null
},
{
"patternRole": "Hash manager",
"entity": "",
"file": "",
"lines": "",
"notes": "No dedicated hash manager class; registration endpoint directly calls get_password_hash(password) and passes result into User() constructor before DB insert",
"status": "missing",
"nodeId": null
},
{
"patternRole": "SRNG",
"entity": "",
"file": "",
"lines": "",
"notes": "secrets.token_urlsafe(64) generates cryptographic email verification tokens; passlib bcrypt internally uses OS CSPRNG for salt; secrets.compare_digest for constant-time password confirmation check",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Password policy",
"entity": "",
"file": "",
"lines": "",
"notes": "Not found; no password length, complexity, or dictionary checks. Only validation is password == password_repeated via secrets.compare_digest",
"status": "missing",
"nodeId": null
},
{
"patternRole": "System",
"entity": "",
"file": "statina/API/v2/endpoints/user.py",
"lines": "92–104",
"notes": "FastAPI Security() dependency chain validates JWT, fetches user, checks scopes hierarchy (admin > RW > R > inactive > unconfirmed) before allowing access to protected endpoints",
"status": "present",
"nodeId": null
},
{
"patternRole": "Registrar",
"entity": "",
"file": "",
"lines": "",
"notes": "Self-registration: checks username/email uniqueness, validates password match, hashes password, creates User with role='unconfirmed', inserts to DB, sends email verification link with verification_hex token",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Resetter",
"entity": "",
"file": "",
"lines": "",
"notes": "Not found; no password reset or password change endpoint exists in the codebase",
"status": "missing",
"nodeId": null
}
],
"interaction_order": {
"available": true,
"language": "python",
"repo": "Clinical-Genomics_statina",
"reason": "",
"entryRole": "Enforcer",
"entryRule": "behaviour",
"interactions": [
{
"rank": 1,
"interaction": "Enforcer → Verification manager",
"from": "Enforcer",
"to": "Verification manager",
"file": "statina/API/v2/endpoints/user.py",
"line": 89,
"via": [],
"mechanism": "call",
"path": [
{
"caller": "statina/API/v2/endpoints/user.py:<module>.login_for_access_token",
"file": "statina/API/v2/endpoints/user.py",
"line": 89,
"code": "authenticate_user(form_data.username, form_data.password)",
"callee": "statina/API/external/api/deps.py:<module>.authenticate_user",
"mechanism": "call"
}
],
"parent": ""
},
{
"rank": 2,
"interaction": "Verification manager → Hasher",
"from": "Verification manager",
"to": "Hasher",
"file": "statina/API/external/api/deps.py",
"line": 19,
"via": [
"statina/API/external/api/deps.py:<module>.verify_password"
],
"mechanism": "call",
"path": [
{
"caller": "statina/API/external/api/deps.py:<module>.authenticate_user",
"file": "statina/API/external/api/deps.py",
"line": 30,
"code": "verify_password(password, user.hashed_password)",
"callee": "statina/API/external/api/deps.py:<module>.verify_password",
"mechanism": "call"
},
{
"caller": "statina/API/external/api/deps.py:<module>.verify_password",
"file": "statina/API/external/api/deps.py",
"line": 19,
"code": "pwd_context.verify(plain_password, hashed_password)",
"callee": "passlib/context.py:<module>.CryptContext.verify",
"mechanism": "call"
}
],
"parent": "Enforcer → Verification manager"
},
{
"rank": 3,
"interaction": "Verification manager → Encrypter",
"from": "Verification manager",
"to": "Encrypter",
"file": "statina/API/external/api/deps.py",
"line": 19,
"via": [
"statina/API/external/api/deps.py:<module>.verify_password"
],
"mechanism": "call",
"path": [
{
"caller": "statina/API/external/api/deps.py:<module>.authenticate_user",
"file": "statina/API/external/api/deps.py",
"line": 30,
"code": "verify_password(password, user.hashed_password)",
"callee": "statina/API/external/api/deps.py:<module>.verify_password",
"mechanism": "call"
},
{
"caller": "statina/API/external/api/deps.py:<module>.verify_password",
"file": "statina/API/external/api/deps.py",
"line": 19,
"code": "pwd_context.verify(plain_password, hashed_password)",
"callee": "passlib/context.py:<module>.CryptContext.verify",
"mechanism": "call"
}
],
"parent": "Enforcer → Verification manager"
},
{
"rank": 4,
"interaction": "Verification manager → Comparator",
"from": "Verification manager",
"to": "Comparator",
"file": "statina/API/external/api/deps.py",
"line": 19,
"via": [
"statina/API/external/api/deps.py:<module>.verify_password"
],
"mechanism": "call",
"path": [
{
"caller": "statina/API/external/api/deps.py:<module>.authenticate_user",
"file": "statina/API/external/api/deps.py",
"line": 30,
"code": "verify_password(password, user.hashed_password)",
"callee": "statina/API/external/api/deps.py:<module>.verify_password",
"mechanism": "call"
},
{
"caller": "statina/API/external/api/deps.py:<module>.verify_password",
"file": "statina/API/external/api/deps.py",
"line": 19,
"code": "pwd_context.verify(plain_password, hashed_password)",
"callee": "passlib/context.py:<module>.CryptContext.verify",
"mechanism": "call"
}
],
"parent": "Enforcer → Verification manager"
}
],
"anchoredRoles": [
{
"role": "Comparator",
"kind": "external"
},
{
"role": "Encrypter",
"kind": "external"
},
{
"role": "Enforcer",
"kind": "METHOD"
},
{
"role": "Hash manager",
"kind": "external"
},
{
"role": "Hasher",
"kind": "external"
},
{
"role": "Password policy",
"kind": "external"
},
{
"role": "Password store",
"kind": "external"
},
{
"role": "Pepper store",
"kind": "external"
},
{
"role": "Registrar",
"kind": "external"
},
{
"role": "Resetter",
"kind": "external"
},
{
"role": "SRNG",
"kind": "external"
},
{
"role": "Verification manager",
"kind": "METHOD"
}
],
"skippedRoles": [
"Subject",
"System"
]
}
}

Xet Storage Details

Size:
10.1 kB
·
Xet hash:
4cbe740df1fce616bf5ee6d2c040d46bc49e87e758f99cf9b181f6e206757a36

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.