MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_getlog_no_io

Function test_getlog_no_io

tests/test_misc.py:3868–3885  ·  view source on GitHub ↗

getlog must not hand out io logs: they contain the raw JSON-RPC and plugin traffic, which includes secrets such as runes.

(node_factory)

Source from the content-addressed store, hash-verified

3866
3867
3868def 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
3888def test_log_filter(node_factory):

Callers

nothing calls this directly

Calls 3

getlogMethod · 0.80
get_nodeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected