Buckets:

AnonymousSpottedToad/securityPatternsRecovery / ground_truth /python /authentication_pwd__vnpy_vnpy_webtrader.json
download
raw
6.8 kB
{
"role_mappings": [
{
"patternRole": "Subject",
"entity": "",
"file": "",
"lines": "",
"notes": "No in-repo client posts credentials to /token: web.py:138 serves static/index.html, which is not present in the repo (static/ holds only __init__.py). ui/widget.py:75 start only saves username/password into the server config, it does not log in.",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Enforcer",
"entity": "login",
"file": "vnpy_webtrader/web.py",
"lines": "146",
"notes": "FastAPI route POST /token (decorator web.py:145) receives OAuth2PasswordRequestForm id/pwd, calls authenticate_user at web.py:148 and raises HTTP 401 on failure (web.py:149-154). Token-protected routes (get_access, web.py:109) belong to the JWT pattern, not this one.",
"status": "present",
"nodeId": null
},
{
"patternRole": "Verification manager",
"entity": "authenticate_user",
"file": "vnpy_webtrader/web.py",
"lines": "82",
"notes": "Called by Enforcer login at web.py:148. Reads the configured PASSWORD, hashes it with pwd_context.hash (web.py:84), checks the username with secrets.compare_digest (web.py:86) and the password with pwd_context.verify (web.py:89), returning the username or False.",
"status": "present",
"nodeId": null
},
{
"patternRole": "Password store",
"entity": "PASSWORD",
"file": "vnpy_webtrader/web.py",
"lines": "43",
"notes": "Read by authenticate_user at web.py:84. Module-level PASSWORD loaded from web_trader_setting.json via vnpy load_json (web.py:41); no retrieving method of its own, so the variable is cited. Caveat: single plaintext password (written by ui/widget.py:93 save_json), hashed on each login, not stored as a hash.",
"status": "present",
"nodeId": null
},
{
"patternRole": "Hasher",
"entity": "verify",
"file": "vnpy_webtrader/web.py",
"lines": "89",
"notes": "authenticate_user calls passlib CryptContext.verify at web.py:89, which hashes the received password with sha256_crypt (CryptContext configured web.py:54) using the salt of the stored hash; one call covers Hasher and Comparator. The stored side is produced by pwd_context.hash at web.py:84.",
"status": "external",
"nodeId": null
},
{
"patternRole": "Pepper store",
"entity": "",
"file": "",
"lines": "",
"notes": "No pepper on the authenticate_user path (web.py:82-92). SECRET_KEY (web.py:48) is the JWT signing key, not a pepper; the sha256_crypt salt is not a pepper.",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Encrypter",
"entity": "",
"file": "",
"lines": "",
"notes": "The password hash is not encrypted/keyed with a pepper anywhere in authenticate_user (web.py:82-92); jwt.encode in create_access_token (web.py:105) is token signing, unrelated.",
"status": "missing",
"nodeId": null
},
{
"patternRole": "Comparator",
"entity": "verify",
"file": "vnpy_webtrader/web.py",
"lines": "89",
"notes": "authenticate_user (web.py:82) calls passlib CryptContext.verify at web.py:89, which compares the recomputed sha256_crypt hash with the hash from web.py:84; same call as Hasher. Username comparison uses secrets.compare_digest at web.py:86.",
"status": "external",
"nodeId": null
},
{
"patternRole": "System",
"entity": "create_access_token",
"file": "vnpy_webtrader/web.py",
"lines": "95",
"notes": "On successful verification the Enforcer login calls create_access_token at web.py:156, which issues a JWT (jose jwt.encode, web.py:105) returned to the client at web.py:159.",
"status": "present",
"nodeId": null
}
],
"interaction_order": {
"available": true,
"language": "python",
"repo": "vnpy_vnpy_webtrader",
"reason": "",
"entryRole": "Enforcer",
"entryRule": "behaviour",
"interactions": [
{
"rank": 1,
"interaction": "Enforcer \u2192 Verification manager",
"from": "Enforcer",
"to": "Verification manager",
"file": "vnpy_webtrader/web.py",
"line": 148,
"via": [],
"mechanism": "call",
"path": [
{
"caller": "vnpy_webtrader/web.py:<module>.login",
"file": "vnpy_webtrader/web.py",
"line": 148,
"code": "authenticate_user(USERNAME, form_data.username, form_data.password)",
"callee": "vnpy_webtrader/web.py:<module>.authenticate_user",
"mechanism": "call"
}
],
"parent": ""
},
{
"rank": 2,
"interaction": "Verification manager \u2192 Hasher",
"from": "Verification manager",
"to": "Hasher",
"file": "vnpy_webtrader/web.py",
"line": 89,
"via": [],
"mechanism": "call",
"path": [
{
"caller": "vnpy_webtrader/web.py:<module>.authenticate_user",
"file": "vnpy_webtrader/web.py",
"line": 89,
"code": "pwd_context.verify(password, hashed_password)",
"callee": "passlib/context.py:<module>.CryptContext.verify",
"mechanism": "call"
}
],
"parent": "Enforcer \u2192 Verification manager"
},
{
"rank": 3,
"interaction": "Verification manager \u2192 Comparator",
"from": "Verification manager",
"to": "Comparator",
"file": "vnpy_webtrader/web.py",
"line": 89,
"via": [],
"mechanism": "call",
"path": [
{
"caller": "vnpy_webtrader/web.py:<module>.authenticate_user",
"file": "vnpy_webtrader/web.py",
"line": 89,
"code": "pwd_context.verify(password, hashed_password)",
"callee": "passlib/context.py:<module>.CryptContext.verify",
"mechanism": "call"
}
],
"parent": "Enforcer \u2192 Verification manager"
}
],
"anchoredRoles": [
{
"role": "Comparator",
"kind": "external"
},
{
"role": "Encrypter",
"kind": "external"
},
{
"role": "Enforcer",
"kind": "METHOD"
},
{
"role": "Hasher",
"kind": "external"
},
{
"role": "Password store",
"kind": "LOCAL"
},
{
"role": "Pepper store",
"kind": "external"
},
{
"role": "Verification manager",
"kind": "METHOD"
}
],
"skippedRoles": [
"Subject",
"System"
]
}
}

Xet Storage Details

Size:
6.8 kB
·
Xet hash:
f224b8800b9825558304a0ad333d3092c55ab1444123f96eba1c697c0d963428

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