getlog must not hand out io logs: they contain the raw JSON-RPC and plugin traffic, which includes secrets such as runes.
(node_factory)
| 3866 | |
| 3867 | |
| 3868 | def test_getlog_no_io(node_factory): |
| 3869 | """getlog must not hand out io logs: they contain the raw JSON-RPC and |
| 3870 | plugin traffic, which includes secrets such as runes.""" |
| 3871 | l1 = node_factory.get_node(options={'log-level': 'io'}) |
| 3872 | |
| 3873 | rune = l1.rpc.createrune()['rune'] |
| 3874 | |
| 3875 | # The schema doesn't allow it, but lightningd must refuse it too. |
| 3876 | l1.rpc.check_request_schemas = False |
| 3877 | with pytest.raises(RpcError, match='io logs are not available'): |
| 3878 | l1.rpc.getlog(level='io') |
| 3879 | l1.rpc.check_request_schemas = True |
| 3880 | |
| 3881 | # Nor do the other levels expose raw traffic. |
| 3882 | for level in ('trace', 'debug', 'info', 'unusual', 'broken'): |
| 3883 | for entry in l1.rpc.getlog(level=level)['log']: |
| 3884 | assert 'data' not in entry |
| 3885 | assert rune not in entry.get('log', '') |
| 3886 | |
| 3887 | |
| 3888 | def test_log_filter(node_factory): |