OWASP / OWASP/Nettacker

[Testing] Add unit tests for core protocol libraries (HTTP, SSH, FTP, SMTP, Telnet, POP3)

Open
#1,384 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
1.2k
Avg merge
1d 21h
Merged PRs (30d)
16

Description

Summary

The protocol handler libraries under nettacker/core/lib/ are almost entirely untested.
Out of 13 protocol files, only 3 have test coverage (SMB, SSL, Socket).
The remaining 10 — including HTTP, SSH, FTP, FTPS, SMTP, SMTPS, POP3, POP3S, Telnet, and Base —
have zero unit tests.

Affected Files

  • nettacker/core/lib/base.py — base connection class (parent of all protocols)
  • nettacker/core/lib/http.py — used by all scan/vuln modules
  • nettacker/core/lib/ssh.py
  • nettacker/core/lib/ftp.py / ftps.py
  • nettacker/core/lib/smtp.py / smtps.py
  • nettacker/core/lib/pop3.py / pop3s.py
  • nettacker/core/lib/telnet.py

What Needs to Be Done

  • Write unit tests for base.py covering connection lifecycle, timeout handling, and error states
  • Write unit tests for http.py covering request building, response parsing, and condition matching (mock requests)
  • Write unit tests for ssh.py covering auth attempts and error handling (mock paramiko)
  • Write unit tests for ftp.py, ftps.py covering login flows and error handling (mock ftplib)
  • Write unit tests for smtp.py, smtps.py covering connection and auth flows
  • Write unit tests for pop3.py, pop3s.py
  • Write unit tests for telnet.py
  • Place tests in tests/core/lib/test_<protocol>.py matching the existing pattern

Acceptance Criteria

  • All network calls must be mocked (no real connections)
  • Each protocol file achieves ≥ 80% line coverage
  • Tests run successfully with pytest tests/core/lib/

Context

This is part of the GSoC 2026 goal to raise overall test coverage to 85%.
The existing tests/core/lib/test_socket.py and test_smb.py can serve as reference implementations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/core/lib/test_socket.py and test_smb.py, then inspect the protocol files under nettacker/core/lib/. Add matching tests under tests/core/lib/test_.py with all network calls mocked, and run pytest tests/core/lib/; done means the listed protocols reach at least 80% line coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.