Buckets:

AnonymousSpottedToad/securityPatternsRecovery / ground_truth /python /authentication_pwd__JBEI_dnada.json
download
raw
10.1 kB
{
"role_mappings": [
{
"patternRole": "Subject",
"entity": "",
"file": "",
"lines": "",
"notes": "Implicit; sends email+password via OAuth2PasswordRequestForm (POST /login/access-token) or user registration (POST /users/open)",
"status": "external",
"nodeId": null
},
{
"patternRole": "Enforcer",
"entity": "login_access_token",
"file": "backend/app/app/api/api_v1/endpoints/login.py",
"lines": "22–43",
"notes": "login_access_token() receives OAuth2PasswordRequestForm, delegates to crud.user.authenticate(), returns JWT on success; OAuth2PasswordBearer extracts bearer token for protected routes",
"status": "present",
"nodeId": null
},
{
"patternRole": "Verification manager",
"entity": "authenticate",
"file": "backend/app/app/crud/crud_user.py",
"lines": "30",
"notes": "Fetches user by email, checks password via verify_password(password, user.hashed_password); returns None on failure, User on success",
"status": "present",
"nodeId": null
},
{
"patternRole": "Comparator",
"entity": "verify",
"file": "backend/app/app/core/security.py",
"lines": "30",
"notes": "passlib CryptContext.verify() performs constant-time bcrypt comparison; returns True/False",
"status": "external",
"nodeId": null
},
{
"patternRole": "Hasher",
"entity": "verify",
"file": "backend/app/app/core/security.py",
"lines": "30",
"notes": "passlib CryptContext(schemes=['bcrypt'], deprecated='auto') generates salt and hashes in one step; default bcrypt cost factor (12 rounds)",
"status": "external",
"nodeId": null
},
{
"patternRole": "Password store",
"entity": "get_by_email",
"file": "backend/app/app/crud/crud_user.py",
"lines": "15–16",
"notes": "Persisted in PostgreSQL users table; queried via CRUDUser.get_by_email() and CRUDBase.get()",
"status": "present",
"nodeId": null
},
{
"patternRole": "Pepper store",
"entity": "",
"file": "",
"lines": "",
"notes": "Not found; no pepper/secret concatenated before hashing. SECRET_KEY is used only for JWT signing, not password hashing",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Encrypter",
"entity": "",
"file": "",
"lines": "",
"notes": "JWT HS256 for access tokens; also generate_password_reset_token() and verify_password_reset_token() in utils.py for password reset flow (JWT HS256 with email as subject)",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Hash manager",
"entity": "create",
"file": "backend/app/app/crud/crud_user.py",
"lines": "18",
"notes": "CRUDUser.create() hashes password at user creation; CRUDBase.update() generically detects 'password' in update_data and hashes before persisting to hashed_password",
"status": "missing",
"nodeId": null
},
{
"patternRole": "SRNG",
"entity": "",
"file": "",
"lines": "",
"notes": "bcrypt internally uses OS CSPRNG for salt generation; secrets.token_urlsafe(32) provides default SECRET_KEY if not overridden by env var. No explicit SRNG invocation in application code",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Password policy",
"entity": "",
"file": "",
"lines": "",
"notes": "Not found; UserCreate schema accepts password: str with no min_length, max_length, regex, or complexity constraints. No password policy enforcement anywhere in the codebase",
"status": "missing",
"nodeId": null
},
{
"patternRole": "System",
"entity": "",
"file": "",
"lines": "",
"notes": "FastAPI Depends() chain decodes JWT, looks up user by sub claim, checks is_active and is_superuser before granting access to protected resources (experiments, designs, etc.)",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Registrar",
"entity": "",
"file": "",
"lines": "",
"notes": "Superuser-gated creation via POST /users/; self-registration via POST /users/open (controlled by USERS_OPEN_REGISTRATION flag, default False); init_db() bootstraps first superuser from FIRST_SUPERUSER env vars",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Resetter",
"entity": "",
"file": "",
"lines": "",
"notes": "Email-based flow: generate JWT reset token with email as subject (48h expiry), send via email, verify token on POST /reset-password/, hash new password and persist directly. Also PUT /users/me allows self-update of password (no current-password verification required, only valid JWT needed)",
"status": "missing",
"nodeId": null
}
],
"interaction_order": {
"available": true,
"language": "python",
"repo": "JBEI_dnada",
"reason": "",
"entryRole": "Enforcer",
"entryRule": "behaviour",
"interactions": [
{
"rank": 1,
"interaction": "Enforcer → Verification manager",
"from": "Enforcer",
"to": "Verification manager",
"file": "backend/app/app/api/api_v1/endpoints/login.py",
"line": 30,
"via": [],
"mechanism": "call",
"path": [
{
"caller": "backend/app/app/api/api_v1/endpoints/login.py:<module>.login_access_token",
"file": "backend/app/app/api/api_v1/endpoints/login.py",
"line": 30,
"code": "crud.user.authenticate(db, email = form_data.username, password = form_data.password)",
"callee": "backend/app/app/crud/crud_user.py:<module>.CRUDUser.authenticate",
"mechanism": "call"
}
],
"parent": ""
},
{
"rank": 2,
"interaction": "Verification manager → Password store",
"from": "Verification manager",
"to": "Password store",
"file": "backend/app/app/crud/crud_user.py",
"line": 31,
"via": [],
"mechanism": "call",
"path": [
{
"caller": "backend/app/app/crud/crud_user.py:<module>.CRUDUser.authenticate",
"file": "backend/app/app/crud/crud_user.py",
"line": 31,
"code": "self.get_by_email(db, email = email)",
"callee": "backend/app/app/crud/crud_user.py:<module>.CRUDUser.get_by_email",
"mechanism": "call"
}
],
"parent": "Enforcer → Verification manager"
},
{
"rank": 3,
"interaction": "Verification manager → Hasher",
"from": "Verification manager",
"to": "Hasher",
"file": "backend/app/app/core/security.py",
"line": 30,
"via": [
"backend/app/app/core/security.py:<module>.verify_password"
],
"mechanism": "call",
"path": [
{
"caller": "backend/app/app/crud/crud_user.py:<module>.CRUDUser.authenticate",
"file": "backend/app/app/crud/crud_user.py",
"line": 34,
"code": "verify_password(password, user.hashed_password)",
"callee": "backend/app/app/core/security.py:<module>.verify_password",
"mechanism": "call"
},
{
"caller": "backend/app/app/core/security.py:<module>.verify_password",
"file": "backend/app/app/core/security.py",
"line": 30,
"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": "backend/app/app/core/security.py",
"line": 30,
"via": [
"backend/app/app/core/security.py:<module>.verify_password"
],
"mechanism": "call",
"path": [
{
"caller": "backend/app/app/crud/crud_user.py:<module>.CRUDUser.authenticate",
"file": "backend/app/app/crud/crud_user.py",
"line": 34,
"code": "verify_password(password, user.hashed_password)",
"callee": "backend/app/app/core/security.py:<module>.verify_password",
"mechanism": "call"
},
{
"caller": "backend/app/app/core/security.py:<module>.verify_password",
"file": "backend/app/app/core/security.py",
"line": 30,
"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": "METHOD"
},
{
"role": "Hasher",
"kind": "external"
},
{
"role": "Password policy",
"kind": "external"
},
{
"role": "Password store",
"kind": "METHOD"
},
{
"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:
b38d6ba74175512436e33410eb278d69519d511c34de4d04f69c1961d8c8fda3

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