argus-guard 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- argus_guard-0.1.0a1/LICENSE +9 -0
- argus_guard-0.1.0a1/PKG-INFO +130 -0
- argus_guard-0.1.0a1/README.md +109 -0
- argus_guard-0.1.0a1/pyproject.toml +55 -0
- argus_guard-0.1.0a1/python/src/argus_guard/__init__.py +20 -0
- argus_guard-0.1.0a1/python/src/argus_guard/cli.py +138 -0
- argus_guard-0.1.0a1/python/src/argus_guard/http_client.py +90 -0
- argus_guard-0.1.0a1/python/src/argus_guard/security_headers.py +68 -0
- argus_guard-0.1.0a1/python/src/argus_guard.egg-info/PKG-INFO +130 -0
- argus_guard-0.1.0a1/python/src/argus_guard.egg-info/SOURCES.txt +15 -0
- argus_guard-0.1.0a1/python/src/argus_guard.egg-info/dependency_links.txt +1 -0
- argus_guard-0.1.0a1/python/src/argus_guard.egg-info/entry_points.txt +2 -0
- argus_guard-0.1.0a1/python/src/argus_guard.egg-info/top_level.txt +1 -0
- argus_guard-0.1.0a1/setup.cfg +4 -0
- argus_guard-0.1.0a1/tests/test_cli.py +94 -0
- argus_guard-0.1.0a1/tests/test_http_client.py +70 -0
- argus_guard-0.1.0a1/tests/test_security_headers.py +88 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Irena Popova
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: argus-guard
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Modular cybersecurity auditing, DevSecOps verification, and monitoring toolkit.
|
|
5
|
+
Author: Irena Popova
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: cybersecurity,security,security-auditing,devsecops,monitoring,automation,python,rust
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: System Administrators
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Topic :: Security
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# ARGUS Security
|
|
23
|
+
|
|
24
|
+
### Modular Cybersecurity Analysis, Auditing & Monitoring
|
|
25
|
+
|
|
26
|
+
**ARGUS Security** is a modular cybersecurity toolkit under development, built with **Python and Rust**.
|
|
27
|
+
|
|
28
|
+
The project aims to combine security analysis algorithms, automated verification, system diagnostics, and monitoring within a flexible, extensible architecture.
|
|
29
|
+
|
|
30
|
+
ARGUS is designed to support both command-line usage and future web-based security assessment services.
|
|
31
|
+
|
|
32
|
+
## Project Objectives
|
|
33
|
+
|
|
34
|
+
- Develop modular algorithms for security analysis and auditing.
|
|
35
|
+
- Automate reproducible security verification workflows.
|
|
36
|
+
- Identify potential vulnerabilities and configuration weaknesses.
|
|
37
|
+
- Support structured security assessments and reporting.
|
|
38
|
+
- Integrate system monitoring and operational diagnostics.
|
|
39
|
+
- Provide an extensible architecture for additional security modules.
|
|
40
|
+
|
|
41
|
+
## Technology Stack
|
|
42
|
+
|
|
43
|
+
| Technology | Purpose |
|
|
44
|
+
|---|---|
|
|
45
|
+
| Python | Security analysis, automation, orchestration, and reporting |
|
|
46
|
+
| Rust | Performance-sensitive and memory-safe system components |
|
|
47
|
+
| Docker | Containerization and reproducible deployment |
|
|
48
|
+
| Prometheus | Metrics collection and monitoring |
|
|
49
|
+
| Grafana | Monitoring dashboards and visualization |
|
|
50
|
+
| GitHub Actions | Continuous integration and automated testing |
|
|
51
|
+
|
|
52
|
+
## Architecture
|
|
53
|
+
|
|
54
|
+
ARGUS follows a modular architecture based on independent security analysis components.
|
|
55
|
+
|
|
56
|
+
**Python Layer**
|
|
57
|
+
|
|
58
|
+
- Security analysis algorithms
|
|
59
|
+
- Workflow orchestration
|
|
60
|
+
- Configuration validation
|
|
61
|
+
- Data processing
|
|
62
|
+
- Report generation
|
|
63
|
+
- Command-line interfaces
|
|
64
|
+
|
|
65
|
+
**Rust Layer**
|
|
66
|
+
|
|
67
|
+
- Performance-critical operations
|
|
68
|
+
- Low-level system utilities
|
|
69
|
+
- Efficient data processing
|
|
70
|
+
- Security-focused components
|
|
71
|
+
|
|
72
|
+
**Monitoring & Infrastructure**
|
|
73
|
+
|
|
74
|
+
- Docker-based environments
|
|
75
|
+
- Prometheus metrics
|
|
76
|
+
- Grafana dashboards
|
|
77
|
+
- Automated testing and deployment workflows
|
|
78
|
+
|
|
79
|
+
## Planned Interfaces
|
|
80
|
+
|
|
81
|
+
**1. Command-Line Toolkit**
|
|
82
|
+
|
|
83
|
+
A locally installable toolkit for developers, security engineers, and system administrators.
|
|
84
|
+
|
|
85
|
+
**2. Web-Based Security Assessment**
|
|
86
|
+
|
|
87
|
+
A future interface for submitting authorized targets, executing supported security checks, and reviewing structured reports.
|
|
88
|
+
|
|
89
|
+
**3. Modular Integration**
|
|
90
|
+
|
|
91
|
+
Reusable components that can be integrated into other software systems and security workflows.
|
|
92
|
+
|
|
93
|
+
## Development Roadmap
|
|
94
|
+
|
|
95
|
+
- [ ] Establish Python and Rust project structure
|
|
96
|
+
- [ ] Implement initial security analysis algorithms
|
|
97
|
+
- [ ] Build a modular execution and orchestration framework
|
|
98
|
+
- [ ] Develop command-line interfaces
|
|
99
|
+
- [ ] Implement structured security reporting
|
|
100
|
+
- [ ] Integrate Python and Rust components
|
|
101
|
+
- [ ] Add Docker support
|
|
102
|
+
- [ ] Integrate Prometheus and Grafana
|
|
103
|
+
- [ ] Configure automated testing and CI workflows
|
|
104
|
+
- [ ] Develop an optional web interface
|
|
105
|
+
|
|
106
|
+
## Development Status
|
|
107
|
+
|
|
108
|
+
🚧 **Early development — architecture and core components are being established.**
|
|
109
|
+
|
|
110
|
+
Features listed in the roadmap are planned and should not be considered implemented or production-ready.
|
|
111
|
+
|
|
112
|
+
## Security & Responsible Use
|
|
113
|
+
|
|
114
|
+
ARGUS Security is intended for legitimate security research, defensive analysis, and authorized security assessments.
|
|
115
|
+
|
|
116
|
+
Users must obtain appropriate permission before examining systems, networks, or services they do not own or administer.
|
|
117
|
+
|
|
118
|
+
## Author
|
|
119
|
+
|
|
120
|
+
**Irena Popova**
|
|
121
|
+
|
|
122
|
+
Software Developer | Independent Researcher
|
|
123
|
+
|
|
124
|
+
Background in applied linguistics, computer science, software development, and computational research.
|
|
125
|
+
|
|
126
|
+
GitHub: [@irenapopova](https://github.com/irenapopova)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
**ARGUS Security — Engineering security through algorithms, verification, and evidence.**
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# ARGUS Security
|
|
2
|
+
|
|
3
|
+
### Modular Cybersecurity Analysis, Auditing & Monitoring
|
|
4
|
+
|
|
5
|
+
**ARGUS Security** is a modular cybersecurity toolkit under development, built with **Python and Rust**.
|
|
6
|
+
|
|
7
|
+
The project aims to combine security analysis algorithms, automated verification, system diagnostics, and monitoring within a flexible, extensible architecture.
|
|
8
|
+
|
|
9
|
+
ARGUS is designed to support both command-line usage and future web-based security assessment services.
|
|
10
|
+
|
|
11
|
+
## Project Objectives
|
|
12
|
+
|
|
13
|
+
- Develop modular algorithms for security analysis and auditing.
|
|
14
|
+
- Automate reproducible security verification workflows.
|
|
15
|
+
- Identify potential vulnerabilities and configuration weaknesses.
|
|
16
|
+
- Support structured security assessments and reporting.
|
|
17
|
+
- Integrate system monitoring and operational diagnostics.
|
|
18
|
+
- Provide an extensible architecture for additional security modules.
|
|
19
|
+
|
|
20
|
+
## Technology Stack
|
|
21
|
+
|
|
22
|
+
| Technology | Purpose |
|
|
23
|
+
|---|---|
|
|
24
|
+
| Python | Security analysis, automation, orchestration, and reporting |
|
|
25
|
+
| Rust | Performance-sensitive and memory-safe system components |
|
|
26
|
+
| Docker | Containerization and reproducible deployment |
|
|
27
|
+
| Prometheus | Metrics collection and monitoring |
|
|
28
|
+
| Grafana | Monitoring dashboards and visualization |
|
|
29
|
+
| GitHub Actions | Continuous integration and automated testing |
|
|
30
|
+
|
|
31
|
+
## Architecture
|
|
32
|
+
|
|
33
|
+
ARGUS follows a modular architecture based on independent security analysis components.
|
|
34
|
+
|
|
35
|
+
**Python Layer**
|
|
36
|
+
|
|
37
|
+
- Security analysis algorithms
|
|
38
|
+
- Workflow orchestration
|
|
39
|
+
- Configuration validation
|
|
40
|
+
- Data processing
|
|
41
|
+
- Report generation
|
|
42
|
+
- Command-line interfaces
|
|
43
|
+
|
|
44
|
+
**Rust Layer**
|
|
45
|
+
|
|
46
|
+
- Performance-critical operations
|
|
47
|
+
- Low-level system utilities
|
|
48
|
+
- Efficient data processing
|
|
49
|
+
- Security-focused components
|
|
50
|
+
|
|
51
|
+
**Monitoring & Infrastructure**
|
|
52
|
+
|
|
53
|
+
- Docker-based environments
|
|
54
|
+
- Prometheus metrics
|
|
55
|
+
- Grafana dashboards
|
|
56
|
+
- Automated testing and deployment workflows
|
|
57
|
+
|
|
58
|
+
## Planned Interfaces
|
|
59
|
+
|
|
60
|
+
**1. Command-Line Toolkit**
|
|
61
|
+
|
|
62
|
+
A locally installable toolkit for developers, security engineers, and system administrators.
|
|
63
|
+
|
|
64
|
+
**2. Web-Based Security Assessment**
|
|
65
|
+
|
|
66
|
+
A future interface for submitting authorized targets, executing supported security checks, and reviewing structured reports.
|
|
67
|
+
|
|
68
|
+
**3. Modular Integration**
|
|
69
|
+
|
|
70
|
+
Reusable components that can be integrated into other software systems and security workflows.
|
|
71
|
+
|
|
72
|
+
## Development Roadmap
|
|
73
|
+
|
|
74
|
+
- [ ] Establish Python and Rust project structure
|
|
75
|
+
- [ ] Implement initial security analysis algorithms
|
|
76
|
+
- [ ] Build a modular execution and orchestration framework
|
|
77
|
+
- [ ] Develop command-line interfaces
|
|
78
|
+
- [ ] Implement structured security reporting
|
|
79
|
+
- [ ] Integrate Python and Rust components
|
|
80
|
+
- [ ] Add Docker support
|
|
81
|
+
- [ ] Integrate Prometheus and Grafana
|
|
82
|
+
- [ ] Configure automated testing and CI workflows
|
|
83
|
+
- [ ] Develop an optional web interface
|
|
84
|
+
|
|
85
|
+
## Development Status
|
|
86
|
+
|
|
87
|
+
🚧 **Early development — architecture and core components are being established.**
|
|
88
|
+
|
|
89
|
+
Features listed in the roadmap are planned and should not be considered implemented or production-ready.
|
|
90
|
+
|
|
91
|
+
## Security & Responsible Use
|
|
92
|
+
|
|
93
|
+
ARGUS Security is intended for legitimate security research, defensive analysis, and authorized security assessments.
|
|
94
|
+
|
|
95
|
+
Users must obtain appropriate permission before examining systems, networks, or services they do not own or administer.
|
|
96
|
+
|
|
97
|
+
## Author
|
|
98
|
+
|
|
99
|
+
**Irena Popova**
|
|
100
|
+
|
|
101
|
+
Software Developer | Independent Researcher
|
|
102
|
+
|
|
103
|
+
Background in applied linguistics, computer science, software development, and computational research.
|
|
104
|
+
|
|
105
|
+
GitHub: [@irenapopova](https://github.com/irenapopova)
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
**ARGUS Security — Engineering security through algorithms, verification, and evidence.**
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "argus-guard"
|
|
7
|
+
version = "0.1.0a1"
|
|
8
|
+
|
|
9
|
+
description = "Modular cybersecurity auditing, DevSecOps verification, and monitoring toolkit."
|
|
10
|
+
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
|
|
14
|
+
license = "MIT"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
16
|
+
|
|
17
|
+
authors = [
|
|
18
|
+
{ name = "Irena Popova" }
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
keywords = [
|
|
22
|
+
"cybersecurity",
|
|
23
|
+
"security",
|
|
24
|
+
"security-auditing",
|
|
25
|
+
"devsecops",
|
|
26
|
+
"monitoring",
|
|
27
|
+
"automation",
|
|
28
|
+
"python",
|
|
29
|
+
"rust"
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
classifiers = [
|
|
33
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
34
|
+
"Intended Audience :: Developers",
|
|
35
|
+
"Intended Audience :: System Administrators",
|
|
36
|
+
"Programming Language :: Python :: 3",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Programming Language :: Python :: 3.13",
|
|
40
|
+
"Operating System :: OS Independent",
|
|
41
|
+
"Topic :: Security"
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
dependencies = []
|
|
45
|
+
|
|
46
|
+
[tool.setuptools]
|
|
47
|
+
package-dir = { "" = "python/src" }
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.packages.find]
|
|
50
|
+
where = ["python/src"]
|
|
51
|
+
include = ["argus_guard*"]
|
|
52
|
+
namespaces = false
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
argus-guard = "argus_guard.cli:main"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ARGUS
|
|
3
|
+
=====
|
|
4
|
+
|
|
5
|
+
Modular Cybersecurity Analysis, Automated Auditing,
|
|
6
|
+
DevSecOps and Monitoring.
|
|
7
|
+
|
|
8
|
+
Built with Python and Rust.
|
|
9
|
+
|
|
10
|
+
Author: Irena Popova
|
|
11
|
+
License: MIT
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__version__ = "0.1.0a1"
|
|
15
|
+
__author__ = "Irena Popova"
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"__version__",
|
|
19
|
+
"__author__",
|
|
20
|
+
]
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ARGUS — Command-Line Interface
|
|
3
|
+
==============================
|
|
4
|
+
|
|
5
|
+
Command-line interface for cybersecurity analysis,
|
|
6
|
+
automated auditing, and diagnostic reporting.
|
|
7
|
+
|
|
8
|
+
Author: Irena Popova
|
|
9
|
+
License: MIT
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import json
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
from .http_client import (
|
|
17
|
+
fetch_response_headers,
|
|
18
|
+
HeaderFetchError,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
from .security_headers import (
|
|
22
|
+
audit_security_headers,
|
|
23
|
+
calculate_header_coverage,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def run_headers_audit(
|
|
28
|
+
url: str,
|
|
29
|
+
json_output: bool = False,
|
|
30
|
+
) -> dict:
|
|
31
|
+
"""
|
|
32
|
+
Execute an HTTP security headers audit.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
url: Authorized HTTPS target.
|
|
36
|
+
json_output: Whether to print JSON output.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Dictionary containing the audit results.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
headers = fetch_response_headers(url)
|
|
43
|
+
|
|
44
|
+
results = audit_security_headers(headers)
|
|
45
|
+
|
|
46
|
+
coverage = calculate_header_coverage(results)
|
|
47
|
+
|
|
48
|
+
report = {
|
|
49
|
+
"target": url,
|
|
50
|
+
"checks": results,
|
|
51
|
+
"header_coverage_percent": coverage,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if json_output:
|
|
55
|
+
print(json.dumps(report, indent=2))
|
|
56
|
+
|
|
57
|
+
else:
|
|
58
|
+
print("\nARGUS — Security Headers Audit")
|
|
59
|
+
print("=" * 40)
|
|
60
|
+
|
|
61
|
+
print(f"Target: {url}\n")
|
|
62
|
+
|
|
63
|
+
for header, present in results.items():
|
|
64
|
+
status = "PRESENT" if present else "MISSING"
|
|
65
|
+
print(f"[{status}] {header}")
|
|
66
|
+
|
|
67
|
+
print(f"\nHeader coverage: {coverage}%")
|
|
68
|
+
|
|
69
|
+
print(
|
|
70
|
+
"\nNote: Header presence does not guarantee "
|
|
71
|
+
"a secure configuration."
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
return report
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def main() -> int:
|
|
78
|
+
"""Entry point for the ARGUS command-line interface."""
|
|
79
|
+
|
|
80
|
+
parser = argparse.ArgumentParser(
|
|
81
|
+
prog="argus-guard",
|
|
82
|
+
description=(
|
|
83
|
+
"ARGUS — Modular Cybersecurity Auditing Toolkit"
|
|
84
|
+
),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
subparsers = parser.add_subparsers(
|
|
88
|
+
dest="command",
|
|
89
|
+
required=True,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
headers_parser = subparsers.add_parser(
|
|
93
|
+
"headers",
|
|
94
|
+
help="Audit HTTP security headers",
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
headers_parser.add_argument(
|
|
98
|
+
"url",
|
|
99
|
+
help="HTTPS URL you are authorized to audit",
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
headers_parser.add_argument(
|
|
103
|
+
"--json",
|
|
104
|
+
action="store_true",
|
|
105
|
+
help="Output results in JSON format",
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
headers_parser.add_argument(
|
|
109
|
+
"--fail-on-missing",
|
|
110
|
+
action="store_true",
|
|
111
|
+
help="Return exit code 1 if any checked header is missing",
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
args = parser.parse_args()
|
|
115
|
+
|
|
116
|
+
if args.command == "headers":
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
report = run_headers_audit(
|
|
120
|
+
args.url,
|
|
121
|
+
json_output=args.json,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
except (HeaderFetchError, ValueError) as error:
|
|
125
|
+
print(f"ARGUS error: {error}", file=sys.stderr)
|
|
126
|
+
return 2
|
|
127
|
+
|
|
128
|
+
if args.fail_on_missing:
|
|
129
|
+
if not all(report["checks"].values()):
|
|
130
|
+
return 1
|
|
131
|
+
|
|
132
|
+
return 0
|
|
133
|
+
|
|
134
|
+
return 2
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
if __name__ == "__main__":
|
|
138
|
+
sys.exit(main())
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ARGUS — HTTP Client
|
|
3
|
+
===================
|
|
4
|
+
|
|
5
|
+
Retrieves HTTP response headers for security analysis.
|
|
6
|
+
|
|
7
|
+
Designed for authorized security auditing.
|
|
8
|
+
|
|
9
|
+
Author: Irena Popova
|
|
10
|
+
License: MIT
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from urllib.error import HTTPError, URLError
|
|
14
|
+
from urllib.parse import urlsplit
|
|
15
|
+
from urllib.request import (
|
|
16
|
+
Request,
|
|
17
|
+
HTTPRedirectHandler,
|
|
18
|
+
build_opener,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class HeaderFetchError(RuntimeError):
|
|
23
|
+
"""Raised when HTTP response headers cannot be retrieved."""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class NoRedirectHandler(HTTPRedirectHandler):
|
|
27
|
+
"""Prevent automatic HTTP redirects."""
|
|
28
|
+
|
|
29
|
+
def redirect_request(
|
|
30
|
+
self, request, fp, code, message, headers, new_url
|
|
31
|
+
):
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def fetch_response_headers(
|
|
36
|
+
url: str,
|
|
37
|
+
timeout: float = 10.0,
|
|
38
|
+
) -> dict[str, str]:
|
|
39
|
+
"""
|
|
40
|
+
Retrieve HTTP response headers from an HTTPS URL.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
url: Target HTTPS URL.
|
|
44
|
+
timeout: Connection timeout in seconds.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
Dictionary containing HTTP response headers.
|
|
48
|
+
|
|
49
|
+
Raises:
|
|
50
|
+
ValueError: If the URL or timeout is invalid.
|
|
51
|
+
HeaderFetchError: If the request fails.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
parsed_url = urlsplit(url)
|
|
55
|
+
|
|
56
|
+
if parsed_url.scheme.lower() != "https":
|
|
57
|
+
raise ValueError("Only HTTPS URLs are supported.")
|
|
58
|
+
|
|
59
|
+
if not parsed_url.hostname:
|
|
60
|
+
raise ValueError("A valid hostname is required.")
|
|
61
|
+
|
|
62
|
+
if parsed_url.username or parsed_url.password:
|
|
63
|
+
raise ValueError("URLs containing credentials are not supported.")
|
|
64
|
+
|
|
65
|
+
if timeout <= 0:
|
|
66
|
+
raise ValueError("Timeout must be greater than zero.")
|
|
67
|
+
|
|
68
|
+
request = Request(
|
|
69
|
+
url,
|
|
70
|
+
headers={
|
|
71
|
+
"User-Agent": "ARGUS-Guard/0.1.0a1",
|
|
72
|
+
},
|
|
73
|
+
method="GET",
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
opener = build_opener(NoRedirectHandler())
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
with opener.open(request, timeout=timeout) as response:
|
|
80
|
+
return dict(response.headers.items())
|
|
81
|
+
|
|
82
|
+
except HTTPError as error:
|
|
83
|
+
raise HeaderFetchError(
|
|
84
|
+
f"HTTP request failed with status {error.code}"
|
|
85
|
+
) from error
|
|
86
|
+
|
|
87
|
+
except (URLError, TimeoutError) as error:
|
|
88
|
+
raise HeaderFetchError(
|
|
89
|
+
f"Unable to retrieve headers: {error}"
|
|
90
|
+
) from error
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ARGUS — HTTP Security Headers Analysis
|
|
3
|
+
======================================
|
|
4
|
+
|
|
5
|
+
Provides deterministic checks for the presence of
|
|
6
|
+
recommended HTTP security headers.
|
|
7
|
+
|
|
8
|
+
Author: Irena Popova
|
|
9
|
+
License: MIT
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from collections.abc import Mapping
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
SECURITY_HEADERS = {
|
|
16
|
+
"strict-transport-security": "HTTP Strict Transport Security",
|
|
17
|
+
"content-security-policy": "Content Security Policy",
|
|
18
|
+
"x-content-type-options": "MIME Type Protection",
|
|
19
|
+
"referrer-policy": "Referrer Policy",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def audit_security_headers(
|
|
24
|
+
headers: Mapping[str, str],
|
|
25
|
+
) -> dict[str, bool]:
|
|
26
|
+
"""
|
|
27
|
+
Check the presence of recommended HTTP security headers.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
headers: HTTP response headers.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Dictionary containing the result for each header.
|
|
34
|
+
True means present; False means missing.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
normalized_headers = {
|
|
38
|
+
name.lower(): value.strip()
|
|
39
|
+
for name, value in headers.items()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
results = {}
|
|
43
|
+
|
|
44
|
+
for header in SECURITY_HEADERS:
|
|
45
|
+
results[header] = bool(
|
|
46
|
+
normalized_headers.get(header)
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return results
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def calculate_header_coverage(
|
|
53
|
+
results: Mapping[str, bool],
|
|
54
|
+
) -> float:
|
|
55
|
+
"""
|
|
56
|
+
Calculate the percentage of checked headers present.
|
|
57
|
+
|
|
58
|
+
This is a header coverage metric,
|
|
59
|
+
not an overall cybersecurity score.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
if not results:
|
|
63
|
+
return 0.0
|
|
64
|
+
|
|
65
|
+
present = sum(results.values())
|
|
66
|
+
total = len(results)
|
|
67
|
+
|
|
68
|
+
return round((present / total) * 100, 2)
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: argus-guard
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Modular cybersecurity auditing, DevSecOps verification, and monitoring toolkit.
|
|
5
|
+
Author: Irena Popova
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: cybersecurity,security,security-auditing,devsecops,monitoring,automation,python,rust
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: System Administrators
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Topic :: Security
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# ARGUS Security
|
|
23
|
+
|
|
24
|
+
### Modular Cybersecurity Analysis, Auditing & Monitoring
|
|
25
|
+
|
|
26
|
+
**ARGUS Security** is a modular cybersecurity toolkit under development, built with **Python and Rust**.
|
|
27
|
+
|
|
28
|
+
The project aims to combine security analysis algorithms, automated verification, system diagnostics, and monitoring within a flexible, extensible architecture.
|
|
29
|
+
|
|
30
|
+
ARGUS is designed to support both command-line usage and future web-based security assessment services.
|
|
31
|
+
|
|
32
|
+
## Project Objectives
|
|
33
|
+
|
|
34
|
+
- Develop modular algorithms for security analysis and auditing.
|
|
35
|
+
- Automate reproducible security verification workflows.
|
|
36
|
+
- Identify potential vulnerabilities and configuration weaknesses.
|
|
37
|
+
- Support structured security assessments and reporting.
|
|
38
|
+
- Integrate system monitoring and operational diagnostics.
|
|
39
|
+
- Provide an extensible architecture for additional security modules.
|
|
40
|
+
|
|
41
|
+
## Technology Stack
|
|
42
|
+
|
|
43
|
+
| Technology | Purpose |
|
|
44
|
+
|---|---|
|
|
45
|
+
| Python | Security analysis, automation, orchestration, and reporting |
|
|
46
|
+
| Rust | Performance-sensitive and memory-safe system components |
|
|
47
|
+
| Docker | Containerization and reproducible deployment |
|
|
48
|
+
| Prometheus | Metrics collection and monitoring |
|
|
49
|
+
| Grafana | Monitoring dashboards and visualization |
|
|
50
|
+
| GitHub Actions | Continuous integration and automated testing |
|
|
51
|
+
|
|
52
|
+
## Architecture
|
|
53
|
+
|
|
54
|
+
ARGUS follows a modular architecture based on independent security analysis components.
|
|
55
|
+
|
|
56
|
+
**Python Layer**
|
|
57
|
+
|
|
58
|
+
- Security analysis algorithms
|
|
59
|
+
- Workflow orchestration
|
|
60
|
+
- Configuration validation
|
|
61
|
+
- Data processing
|
|
62
|
+
- Report generation
|
|
63
|
+
- Command-line interfaces
|
|
64
|
+
|
|
65
|
+
**Rust Layer**
|
|
66
|
+
|
|
67
|
+
- Performance-critical operations
|
|
68
|
+
- Low-level system utilities
|
|
69
|
+
- Efficient data processing
|
|
70
|
+
- Security-focused components
|
|
71
|
+
|
|
72
|
+
**Monitoring & Infrastructure**
|
|
73
|
+
|
|
74
|
+
- Docker-based environments
|
|
75
|
+
- Prometheus metrics
|
|
76
|
+
- Grafana dashboards
|
|
77
|
+
- Automated testing and deployment workflows
|
|
78
|
+
|
|
79
|
+
## Planned Interfaces
|
|
80
|
+
|
|
81
|
+
**1. Command-Line Toolkit**
|
|
82
|
+
|
|
83
|
+
A locally installable toolkit for developers, security engineers, and system administrators.
|
|
84
|
+
|
|
85
|
+
**2. Web-Based Security Assessment**
|
|
86
|
+
|
|
87
|
+
A future interface for submitting authorized targets, executing supported security checks, and reviewing structured reports.
|
|
88
|
+
|
|
89
|
+
**3. Modular Integration**
|
|
90
|
+
|
|
91
|
+
Reusable components that can be integrated into other software systems and security workflows.
|
|
92
|
+
|
|
93
|
+
## Development Roadmap
|
|
94
|
+
|
|
95
|
+
- [ ] Establish Python and Rust project structure
|
|
96
|
+
- [ ] Implement initial security analysis algorithms
|
|
97
|
+
- [ ] Build a modular execution and orchestration framework
|
|
98
|
+
- [ ] Develop command-line interfaces
|
|
99
|
+
- [ ] Implement structured security reporting
|
|
100
|
+
- [ ] Integrate Python and Rust components
|
|
101
|
+
- [ ] Add Docker support
|
|
102
|
+
- [ ] Integrate Prometheus and Grafana
|
|
103
|
+
- [ ] Configure automated testing and CI workflows
|
|
104
|
+
- [ ] Develop an optional web interface
|
|
105
|
+
|
|
106
|
+
## Development Status
|
|
107
|
+
|
|
108
|
+
🚧 **Early development — architecture and core components are being established.**
|
|
109
|
+
|
|
110
|
+
Features listed in the roadmap are planned and should not be considered implemented or production-ready.
|
|
111
|
+
|
|
112
|
+
## Security & Responsible Use
|
|
113
|
+
|
|
114
|
+
ARGUS Security is intended for legitimate security research, defensive analysis, and authorized security assessments.
|
|
115
|
+
|
|
116
|
+
Users must obtain appropriate permission before examining systems, networks, or services they do not own or administer.
|
|
117
|
+
|
|
118
|
+
## Author
|
|
119
|
+
|
|
120
|
+
**Irena Popova**
|
|
121
|
+
|
|
122
|
+
Software Developer | Independent Researcher
|
|
123
|
+
|
|
124
|
+
Background in applied linguistics, computer science, software development, and computational research.
|
|
125
|
+
|
|
126
|
+
GitHub: [@irenapopova](https://github.com/irenapopova)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
**ARGUS Security — Engineering security through algorithms, verification, and evidence.**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
python/src/argus_guard/__init__.py
|
|
5
|
+
python/src/argus_guard/cli.py
|
|
6
|
+
python/src/argus_guard/http_client.py
|
|
7
|
+
python/src/argus_guard/security_headers.py
|
|
8
|
+
python/src/argus_guard.egg-info/PKG-INFO
|
|
9
|
+
python/src/argus_guard.egg-info/SOURCES.txt
|
|
10
|
+
python/src/argus_guard.egg-info/dependency_links.txt
|
|
11
|
+
python/src/argus_guard.egg-info/entry_points.txt
|
|
12
|
+
python/src/argus_guard.egg-info/top_level.txt
|
|
13
|
+
tests/test_cli.py
|
|
14
|
+
tests/test_http_client.py
|
|
15
|
+
tests/test_security_headers.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
argus_guard
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import json
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from contextlib import redirect_stdout, redirect_stderr
|
|
6
|
+
from unittest.mock import patch
|
|
7
|
+
|
|
8
|
+
from argus_guard.cli import main
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestARGUSCLI(unittest.TestCase):
|
|
12
|
+
|
|
13
|
+
@patch("argus_guard.cli.fetch_response_headers")
|
|
14
|
+
def test_json_output(self, mock_fetch):
|
|
15
|
+
mock_fetch.return_value = {
|
|
16
|
+
"Strict-Transport-Security": "max-age=31536000",
|
|
17
|
+
"X-Content-Type-Options": "nosniff",
|
|
18
|
+
"Referrer-Policy": "strict-origin",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
output = io.StringIO()
|
|
22
|
+
|
|
23
|
+
with patch(
|
|
24
|
+
"sys.argv",
|
|
25
|
+
[
|
|
26
|
+
"argus-guard",
|
|
27
|
+
"headers",
|
|
28
|
+
"https://example.com",
|
|
29
|
+
"--json",
|
|
30
|
+
],
|
|
31
|
+
):
|
|
32
|
+
with redirect_stdout(output):
|
|
33
|
+
exit_code = main()
|
|
34
|
+
|
|
35
|
+
report = json.loads(output.getvalue())
|
|
36
|
+
|
|
37
|
+
self.assertEqual(exit_code, 0)
|
|
38
|
+
|
|
39
|
+
self.assertEqual(
|
|
40
|
+
report["target"],
|
|
41
|
+
"https://example.com",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
self.assertEqual(
|
|
45
|
+
report["header_coverage_percent"],
|
|
46
|
+
75.0,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
self.assertFalse(
|
|
50
|
+
report["checks"]["content-security-policy"]
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
@patch("argus_guard.cli.fetch_response_headers")
|
|
54
|
+
def test_fail_on_missing_header(self, mock_fetch):
|
|
55
|
+
mock_fetch.return_value = {
|
|
56
|
+
"Strict-Transport-Security": "max-age=31536000",
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
with patch(
|
|
60
|
+
"sys.argv",
|
|
61
|
+
[
|
|
62
|
+
"argus-guard",
|
|
63
|
+
"headers",
|
|
64
|
+
"https://example.com",
|
|
65
|
+
"--fail-on-missing",
|
|
66
|
+
],
|
|
67
|
+
):
|
|
68
|
+
with redirect_stdout(io.StringIO()):
|
|
69
|
+
exit_code = main()
|
|
70
|
+
|
|
71
|
+
self.assertEqual(exit_code, 1)
|
|
72
|
+
|
|
73
|
+
@patch("argus_guard.cli.fetch_response_headers")
|
|
74
|
+
def test_invalid_url_returns_error(self, mock_fetch):
|
|
75
|
+
mock_fetch.side_effect = ValueError(
|
|
76
|
+
"Only HTTPS URLs are supported."
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
with patch(
|
|
80
|
+
"sys.argv",
|
|
81
|
+
[
|
|
82
|
+
"argus-guard",
|
|
83
|
+
"headers",
|
|
84
|
+
"http://example.com",
|
|
85
|
+
],
|
|
86
|
+
):
|
|
87
|
+
with redirect_stderr(io.StringIO()):
|
|
88
|
+
exit_code = main()
|
|
89
|
+
|
|
90
|
+
self.assertEqual(exit_code, 2)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
unittest.main()
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from unittest.mock import MagicMock, patch
|
|
3
|
+
from urllib.error import URLError
|
|
4
|
+
|
|
5
|
+
from argus_guard.http_client import (
|
|
6
|
+
HeaderFetchError,
|
|
7
|
+
fetch_response_headers,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestHTTPClient(unittest.TestCase):
|
|
12
|
+
|
|
13
|
+
def test_rejects_http_urls(self):
|
|
14
|
+
with self.assertRaises(ValueError):
|
|
15
|
+
fetch_response_headers("http://example.com")
|
|
16
|
+
|
|
17
|
+
def test_rejects_urls_with_credentials(self):
|
|
18
|
+
with self.assertRaises(ValueError):
|
|
19
|
+
fetch_response_headers(
|
|
20
|
+
"https://user:password@example.com"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def test_rejects_invalid_timeout(self):
|
|
24
|
+
with self.assertRaises(ValueError):
|
|
25
|
+
fetch_response_headers(
|
|
26
|
+
"https://example.com",
|
|
27
|
+
timeout=0,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
@patch("argus_guard.http_client.build_opener")
|
|
31
|
+
def test_fetches_response_headers(self, mock_build_opener):
|
|
32
|
+
response = MagicMock()
|
|
33
|
+
|
|
34
|
+
response.headers.items.return_value = [
|
|
35
|
+
("Strict-Transport-Security", "max-age=31536000"),
|
|
36
|
+
("Content-Security-Policy", "default-src 'self'"),
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
response.__enter__.return_value = response
|
|
40
|
+
|
|
41
|
+
mock_build_opener.return_value.open.return_value = response
|
|
42
|
+
|
|
43
|
+
headers = fetch_response_headers(
|
|
44
|
+
"https://example.com"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
self.assertEqual(
|
|
48
|
+
headers["Strict-Transport-Security"],
|
|
49
|
+
"max-age=31536000",
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
self.assertEqual(
|
|
53
|
+
headers["Content-Security-Policy"],
|
|
54
|
+
"default-src 'self'",
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
@patch("argus_guard.http_client.build_opener")
|
|
58
|
+
def test_network_failure(self, mock_build_opener):
|
|
59
|
+
mock_build_opener.return_value.open.side_effect = (
|
|
60
|
+
URLError("Connection failed")
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
with self.assertRaises(HeaderFetchError):
|
|
64
|
+
fetch_response_headers(
|
|
65
|
+
"https://example.com"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
unittest.main()
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ARGUS — Security Headers Tests
|
|
3
|
+
==============================
|
|
4
|
+
|
|
5
|
+
Unit tests for HTTP security header analysis.
|
|
6
|
+
|
|
7
|
+
Author: Irena Popova
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import unittest
|
|
11
|
+
|
|
12
|
+
from argus_guard.security_headers import (
|
|
13
|
+
audit_security_headers,
|
|
14
|
+
calculate_header_coverage,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TestSecurityHeaders(unittest.TestCase):
|
|
19
|
+
|
|
20
|
+
def test_all_headers_present(self):
|
|
21
|
+
"""Verify detection when all headers are present."""
|
|
22
|
+
|
|
23
|
+
headers = {
|
|
24
|
+
"Strict-Transport-Security": "max-age=31536000",
|
|
25
|
+
"Content-Security-Policy": "default-src 'self'",
|
|
26
|
+
"X-Content-Type-Options": "nosniff",
|
|
27
|
+
"Referrer-Policy": "strict-origin",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
results = audit_security_headers(headers)
|
|
31
|
+
|
|
32
|
+
self.assertTrue(all(results.values()))
|
|
33
|
+
|
|
34
|
+
self.assertEqual(
|
|
35
|
+
calculate_header_coverage(results),
|
|
36
|
+
100.0,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def test_missing_headers(self):
|
|
40
|
+
"""Verify detection of missing security headers."""
|
|
41
|
+
|
|
42
|
+
headers = {
|
|
43
|
+
"Content-Security-Policy": "default-src 'self'",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
results = audit_security_headers(headers)
|
|
47
|
+
|
|
48
|
+
self.assertFalse(
|
|
49
|
+
results["strict-transport-security"]
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
self.assertFalse(
|
|
53
|
+
results["x-content-type-options"]
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
self.assertEqual(
|
|
57
|
+
calculate_header_coverage(results),
|
|
58
|
+
25.0,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def test_case_insensitive_headers(self):
|
|
62
|
+
"""HTTP header names must be case-insensitive."""
|
|
63
|
+
|
|
64
|
+
headers = {
|
|
65
|
+
"CONTENT-SECURITY-POLICY": "default-src 'self'",
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
results = audit_security_headers(headers)
|
|
69
|
+
|
|
70
|
+
self.assertTrue(
|
|
71
|
+
results["content-security-policy"]
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def test_empty_headers(self):
|
|
75
|
+
"""Verify handling of an empty HTTP header collection."""
|
|
76
|
+
|
|
77
|
+
results = audit_security_headers({})
|
|
78
|
+
|
|
79
|
+
self.assertFalse(any(results.values()))
|
|
80
|
+
|
|
81
|
+
self.assertEqual(
|
|
82
|
+
calculate_header_coverage(results),
|
|
83
|
+
0.0,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if __name__ == "__main__":
|
|
88
|
+
unittest.main()
|