Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vulnhunter-agent/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ version = { attr = "vulnhunter.__version__" }

[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_files = ["test_*.py", "verify_*.py"]
asyncio_mode = "auto"
filterwarnings = [
"error",
Expand Down
8 changes: 4 additions & 4 deletions vulnhunter-agent/tests/verify_012_audit_redaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
headers, access_token query params, and raw token prefixes.
"""

import pytest

from agent._url import redact


Expand All @@ -16,14 +14,16 @@ def test_basic_auth_still_redacted():
)


# The bearer and query-param cases use opaque tokens with no known prefix, so
# the raw-prefix pass can't mask them and each test exercises only its own pass.
def test_bearer_header_redacted():
out = redact("Authorization: Bearer ghp_AAAA1111BBBB2222CCCC3333")
out = redact("Authorization: Bearer AAAA1111BBBB2222CCCC3333")
assert "AAAA1111BBBB2222" not in out
assert "***" in out


def test_access_token_query_redacted():
out = redact("https://api.github.com/x?access_token=ghp_SECRET1234ABCD&y=1")
out = redact("https://api.github.com/x?access_token=SECRET1234ABCD&y=1")
assert "SECRET1234ABCD" not in out
assert "y=1" in out # non-secret query params preserved

Expand Down
12 changes: 12 additions & 0 deletions vulnhunter-agent/tests/verify_013_audit_umask.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@
import os
import stat

import pytest

from agent.audit import _open_append


@pytest.fixture(autouse=True)
def _restore_umask():
# The tests below force umask 022; restore the caller's umask so it doesn't
# leak into whatever test runs next in the same process.
old = os.umask(0o022)
os.umask(old)
yield
os.umask(old)


def test_audit_file_is_owner_only(tmp_path):
os.umask(0o022) # the umask that would otherwise leak 0o644
path = tmp_path / "sub" / "audit_events.jsonl"
Expand Down
Loading