fix: keep provider payloads out of verbose logs

This commit is contained in:
NotoriousRebel
2026-07-20 23:37:09 -04:00
parent 523ce518e1
commit 5b7c93dd22
25 changed files with 306 additions and 45 deletions
@@ -0,0 +1,23 @@
import logging
from unittest.mock import AsyncMock
import pytest
from theHarvester.discovery import githubcode
@pytest.mark.asyncio
async def test_process_does_not_log_error_body(monkeypatch, caplog) -> None:
monkeypatch.setattr(githubcode.Core, 'github_key', lambda: 'test-key')
search = githubcode.SearchGithubCode(word='test', limit=10)
monkeypatch.setattr(
search,
'do_search',
AsyncMock(return_value=('', {'secret': 'provider-secret-payload'}, 500, {})),
)
caplog.set_level(logging.INFO, logger=githubcode.__name__)
await search.process()
assert 'provider-secret-payload' not in caplog.text
assert '500' in caplog.text