Opened 6 weeks ago

Last modified 5 weeks ago

#30105 new defect

"pr" lines in consensus can have trailing whitespace

Reported by: irl Owned by:
Priority: Medium Milestone: Tor: 0.4.2.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: dir-spec
Cc: karsten Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

dir-spec specifies keyword lines as:

KeywordLine ::= Keyword NL | Keyword WS ArgumentChar+ NL

However, observed in the wild:

pr 

There is trailing whitespace on line 1840 of the 2019-04-09 19:00:00 consensus. It is at line 1840.

As the directory authorities all seem to agree that this trailing whitespace should be there we don't have an issue, but it's against the spec and has likely happened by accident.

If we accidentally remove the trailing whitespace, we don't have a consensus anymore.

Options for fixing this are:

  • require trailing whitespace for pr lines with no arguments
  • make a new consensus method that doesn't have trailing whitespace

Either way, this needs a spec change before we write any code.

Child Tickets

Change History (7)

comment:1 Changed 6 weeks ago by irl

Keywords: dir-spec added

comment:2 Changed 6 weeks ago by karsten

Cc: karsten added

comment:3 Changed 6 weeks ago by irl

This also affects microdescriptor consensuses.

e.g. https://collector.torproject.org/recent/relay-descriptors/microdescs/consensus-microdesc/2019-04-11-17-00-00-consensus-microdesc

RuntimeError: Expected argument on line 1849 at col 3, but found NL

comment:4 Changed 6 weeks ago by irl

This also affects extra-info descriptors dirreq-v3-ips and dirreq-v3-reqs.

 @type extra-info 1.0
extra-info GibberfishInc ACDDC33428080D906C86357651D12DC49C460F4B
identity-ed25519
-----BEGIN ED25519 CERT-----
AQQABpgxAWEvIDlvQPuepLZmDxsPzNwQoUbFiyd8GQP44Ea1mHFVAQAgBACoMWEm
QJT+vhNUeJ0UPNNhPUaK/Ykr5PjgS6dI4GfkIavCTTqd82lkx0IZmPSXk4xjinhx
rrHz21HTx0VqHr2VRodp82i9Xtmvdk+hwBW6BkyoKd9lavzSJurxaGgtUwE=
-----END ED25519 CERT-----
published 2019-04-08 17:00:06
write-history 2019-04-08 05:02:25 (86400 s) 798967583744,771031353344,804959337472,845854185472,826836249600
read-history 2019-04-08 05:02:25 (86400 s) 807575010304,772209849344,814930069504,848800598016,823127615488
dirreq-write-history 2019-04-08 05:02:25 (86400 s) 15897600,53308416,4578304,25142272,6651904
dirreq-read-history 2019-04-08 05:02:25 (86400 s) 13304832,13650944,6738944,7948288,5615616
geoip-db-digest CFFD7B0544879150A31F966E83DBB7DDDFA16F49
geoip6-db-digest B25710F60CB23F0C76F58AFB0A26A26ACB701BB2
router-sig-ed25519 /KwvTxj2LeGAM4/BlhpkMaTeF0+06I3UIwxNtK8a/TgcMXYjG2Rn5TaOIFkmB8CvSZXZLqvCnSBisDnfTfvTAw
router-signature
-----BEGIN SIGNATURE-----
SJZjYu1uyzlUVflB1YwDomSmS9SeHh0vE6Sa4bmtpk3GiBOK8fp04hAnwqjCafE7
Ot8vbQ0D/WiBe9IaJK0i0aX96ov42riyzkLfd9tUgzhg5lfyy/4aG2XeuypVKUze
+GBDZqufqvSZ2oMYh/d5/TlwDwMzW1SHvWZjw/4TR/4=
-----END SIGNATURE-----
@type extra-info 1.0
extra-info khaua 6E7DBD09E0B00B0D48903CDB1DCC7A3F7CBB408B
identity-ed25519
-----BEGIN ED25519 CERT-----
AQQABpjoAXOZp7WB5en//uEHPP7NfEw9EZ/JOLl+6mcsCmTEiPcMAQAgBAD8mMKB
JjA3/uPV2xmGIICVGXt6yJvAN1i0cLOUUogptuJ6FF0LpYHOWI6JB3Y28XdLq+I7
O6z8Qb+Qg/BydzlLMoUqZDaDBJmY0G9nENeiLoYf/SI0F4AeMXvJsA2xfw8=
-----END ED25519 CERT-----
published 2019-04-08 17:01:04
write-history 2019-04-08 16:51:01 (14400 s) 8561709056,6519402496,6281266176,4056669184,6036272128,8280641536
read-history 2019-04-08 16:51:01 (14400 s) 8296964096,6572850176,6173015040,6547064832,6301709312,8661540864
dirreq-write-history 2019-04-08 16:51:01 (14400 s) 52091904,2541568,1718272,1932288,3360768,4302848
dirreq-read-history 2019-04-08 16:51:01 (14400 s) 6338560,5756928,5268480,5112832,5038080,4957184
geoip-db-digest E3C910F3B2A6C916C7BE33A943091EF57048B72C
geoip6-db-digest E8BD5B2E6554C27F718F1222667C09680D75F799
dirreq-stats-end 2019-04-08 08:51:01 (86400 s)
dirreq-v3-ips 
dirreq-v3-reqs 
dirreq-v3-resp ok=0,not-enough-sigs=0,unavailable=0,not-found=0,not-modified=0,busy=0
dirreq-v3-direct-dl complete=0,timeout=0,running=0
dirreq-v3-tunneled-dl complete=0,timeout=0,running=0
hidserv-stats-end 2019-04-08 08:51:01 (86400 s)
hidserv-rend-relayed-cells 7539 delta_f=2048 epsilon=0.30 bin_size=1024
hidserv-dir-onions-seen 603 delta_f=8 epsilon=0.30 bin_size=8
router-sig-ed25519 oHiUJOtwqARgIyLQQwZkEoJ8AUxW3yQ9fklu7dShCUey2NhZF5pzUN2FQsnnin44H/Uug9iZbhMuPIejYNCbCA
router-signature
-----BEGIN SIGNATURE-----
VwVBIIfhG6q50G4VAv1uxEjPKt5Q0FMoNQUO6ukLZQiDaEmDbL9YIdeolNSLt8Bt
wwy/MPf34NkorVUHaKFwA1nkOUHECJqy+yubZkaOrYFd/R5pUuvlvGUyop1iNzfa
LOKECLGlGIXeUoHFBmgmmGAjs66Zr++9djwVx5ZeFOc=
-----END SIGNATURE-----
RuntimeError: Expected argument on line 40 at col 14, but found NL

comment:5 Changed 6 weeks ago by irl

Votes are affected, server descriptors and microdescriptors are not.

comment:6 Changed 6 weeks ago by teor

These trailing spaces seem like a pretty widespread issue.

After the fix, we should check all the directory lines tor creates for trailing spaces, and log a BUG() if we find any.

comment:7 Changed 5 weeks ago by nickm

Milestone: Tor: 0.4.2.x-final

Calling this out-of-scope for 0.4.1.x, but we should do it soon as a QOI thing.

Last edited 5 weeks ago by nickm (previous) (diff)
Note: See TracTickets for help on using tickets.