driftsentry 0.1.0__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.
- driftsentry-0.1.0/.driftsentry.yaml.example +71 -0
- driftsentry-0.1.0/.github/workflows/ci.yml +70 -0
- driftsentry-0.1.0/.github/workflows/release.yml +81 -0
- driftsentry-0.1.0/.gitignore +60 -0
- driftsentry-0.1.0/CONTRIBUTING.md +89 -0
- driftsentry-0.1.0/Dockerfile +35 -0
- driftsentry-0.1.0/LICENSE +190 -0
- driftsentry-0.1.0/Makefile +49 -0
- driftsentry-0.1.0/PKG-INFO +502 -0
- driftsentry-0.1.0/README.md +457 -0
- driftsentry-0.1.0/pyproject.toml +107 -0
- driftsentry-0.1.0/src/driftsentry/__init__.py +8 -0
- driftsentry-0.1.0/src/driftsentry/attribution/__init__.py +1 -0
- driftsentry-0.1.0/src/driftsentry/attribution/cloudtrail.py +260 -0
- driftsentry-0.1.0/src/driftsentry/cli/__init__.py +1 -0
- driftsentry-0.1.0/src/driftsentry/cli/main.py +54 -0
- driftsentry-0.1.0/src/driftsentry/cli/remediate.py +195 -0
- driftsentry-0.1.0/src/driftsentry/cli/report.py +113 -0
- driftsentry-0.1.0/src/driftsentry/cli/scan.py +218 -0
- driftsentry-0.1.0/src/driftsentry/core/__init__.py +1 -0
- driftsentry-0.1.0/src/driftsentry/core/config.py +214 -0
- driftsentry-0.1.0/src/driftsentry/core/differ.py +286 -0
- driftsentry-0.1.0/src/driftsentry/core/models.py +257 -0
- driftsentry-0.1.0/src/driftsentry/core/scanner.py +321 -0
- driftsentry-0.1.0/src/driftsentry/notifications/__init__.py +1 -0
- driftsentry-0.1.0/src/driftsentry/notifications/slack.py +109 -0
- driftsentry-0.1.0/src/driftsentry/notifications/stdout.py +27 -0
- driftsentry-0.1.0/src/driftsentry/output/__init__.py +8 -0
- driftsentry-0.1.0/src/driftsentry/output/html.py +277 -0
- driftsentry-0.1.0/src/driftsentry/output/json_fmt.py +39 -0
- driftsentry-0.1.0/src/driftsentry/output/markdown.py +120 -0
- driftsentry-0.1.0/src/driftsentry/output/table.py +196 -0
- driftsentry-0.1.0/src/driftsentry/policy/__init__.py +1 -0
- driftsentry-0.1.0/src/driftsentry/policy/engine.py +160 -0
- driftsentry-0.1.0/src/driftsentry/policy/rules.py +112 -0
- driftsentry-0.1.0/src/driftsentry/providers/__init__.py +5 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/__init__.py +5 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/mapping.py +216 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/provider.py +134 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/resources/__init__.py +17 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/resources/ec2.py +301 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/resources/ecs.py +166 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/resources/iam.py +214 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/resources/lambda_fn.py +85 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/resources/rds.py +97 -0
- driftsentry-0.1.0/src/driftsentry/providers/aws/resources/s3.py +153 -0
- driftsentry-0.1.0/src/driftsentry/providers/base.py +110 -0
- driftsentry-0.1.0/src/driftsentry/remediation/__init__.py +1 -0
- driftsentry-0.1.0/src/driftsentry/remediation/generator.py +312 -0
- driftsentry-0.1.0/src/driftsentry/remediation/pr_creator.py +124 -0
- driftsentry-0.1.0/src/driftsentry/remediation/templates/import_block.tf.j2 +5 -0
- driftsentry-0.1.0/src/driftsentry/remediation/templates/pr_body.md.j2 +22 -0
- driftsentry-0.1.0/src/driftsentry/remediation/templates/resource_block.tf.j2 +6 -0
- driftsentry-0.1.0/src/driftsentry/state/__init__.py +13 -0
- driftsentry-0.1.0/src/driftsentry/state/base.py +51 -0
- driftsentry-0.1.0/src/driftsentry/state/factory.py +48 -0
- driftsentry-0.1.0/src/driftsentry/state/local.py +137 -0
- driftsentry-0.1.0/src/driftsentry/state/s3.py +109 -0
- driftsentry-0.1.0/tests/conftest.py +84 -0
- driftsentry-0.1.0/tests/fixtures/sample_state.tfstate +170 -0
- driftsentry-0.1.0/tests/unit/test_cli.py +86 -0
- driftsentry-0.1.0/tests/unit/test_differ.py +121 -0
- driftsentry-0.1.0/tests/unit/test_policy.py +117 -0
- driftsentry-0.1.0/tests/unit/test_remediation.py +135 -0
- driftsentry-0.1.0/tests/unit/test_scanner.py +134 -0
- driftsentry-0.1.0/tests/unit/test_state_reader.py +83 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# ══════════════════════════════════════════════════════════════════
|
|
2
|
+
# DriftSentry Configuration Template (.driftsentry.yaml)
|
|
3
|
+
# ══════════════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
# Infrastructure-as-Code tool: terraform or opentofu
|
|
6
|
+
iac_tool: "terraform"
|
|
7
|
+
|
|
8
|
+
# State backend configuration
|
|
9
|
+
state:
|
|
10
|
+
# Backend type: local or s3
|
|
11
|
+
backend: "local"
|
|
12
|
+
# Path for local backend
|
|
13
|
+
path: "./terraform.tfstate"
|
|
14
|
+
# S3 backend options (when backend is "s3"):
|
|
15
|
+
# s3_bucket: "my-company-terraform-state"
|
|
16
|
+
# s3_key: "production/terraform.tfstate"
|
|
17
|
+
# s3_region: "us-east-1"
|
|
18
|
+
|
|
19
|
+
# Cloud provider configuration
|
|
20
|
+
provider:
|
|
21
|
+
name: "aws"
|
|
22
|
+
region: "us-east-1"
|
|
23
|
+
# profile: "production"
|
|
24
|
+
# role_arn: "arn:aws:iam::123456789012:role/DriftSentryScanRole"
|
|
25
|
+
|
|
26
|
+
# Drift attribution (uses AWS CloudTrail)
|
|
27
|
+
attribution:
|
|
28
|
+
enabled: true
|
|
29
|
+
lookback_hours: 168 # 7 days
|
|
30
|
+
|
|
31
|
+
# Policy evaluation
|
|
32
|
+
policy:
|
|
33
|
+
enabled: true
|
|
34
|
+
# policy_file: "./driftsentry-policy.yaml"
|
|
35
|
+
fail_on_critical: true
|
|
36
|
+
|
|
37
|
+
# Auto-remediation configuration
|
|
38
|
+
remediation:
|
|
39
|
+
# Mode: "import" (unmanaged resources), "revert" (changed resources), or "both"
|
|
40
|
+
mode: "both"
|
|
41
|
+
output_dir: "./driftsentry-remediation"
|
|
42
|
+
create_pr: false
|
|
43
|
+
# github_repo: "myorg/infrastructure"
|
|
44
|
+
# github_token: "${GITHUB_TOKEN}"
|
|
45
|
+
# pr_base_branch: "main"
|
|
46
|
+
dry_run: false
|
|
47
|
+
|
|
48
|
+
# Notification settings
|
|
49
|
+
notifications:
|
|
50
|
+
# slack_webhook_url: "${DRIFTSENTRY_SLACK_WEBHOOK}"
|
|
51
|
+
notify_on:
|
|
52
|
+
- "critical"
|
|
53
|
+
- "high"
|
|
54
|
+
|
|
55
|
+
# Scan filtering and noise reduction
|
|
56
|
+
filters:
|
|
57
|
+
# Only scan specific resource types (empty = all supported)
|
|
58
|
+
include_types: []
|
|
59
|
+
# Exclude specific resource types
|
|
60
|
+
exclude_types: []
|
|
61
|
+
# Attributes to ignore during diff (noise reduction)
|
|
62
|
+
ignore_attributes:
|
|
63
|
+
- "tags_all"
|
|
64
|
+
- "arn"
|
|
65
|
+
- "id"
|
|
66
|
+
- "owner_id"
|
|
67
|
+
- "unique_id"
|
|
68
|
+
- "create_date"
|
|
69
|
+
- "last_modified"
|
|
70
|
+
# Unmanaged resource types to skip
|
|
71
|
+
ignore_unmanaged_types: []
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: Lint & Format Check
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
cache: "pip"
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
pip install ruff mypy
|
|
26
|
+
pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Run Ruff Linter
|
|
29
|
+
run: ruff check src/ tests/
|
|
30
|
+
|
|
31
|
+
- name: Run Ruff Format Check
|
|
32
|
+
run: ruff format --check src/ tests/
|
|
33
|
+
|
|
34
|
+
- name: Run MyPy Type Checker
|
|
35
|
+
run: mypy src/driftsentry/
|
|
36
|
+
|
|
37
|
+
test:
|
|
38
|
+
name: Test (${{ matrix.python-version }})
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
strategy:
|
|
41
|
+
fail-fast: false
|
|
42
|
+
matrix:
|
|
43
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
44
|
+
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
|
|
48
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
49
|
+
uses: actions/setup-python@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: ${{ matrix.python-version }}
|
|
52
|
+
cache: "pip"
|
|
53
|
+
|
|
54
|
+
- name: Install dependencies
|
|
55
|
+
run: |
|
|
56
|
+
python -m pip install --upgrade pip
|
|
57
|
+
pip install -e ".[dev]"
|
|
58
|
+
|
|
59
|
+
- name: Run Pytest
|
|
60
|
+
run: |
|
|
61
|
+
pytest tests/ -v --tb=short --cov=driftsentry --cov-report=xml
|
|
62
|
+
|
|
63
|
+
- name: Upload coverage to Codecov
|
|
64
|
+
uses: codecov/codecov-action@v4
|
|
65
|
+
if: matrix.python-version == '3.12'
|
|
66
|
+
with:
|
|
67
|
+
file: ./coverage.xml
|
|
68
|
+
fail_ci_if_error: false
|
|
69
|
+
env:
|
|
70
|
+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: Release & Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
name: Build Wheel & Publish to PyPI
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
contents: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
|
|
24
|
+
- name: Install build tools
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install build twine
|
|
28
|
+
|
|
29
|
+
- name: Build sdist and wheel
|
|
30
|
+
run: python -m build
|
|
31
|
+
|
|
32
|
+
- name: Create GitHub Release
|
|
33
|
+
uses: softprops/action-gh-release@v2
|
|
34
|
+
with:
|
|
35
|
+
files: dist/*
|
|
36
|
+
generate_release_notes: true
|
|
37
|
+
|
|
38
|
+
- name: Publish to PyPI
|
|
39
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
40
|
+
with:
|
|
41
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
42
|
+
|
|
43
|
+
docker-publish:
|
|
44
|
+
name: Build & Push Docker Image
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
permissions:
|
|
47
|
+
contents: read
|
|
48
|
+
packages: write
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
|
|
53
|
+
- name: Set up Docker Buildx
|
|
54
|
+
uses: docker/setup-buildx-action@v3
|
|
55
|
+
|
|
56
|
+
- name: Log in to GitHub Container Registry
|
|
57
|
+
uses: docker/login-action@v3
|
|
58
|
+
with:
|
|
59
|
+
registry: ghcr.io
|
|
60
|
+
username: ${{ github.actor }}
|
|
61
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
62
|
+
|
|
63
|
+
- name: Extract metadata
|
|
64
|
+
id: meta
|
|
65
|
+
uses: docker/metadata-action@v5
|
|
66
|
+
with:
|
|
67
|
+
images: ghcr.io/${{ github.repository }}
|
|
68
|
+
tags: |
|
|
69
|
+
type=semver,pattern={{version}}
|
|
70
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
71
|
+
type=raw,value=latest
|
|
72
|
+
|
|
73
|
+
- name: Build and push
|
|
74
|
+
uses: docker/build-push-action@v5
|
|
75
|
+
with:
|
|
76
|
+
context: .
|
|
77
|
+
push: true
|
|
78
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
79
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
80
|
+
cache-from: type=gha
|
|
81
|
+
cache-to: type=gha,mode=max
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
eggs/
|
|
11
|
+
*.whl
|
|
12
|
+
.eggs/
|
|
13
|
+
|
|
14
|
+
# Virtual environments
|
|
15
|
+
.venv/
|
|
16
|
+
venv/
|
|
17
|
+
ENV/
|
|
18
|
+
|
|
19
|
+
# IDE
|
|
20
|
+
.idea/
|
|
21
|
+
.vscode/
|
|
22
|
+
*.swp
|
|
23
|
+
*.swo
|
|
24
|
+
*~
|
|
25
|
+
|
|
26
|
+
# Testing / Coverage
|
|
27
|
+
.pytest_cache/
|
|
28
|
+
htmlcov/
|
|
29
|
+
.coverage
|
|
30
|
+
.coverage.*
|
|
31
|
+
coverage.xml
|
|
32
|
+
*.cover
|
|
33
|
+
|
|
34
|
+
# Type checking
|
|
35
|
+
.mypy_cache/
|
|
36
|
+
.dmypy.json
|
|
37
|
+
dmypy.json
|
|
38
|
+
|
|
39
|
+
# Linting
|
|
40
|
+
.ruff_cache/
|
|
41
|
+
|
|
42
|
+
# OS
|
|
43
|
+
.DS_Store
|
|
44
|
+
Thumbs.db
|
|
45
|
+
|
|
46
|
+
# Terraform state (test fixtures are tracked)
|
|
47
|
+
*.tfstate
|
|
48
|
+
*.tfstate.backup
|
|
49
|
+
!tests/fixtures/*.tfstate
|
|
50
|
+
|
|
51
|
+
# Environment
|
|
52
|
+
.env
|
|
53
|
+
.env.local
|
|
54
|
+
|
|
55
|
+
# Docker
|
|
56
|
+
.docker/
|
|
57
|
+
|
|
58
|
+
# Secrets
|
|
59
|
+
*.pem
|
|
60
|
+
*.key
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Contributing to DriftSentry
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to **DriftSentry**! We welcome bug reports, feature requests, documentation improvements, and code contributions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🛠️ Development Setup
|
|
8
|
+
|
|
9
|
+
### Prerequisites
|
|
10
|
+
|
|
11
|
+
- Python 3.11, 3.12, or 3.13
|
|
12
|
+
- `git`
|
|
13
|
+
- `make` (optional, for convenience)
|
|
14
|
+
|
|
15
|
+
### Steps
|
|
16
|
+
|
|
17
|
+
1. **Fork and clone the repository:**
|
|
18
|
+
```bash
|
|
19
|
+
git clone https://github.com/your-username/driftsentry.git
|
|
20
|
+
cd driftsentry
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. **Create and activate a virtual environment:**
|
|
24
|
+
```bash
|
|
25
|
+
python3 -m venv .venv
|
|
26
|
+
source .venv/bin/activate
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **Install development dependencies:**
|
|
30
|
+
```bash
|
|
31
|
+
make dev
|
|
32
|
+
# or: pip install -e ".[dev]"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 🧪 Running Tests & Quality Checks
|
|
38
|
+
|
|
39
|
+
We use `pytest` for testing, `ruff` for linting and formatting, and `mypy` for static type checking:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Run all unit tests
|
|
43
|
+
make test
|
|
44
|
+
|
|
45
|
+
# Run tests with coverage
|
|
46
|
+
make test-cov
|
|
47
|
+
|
|
48
|
+
# Run linter and type checker
|
|
49
|
+
make lint
|
|
50
|
+
|
|
51
|
+
# Auto-format code
|
|
52
|
+
make format
|
|
53
|
+
|
|
54
|
+
# Run full CI check locally
|
|
55
|
+
make ci
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 🏗️ Adding Support for a New AWS Resource Type
|
|
61
|
+
|
|
62
|
+
To add support for a new AWS resource type (e.g. `aws_sqs_queue`):
|
|
63
|
+
|
|
64
|
+
1. **Add resource mapping** in `src/driftsentry/providers/aws/mapping.py`:
|
|
65
|
+
Define the Terraform type, AWS service, security-critical attributes, and noise attributes.
|
|
66
|
+
|
|
67
|
+
2. **Implement scanner or update existing scanner** in `src/driftsentry/providers/aws/resources/`:
|
|
68
|
+
Implement `list_all()`, `get_by_id()`, and `normalize()`.
|
|
69
|
+
|
|
70
|
+
3. **Register scanner** in `src/driftsentry/providers/aws/provider.py`.
|
|
71
|
+
|
|
72
|
+
4. **Add CloudTrail event mapping** in `src/driftsentry/attribution/cloudtrail.py`.
|
|
73
|
+
|
|
74
|
+
5. **Add unit tests** in `tests/unit/`.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 📜 Pull Request Guidelines
|
|
79
|
+
|
|
80
|
+
- Ensure all existing and new tests pass (`make ci`).
|
|
81
|
+
- Add tests for any new features or bug fixes.
|
|
82
|
+
- Follow PEP 8 and the project's formatting style (enforced by Ruff).
|
|
83
|
+
- Provide descriptive commit messages and PR summaries.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 📄 License
|
|
88
|
+
|
|
89
|
+
By contributing to DriftSentry, you agree that your contributions will be licensed under the [Apache License 2.0](LICENSE).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Multi-stage Dockerfile for DriftSentry
|
|
2
|
+
FROM python:3.12-slim AS builder
|
|
3
|
+
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
7
|
+
build-essential \
|
|
8
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
9
|
+
|
|
10
|
+
COPY pyproject.toml README.md ./
|
|
11
|
+
COPY src/ ./src/
|
|
12
|
+
|
|
13
|
+
RUN pip install --no-cache-dir --upgrade pip \
|
|
14
|
+
&& pip install --no-cache-dir build \
|
|
15
|
+
&& python -m build --wheel
|
|
16
|
+
|
|
17
|
+
# Final minimal runtime image
|
|
18
|
+
FROM python:3.12-slim AS runtime
|
|
19
|
+
|
|
20
|
+
WORKDIR /app
|
|
21
|
+
|
|
22
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
23
|
+
ca-certificates \
|
|
24
|
+
git \
|
|
25
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
26
|
+
|
|
27
|
+
COPY --from=builder /app/dist/*.whl /tmp/
|
|
28
|
+
RUN pip install --no-cache-dir /tmp/*.whl && rm -rf /tmp/*.whl
|
|
29
|
+
|
|
30
|
+
# Create non-root user
|
|
31
|
+
RUN useradd -m -u 1000 driftsentry
|
|
32
|
+
USER driftsentry
|
|
33
|
+
|
|
34
|
+
ENTRYPOINT ["driftsentry"]
|
|
35
|
+
CMD ["--help"]
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work.
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Hemanth KP
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.PHONY: install dev test lint format clean ci build publish
|
|
2
|
+
|
|
3
|
+
# ─── Development ─────────────────────────────────────────────
|
|
4
|
+
install:
|
|
5
|
+
pip install -e .
|
|
6
|
+
|
|
7
|
+
dev:
|
|
8
|
+
pip install -e ".[dev]"
|
|
9
|
+
|
|
10
|
+
# ─── Quality ─────────────────────────────────────────────────
|
|
11
|
+
lint:
|
|
12
|
+
ruff check src/ tests/
|
|
13
|
+
ruff format --check src/ tests/
|
|
14
|
+
mypy src/driftsentry/
|
|
15
|
+
|
|
16
|
+
format:
|
|
17
|
+
ruff check --fix src/ tests/
|
|
18
|
+
ruff format src/ tests/
|
|
19
|
+
|
|
20
|
+
# ─── Testing ─────────────────────────────────────────────────
|
|
21
|
+
test:
|
|
22
|
+
pytest tests/ -v --tb=short
|
|
23
|
+
|
|
24
|
+
test-cov:
|
|
25
|
+
pytest tests/ -v --tb=short --cov=driftsentry --cov-report=term-missing --cov-report=html
|
|
26
|
+
|
|
27
|
+
# ─── CI Pipeline ─────────────────────────────────────────────
|
|
28
|
+
ci: lint test
|
|
29
|
+
|
|
30
|
+
# ─── Build & Publish ─────────────────────────────────────────
|
|
31
|
+
build:
|
|
32
|
+
python -m build
|
|
33
|
+
|
|
34
|
+
publish: build
|
|
35
|
+
twine upload dist/*
|
|
36
|
+
|
|
37
|
+
# ─── Docker ──────────────────────────────────────────────────
|
|
38
|
+
docker-build:
|
|
39
|
+
docker build -t driftsentry:latest .
|
|
40
|
+
|
|
41
|
+
docker-run:
|
|
42
|
+
docker run --rm -v ~/.aws:/root/.aws:ro driftsentry:latest scan --help
|
|
43
|
+
|
|
44
|
+
# ─── Cleanup ─────────────────────────────────────────────────
|
|
45
|
+
clean:
|
|
46
|
+
rm -rf dist/ build/ *.egg-info src/*.egg-info
|
|
47
|
+
rm -rf .pytest_cache .mypy_cache .ruff_cache htmlcov/
|
|
48
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
49
|
+
find . -type f -name "*.pyc" -delete 2>/dev/null || true
|