Files
shared/contract/auth-contract.json
T

325 lines
8.2 KiB
JSON
Raw Normal View History

{
"description": "Fixtures that the Go, Node and Python auth helpers must agree on. Each runtime's test suite loads this file and checks its own column; a value that differs between runtimes is a known divergence (Q-008) and is written down here rather than hidden. Change a value only together with the code that changes the behaviour.",
"password": {
"plaintext": "correct horse battery staple",
"wrongPassword": "not the right password",
"hashes": [
{
"name": "Node, current pbkdf2-sha256 scheme",
"hash": "pbkdf2-sha256$600000$76add00c36dafceac62928d01f706c20$f50eec2591755f169bd151369e41a4e6918c6a2816d19516cc38763bfa63c0ca",
"verifies": {
"go": false,
"node": true,
"python": false
},
"needsUpgrade": {
"node": false
}
},
{
"name": "Node, legacy salt:hex at 100000 iterations",
"hash": "0123456789abcdef0123456789abcdef:69a26fc4b1624cd29ecc2b2444aa876251575c65deb4af9effbd9eadbd4195c6",
"verifies": {
"go": false,
"node": true,
"python": false
},
"needsUpgrade": {
"node": true
}
},
{
"name": "Go and Python, bcrypt scheme prefix, cost 4",
"hash": "bcrypt$$2b$04$swZK.9qxywaA8ezhm5aomuRTjsKm844M.p2KuaXqqp1jaK9.bnaa2",
"verifies": {
"go": true,
"node": false,
"python": true
},
"needsUpgrade": {
"go": true,
"python": true
}
},
{
"name": "Go and Python, unprefixed legacy bcrypt, cost 4",
"hash": "$2b$04$swZK.9qxywaA8ezhm5aomuRTjsKm844M.p2KuaXqqp1jaK9.bnaa2",
"verifies": {
"go": true,
"node": false,
"python": true
},
"needsUpgrade": {
"go": true,
"python": true
}
},
{
"name": "unknown scheme",
"hash": "argon2id$v=19$m=65536,t=3,p=4$c29tZXNhbHQ$YWJj",
"verifies": {
"go": false,
"node": false,
"python": false
}
},
{
"name": "plain text stored as a hash",
"hash": "correct horse battery staple",
"verifies": {
"go": false,
"node": false,
"python": false
}
},
{
"name": "empty hash",
"hash": "",
"verifies": {
"go": false,
"node": false,
"python": false
}
}
],
"tooLongToHash": {
"bytes": 73,
"accepted": {
"go": false,
"node": true,
"python": false
},
"note": "bcrypt reads only the first 72 bytes, so Go and Python refuse a longer password; PBKDF2 has no such limit."
}
},
"totp": {
"secret": "GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ",
"cases": [
{
"name": "RFC 6238 T=59",
"unix": 59,
"code": "287082",
"valid": true
},
{
"name": "RFC 6238 T=1111111109",
"unix": 1111111109,
"code": "081804",
"valid": true
},
{
"name": "RFC 6238 T=1111111111",
"unix": 1111111111,
"code": "050471",
"valid": true
},
{
"name": "RFC 6238 T=1234567890",
"unix": 1234567890,
"code": "005924",
"valid": true
},
{
"name": "RFC 6238 T=2000000000",
"unix": 2000000000,
"code": "279037",
"valid": true
},
{
"name": "the next step still accepts the previous code",
"unix": 1111111139,
"code": "081804",
"valid": true
},
{
"name": "the previous step accepts the next code",
"unix": 1111111079,
"code": "081804",
"valid": true
},
{
"name": "two steps late is refused",
"unix": 1111111169,
"code": "081804",
"valid": false
},
{
"name": "two steps early is refused",
"unix": 1111111049,
"code": "081804",
"valid": false
},
{
"name": "a code is not a different code",
"unix": 59,
"code": "287083",
"valid": false
},
{
"name": "a code with a letter",
"unix": 59,
"code": "28708a",
"valid": false
},
{
"name": "five digits",
"unix": 59,
"code": "28708",
"valid": false
},
{
"name": "seven digits",
"unix": 59,
"code": "2870820",
"valid": false
},
{
"name": "empty code",
"unix": 59,
"code": "",
"valid": false
},
{
"name": "non-ASCII digits",
"unix": 59,
"code": "٢٨٧٠٨٢",
"valid": false
},
{
"name": "surrounding spaces are trimmed",
"unix": 59,
"code": " 287082 ",
"valid": true
},
{
"name": "secret in lower case with spaces and padding",
"unix": 59,
"code": "287082",
"secret": "gezd gnbv gy3t qojq gezd gnbv gy3t qojq====",
"valid": true
},
{
"name": "empty secret",
"unix": 59,
"code": "287082",
"secret": "",
"valid": false
},
{
"name": "secret that is not base32",
"unix": 59,
"code": "287082",
"secret": "not base32 !!",
"valid": false
}
]
},
"clientAddress": {
"note": "Go and Python only. The address is the TCP peer unless the peer is in the trusted list; then X-Forwarded-For is read from the right and trusted hops are skipped (owner decision 5).",
"invalidTrustedProxyLists": [
"not-an-ip",
"10.0.0.0/33",
"10.0.0.1, bogus"
],
"cases": [
{
"name": "no trusted proxies ignores the header",
"trusted": "",
"peer": "203.0.113.7",
"forwarded": [
"198.51.100.1"
],
"want": "203.0.113.7"
},
{
"name": "an unknown peer's header is ignored",
"trusted": "10.0.0.0/8",
"peer": "203.0.113.7",
"forwarded": [
"198.51.100.1"
],
"want": "203.0.113.7"
},
{
"name": "single client behind a trusted peer",
"trusted": "10.0.0.0/8, 172.16.0.0/12",
"peer": "10.0.0.2",
"forwarded": [
"198.51.100.9"
],
"want": "198.51.100.9"
},
{
"name": "second trusted hop is skipped",
"trusted": "10.0.0.0/8, 172.16.0.0/12",
"peer": "10.0.0.2",
"forwarded": [
"198.51.100.9, 172.16.4.4"
],
"want": "198.51.100.9"
},
{
"name": "a spoofed left-most entry is skipped",
"trusted": "10.0.0.0/8, 172.16.0.0/12",
"peer": "10.0.0.2",
"forwarded": [
"6.6.6.6, 198.51.100.9, 172.16.4.4"
],
"want": "198.51.100.9"
},
{
"name": "entries across header lines",
"trusted": "10.0.0.0/8, 172.16.0.0/12",
"peer": "10.0.0.2",
"forwarded": [
"6.6.6.6",
"198.51.100.9"
],
"want": "198.51.100.9"
},
{
"name": "a malformed entry falls back to the peer",
"trusted": "10.0.0.0/8, 172.16.0.0/12",
"peer": "10.0.0.2",
"forwarded": [
"198.51.100.9, not-an-ip"
],
"want": "10.0.0.2"
},
{
"name": "no header falls back to the peer",
"trusted": "10.0.0.0/8, 172.16.0.0/12",
"peer": "10.0.0.2",
"forwarded": [],
"want": "10.0.0.2"
},
{
"name": "every hop trusted uses the left-most",
"trusted": "10.0.0.0/8, 172.16.0.0/12",
"peer": "10.0.0.2",
"forwarded": [
"10.1.1.1, 172.16.4.4"
],
"want": "10.1.1.1"
},
{
"name": "a bare address is a one-host range",
"trusted": "192.168.1.5",
"peer": "192.168.1.5",
"forwarded": [
"198.51.100.9"
],
"want": "198.51.100.9"
},
{
"name": "an IPv6 proxy range",
"trusted": "fd00::/8",
"peer": "fd00::2",
"forwarded": [
"2001:db8::9"
],
"want": "2001:db8::9"
}
]
}
}