infralens-mcp 0.2.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.
- infralens_mcp-0.2.0/.dockerignore +13 -0
- infralens_mcp-0.2.0/.github/CODEOWNERS +1 -0
- infralens_mcp-0.2.0/.github/FUNDING.yml +1 -0
- infralens_mcp-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +14 -0
- infralens_mcp-0.2.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
- infralens_mcp-0.2.0/.github/ISSUE_TEMPLATE/new_provider.yml +14 -0
- infralens_mcp-0.2.0/.github/dependabot.yml +17 -0
- infralens_mcp-0.2.0/.github/pull_request_template.md +9 -0
- infralens_mcp-0.2.0/.github/workflows/ci.yml +135 -0
- infralens_mcp-0.2.0/.github/workflows/codeql.yml +28 -0
- infralens_mcp-0.2.0/.github/workflows/daily-scan.yml +49 -0
- infralens_mcp-0.2.0/.github/workflows/release.yml +79 -0
- infralens_mcp-0.2.0/.gitignore +14 -0
- infralens_mcp-0.2.0/.trivyignore +7 -0
- infralens_mcp-0.2.0/CHANGELOG.md +28 -0
- infralens_mcp-0.2.0/CONTRIBUTING.md +32 -0
- infralens_mcp-0.2.0/Dockerfile +13 -0
- infralens_mcp-0.2.0/Dockerfile.lambda +8 -0
- infralens_mcp-0.2.0/LICENSE +21 -0
- infralens_mcp-0.2.0/PKG-INFO +266 -0
- infralens_mcp-0.2.0/README.md +222 -0
- infralens_mcp-0.2.0/SECURITY.md +29 -0
- infralens_mcp-0.2.0/demo/infralens.demo.yaml +9 -0
- infralens_mcp-0.2.0/demo/k8s/broken-shop.yaml +200 -0
- infralens_mcp-0.2.0/demo/k8s/make-it-interesting.sh +10 -0
- infralens_mcp-0.2.0/demo/k8s/verify.py +67 -0
- infralens_mcp-0.2.0/demo/mcp_client_demo.py +47 -0
- infralens_mcp-0.2.0/demo/push_errors.py +15 -0
- infralens_mcp-0.2.0/demo/sandbox-tofu/main.tf +59 -0
- infralens_mcp-0.2.0/demo/seed_aws.py +80 -0
- infralens_mcp-0.2.0/deploy/aws/README.md +48 -0
- infralens_mcp-0.2.0/deploy/aws/main.tf +272 -0
- infralens_mcp-0.2.0/deploy/aws/outputs.tf +22 -0
- infralens_mcp-0.2.0/deploy/aws/variables.tf +69 -0
- infralens_mcp-0.2.0/deploy/kubernetes/rbac.yaml +44 -0
- infralens_mcp-0.2.0/docker-compose.yml +40 -0
- infralens_mcp-0.2.0/docs/images/architecture.png +0 -0
- infralens_mcp-0.2.0/docs/images/daily-discoveries.png +0 -0
- infralens_mcp-0.2.0/docs/images/linkedin-hero.png +0 -0
- infralens_mcp-0.2.0/docs/images/mcp-scan.png +0 -0
- infralens_mcp-0.2.0/docs/images/render.py +211 -0
- infralens_mcp-0.2.0/docs/images/social-preview.png +0 -0
- infralens_mcp-0.2.0/docs/linkedin-post.md +39 -0
- infralens_mcp-0.2.0/docs/sample-report.md +52 -0
- infralens_mcp-0.2.0/docs/use-cases.md +30 -0
- infralens_mcp-0.2.0/infralens.example.yaml +44 -0
- infralens_mcp-0.2.0/pyproject.toml +60 -0
- infralens_mcp-0.2.0/src/infralens/__init__.py +3 -0
- infralens_mcp-0.2.0/src/infralens/agent.py +86 -0
- infralens_mcp-0.2.0/src/infralens/cli.py +96 -0
- infralens_mcp-0.2.0/src/infralens/engine.py +151 -0
- infralens_mcp-0.2.0/src/infralens/lambda_handler.py +65 -0
- infralens_mcp-0.2.0/src/infralens/mcp_server.py +245 -0
- infralens_mcp-0.2.0/src/infralens/models.py +108 -0
- infralens_mcp-0.2.0/src/infralens/policy.py +77 -0
- infralens_mcp-0.2.0/src/infralens/providers/__init__.py +40 -0
- infralens_mcp-0.2.0/src/infralens/providers/aws.py +408 -0
- infralens_mcp-0.2.0/src/infralens/providers/azure.py +129 -0
- infralens_mcp-0.2.0/src/infralens/providers/base.py +46 -0
- infralens_mcp-0.2.0/src/infralens/providers/kubernetes.py +315 -0
- infralens_mcp-0.2.0/src/infralens/providers/mock.py +139 -0
- infralens_mcp-0.2.0/src/infralens/providers/pricing.py +43 -0
- infralens_mcp-0.2.0/src/infralens/report.py +83 -0
- infralens_mcp-0.2.0/src/infralens/safety.py +78 -0
- infralens_mcp-0.2.0/src/infralens/store.py +155 -0
- infralens_mcp-0.2.0/tests/conftest.py +16 -0
- infralens_mcp-0.2.0/tests/test_agent.py +37 -0
- infralens_mcp-0.2.0/tests/test_aws.py +183 -0
- infralens_mcp-0.2.0/tests/test_azure.py +82 -0
- infralens_mcp-0.2.0/tests/test_core.py +154 -0
- infralens_mcp-0.2.0/tests/test_kubernetes.py +178 -0
- infralens_mcp-0.2.0/tests/test_lambda.py +26 -0
- infralens_mcp-0.2.0/tests/test_mcp.py +120 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @balakrishnagatla
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: [balakrishnagatla]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: Bug report
|
|
2
|
+
description: Something isn't working as expected
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: what
|
|
7
|
+
attributes: { label: What happened?, description: Include the command and output (remove any secrets). }
|
|
8
|
+
validations: { required: true }
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: expected
|
|
11
|
+
attributes: { label: What did you expect? }
|
|
12
|
+
- type: input
|
|
13
|
+
id: version
|
|
14
|
+
attributes: { label: infralens version / cloud / MCP client, placeholder: "0.1.0 · aws · Claude Desktop" }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: New cloud provider or check
|
|
2
|
+
description: Propose a provider (GCP, Kubernetes, ...) or a new discovery check
|
|
3
|
+
labels: [enhancement, provider]
|
|
4
|
+
body:
|
|
5
|
+
- type: input
|
|
6
|
+
id: cloud
|
|
7
|
+
attributes: { label: Cloud / platform, placeholder: GCP }
|
|
8
|
+
validations: { required: true }
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: checks
|
|
11
|
+
attributes:
|
|
12
|
+
label: Discoveries it should surface
|
|
13
|
+
description: Cost savings opportunities, reliability alerts or ownership gaps. Which read-only APIs would it use?
|
|
14
|
+
validations: { required: true }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: pip
|
|
4
|
+
directory: /
|
|
5
|
+
schedule: { interval: weekly }
|
|
6
|
+
groups:
|
|
7
|
+
python:
|
|
8
|
+
patterns: ["*"]
|
|
9
|
+
- package-ecosystem: github-actions
|
|
10
|
+
directory: /
|
|
11
|
+
schedule: { interval: weekly }
|
|
12
|
+
groups:
|
|
13
|
+
actions:
|
|
14
|
+
patterns: ["*"]
|
|
15
|
+
- package-ecosystem: docker
|
|
16
|
+
directory: /
|
|
17
|
+
schedule: { interval: weekly }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## What changed
|
|
2
|
+
|
|
3
|
+
## Why
|
|
4
|
+
|
|
5
|
+
## Checklist
|
|
6
|
+
- [ ] Read-only: no new write/delete calls against any cloud API
|
|
7
|
+
- [ ] Secrets stay masked (evidence, logs, LLM prompts)
|
|
8
|
+
- [ ] Tests added or updated (`pytest -q`), `ruff check` clean
|
|
9
|
+
- [ ] Docs / README updated if behaviour changed
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python: ["3.11", "3.12", "3.13"]
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
|
+
- uses: actions/setup-python@v7
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python }}
|
|
22
|
+
- run: pip install -e ".[aws,dev]"
|
|
23
|
+
- run: ruff check src tests demo
|
|
24
|
+
- run: pytest -q
|
|
25
|
+
|
|
26
|
+
security:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v7
|
|
30
|
+
- uses: actions/setup-python@v7
|
|
31
|
+
with:
|
|
32
|
+
python-version: "3.12"
|
|
33
|
+
- run: pip install -e ".[aws,ai]" bandit pip-audit
|
|
34
|
+
- name: Bandit (static security analysis)
|
|
35
|
+
run: bandit -q -r src -ll
|
|
36
|
+
- name: pip-audit (known vulnerable dependencies)
|
|
37
|
+
run: pip-audit --skip-editable
|
|
38
|
+
- name: Trivy (IaC misconfiguration + secrets)
|
|
39
|
+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
40
|
+
with:
|
|
41
|
+
scan-type: fs
|
|
42
|
+
scanners: misconfig,secret
|
|
43
|
+
severity: HIGH,CRITICAL
|
|
44
|
+
exit-code: "1"
|
|
45
|
+
|
|
46
|
+
lambda-image:
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v7
|
|
50
|
+
- name: Build the watch-mode Lambda image
|
|
51
|
+
run: docker build -f Dockerfile.lambda -t infralens-lambda .
|
|
52
|
+
- name: Invoke the handler through the Lambda runtime emulator (demo provider, no cloud)
|
|
53
|
+
run: |
|
|
54
|
+
docker run -d --name lambda -p 9000:8080 -e INFRALENS_PROVIDERS=mock infralens-lambda
|
|
55
|
+
for i in $(seq 1 20); do
|
|
56
|
+
out=$(curl -sf -X POST localhost:9000/2015-03-31/functions/function/invocations -d '{}') && break
|
|
57
|
+
sleep 2
|
|
58
|
+
done
|
|
59
|
+
echo "$out"
|
|
60
|
+
echo "$out" | grep -q '"ok": true'
|
|
61
|
+
- name: Trivy (Lambda image vulnerabilities)
|
|
62
|
+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
63
|
+
with:
|
|
64
|
+
image-ref: infralens-lambda
|
|
65
|
+
severity: CRITICAL
|
|
66
|
+
ignore-unfixed: true
|
|
67
|
+
exit-code: "1"
|
|
68
|
+
- if: always()
|
|
69
|
+
run: docker logs lambda 2>&1 | tail -50 || true
|
|
70
|
+
|
|
71
|
+
k8s-e2e:
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v7
|
|
75
|
+
- uses: actions/setup-python@v7
|
|
76
|
+
with:
|
|
77
|
+
python-version: "3.12"
|
|
78
|
+
- uses: helm/kind-action@ea822c7bf1874f08e5a491df991c228edffc3376 # v1.15.2
|
|
79
|
+
with:
|
|
80
|
+
cluster_name: infralens
|
|
81
|
+
- run: pip install -e ".[k8s]"
|
|
82
|
+
- name: Deploy the deliberately broken demo namespace
|
|
83
|
+
run: |
|
|
84
|
+
kubectl apply -f demo/k8s/broken-shop.yaml
|
|
85
|
+
./demo/k8s/make-it-interesting.sh
|
|
86
|
+
- name: Run infralens with the read-only RBAC role only
|
|
87
|
+
run: |
|
|
88
|
+
kubectl apply -f deploy/kubernetes/rbac.yaml
|
|
89
|
+
TOKEN=$(kubectl -n infralens create token infralens --duration=30m)
|
|
90
|
+
SERVER=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
|
|
91
|
+
kubectl config view --minify --raw -o jsonpath='{.clusters[0].cluster.certificate-authority-data}' \
|
|
92
|
+
| base64 -d > /tmp/ca.crt
|
|
93
|
+
export KUBECONFIG=/tmp/infralens-readonly.kubeconfig
|
|
94
|
+
kubectl config set-cluster kind --server="$SERVER" --certificate-authority=/tmp/ca.crt --embed-certs=true
|
|
95
|
+
kubectl config set-credentials infralens --token="$TOKEN"
|
|
96
|
+
kubectl config set-context ro --cluster=kind --user=infralens && kubectl config use-context ro
|
|
97
|
+
if kubectl -n shop delete pod --all --dry-run=server 2>/dev/null; then
|
|
98
|
+
echo "RBAC is not read-only"; exit 1
|
|
99
|
+
fi
|
|
100
|
+
python demo/k8s/verify.py
|
|
101
|
+
|
|
102
|
+
opentofu:
|
|
103
|
+
runs-on: ubuntu-latest
|
|
104
|
+
strategy:
|
|
105
|
+
matrix:
|
|
106
|
+
dir: [deploy/aws, demo/sandbox-tofu]
|
|
107
|
+
steps:
|
|
108
|
+
- uses: actions/checkout@v7
|
|
109
|
+
- uses: opentofu/setup-opentofu@a1320f892987e89d278cc92dc5adc984fb93aca4 # v2.0.2
|
|
110
|
+
- run: tofu fmt -check -recursive
|
|
111
|
+
working-directory: ${{ matrix.dir }}
|
|
112
|
+
- run: tofu init -backend=false -input=false && tofu validate
|
|
113
|
+
working-directory: ${{ matrix.dir }}
|
|
114
|
+
|
|
115
|
+
docker-e2e:
|
|
116
|
+
runs-on: ubuntu-latest
|
|
117
|
+
steps:
|
|
118
|
+
- uses: actions/checkout@v7
|
|
119
|
+
- name: Build and start the zero-cloud demo (simulated AWS -> seed -> MCP server)
|
|
120
|
+
run: docker compose up -d --build --wait infralens
|
|
121
|
+
- uses: actions/setup-python@v7
|
|
122
|
+
with:
|
|
123
|
+
python-version: "3.12"
|
|
124
|
+
- run: pip install "mcp>=2" anyio
|
|
125
|
+
- name: Trivy (container image vulnerabilities)
|
|
126
|
+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
127
|
+
with:
|
|
128
|
+
image-ref: infralens-infralens
|
|
129
|
+
severity: CRITICAL
|
|
130
|
+
ignore-unfixed: true
|
|
131
|
+
exit-code: "1"
|
|
132
|
+
- name: Call the MCP server like an AI client would
|
|
133
|
+
run: python demo/mcp_client_demo.py http://localhost:8080/mcp change-me-local-demo
|
|
134
|
+
- if: always()
|
|
135
|
+
run: docker compose logs --no-color | tail -100
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: codeql
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: "17 9 * * 1"
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
analyze:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
security-events: write
|
|
18
|
+
contents: read
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
language: [python, actions]
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
|
+
- uses: github/codeql-action/init@v4
|
|
25
|
+
with:
|
|
26
|
+
languages: ${{ matrix.language }}
|
|
27
|
+
queries: security-and-quality
|
|
28
|
+
- uses: github/codeql-action/analyze@v4
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Optional: run watch mode from GitHub Actions instead of Lambda.
|
|
2
|
+
# Uses GitHub OIDC -> a read-only AWS role (no long-lived keys). Opens the report as an issue.
|
|
3
|
+
name: infralens daily scan
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
schedule:
|
|
7
|
+
- cron: "0 13 * * 1-5" # 07:00 US Central, weekdays
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write
|
|
12
|
+
contents: read
|
|
13
|
+
issues: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
scan:
|
|
17
|
+
if: vars.INFRALENS_AWS_ROLE_ARN != ''
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v7
|
|
21
|
+
- uses: actions/setup-python@v7
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
- run: pip install ".[aws,ai]"
|
|
25
|
+
- name: Restore discovery history (lifecycle + cost savings tracking)
|
|
26
|
+
uses: actions/cache@v6
|
|
27
|
+
with:
|
|
28
|
+
path: .infralens-state
|
|
29
|
+
key: infralens-state-${{ github.run_id }}
|
|
30
|
+
restore-keys: infralens-state-
|
|
31
|
+
- uses: aws-actions/configure-aws-credentials@45666896f5d8e0f10ae255413f3a4cdd03bdc8f5 # v6.3.1
|
|
32
|
+
with:
|
|
33
|
+
role-to-assume: ${{ vars.INFRALENS_AWS_ROLE_ARN }}
|
|
34
|
+
aws-region: ${{ vars.AWS_REGION || 'us-east-1' }}
|
|
35
|
+
- name: Scan and publish
|
|
36
|
+
env:
|
|
37
|
+
INFRALENS_DB: .infralens-state/state.db
|
|
38
|
+
INFRALENS_AUDIT_LOG: .infralens-state/audit.jsonl
|
|
39
|
+
INFRALENS_PROVIDERS: aws
|
|
40
|
+
INFRALENS_REGIONS: ${{ vars.AWS_REGION || 'us-east-1' }}
|
|
41
|
+
INFRALENS_MODEL: ${{ vars.INFRALENS_MODEL }}
|
|
42
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
43
|
+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
44
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
45
|
+
run: infralens daily --github-repo "${{ github.repository }}" --out report.md
|
|
46
|
+
- uses: actions/upload-artifact@v7
|
|
47
|
+
with:
|
|
48
|
+
name: infralens-report
|
|
49
|
+
path: report.md
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publishing a GitHub Release (tag vX.Y.Z) builds and tests the package, publishes it to PyPI with
|
|
4
|
+
# trusted publishing (no API token stored anywhere), and pushes a multi-arch image to GHCR.
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v7
|
|
17
|
+
- uses: actions/setup-python@v7
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
- name: Version in pyproject.toml matches the release tag
|
|
21
|
+
run: |
|
|
22
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
23
|
+
ver=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
24
|
+
[ "$tag" = "$ver" ] || { echo "::error::tag $GITHUB_REF_NAME != pyproject version $ver"; exit 1; }
|
|
25
|
+
- run: pip install -e ".[aws,k8s,dev]" build
|
|
26
|
+
- run: ruff check src tests demo && pytest -q
|
|
27
|
+
- run: python -m build
|
|
28
|
+
- uses: actions/upload-artifact@v7
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
|
|
33
|
+
pypi:
|
|
34
|
+
needs: build
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
environment:
|
|
37
|
+
name: pypi
|
|
38
|
+
url: https://pypi.org/project/infralens-mcp/
|
|
39
|
+
permissions:
|
|
40
|
+
id-token: write
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/download-artifact@v8
|
|
43
|
+
with:
|
|
44
|
+
name: dist
|
|
45
|
+
path: dist/
|
|
46
|
+
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
47
|
+
|
|
48
|
+
image:
|
|
49
|
+
needs: build
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
permissions:
|
|
52
|
+
contents: read
|
|
53
|
+
packages: write
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v7
|
|
56
|
+
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
|
|
57
|
+
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
58
|
+
- uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
59
|
+
with:
|
|
60
|
+
registry: ghcr.io
|
|
61
|
+
username: ${{ github.actor }}
|
|
62
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
63
|
+
- id: meta
|
|
64
|
+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
|
65
|
+
with:
|
|
66
|
+
images: ghcr.io/${{ github.repository }}
|
|
67
|
+
tags: |
|
|
68
|
+
type=semver,pattern={{version}}
|
|
69
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
70
|
+
type=raw,value=latest
|
|
71
|
+
- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
|
|
72
|
+
with:
|
|
73
|
+
context: .
|
|
74
|
+
platforms: linux/amd64,linux/arm64
|
|
75
|
+
push: true
|
|
76
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
77
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
78
|
+
provenance: true
|
|
79
|
+
sbom: true
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Accepted risks, reviewed 2026-11-29. Re-review when the data stored changes.
|
|
2
|
+
#
|
|
3
|
+
# AWS-0132: the S3 state bucket uses SSE-S3 (AES-256) instead of a customer-managed KMS key.
|
|
4
|
+
# It holds only discovery metadata and the audit log, never credentials, so a CMK would add cost
|
|
5
|
+
# without meaningful protection. Public access is fully blocked.
|
|
6
|
+
AVD-AWS-0132
|
|
7
|
+
AWS-0132
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (2026-11-30)
|
|
4
|
+
|
|
5
|
+
- **Release pipeline**: publishing a GitHub Release builds, tests and publishes `infralens-mcp` to PyPI (trusted
|
|
6
|
+
publishing, no stored token) and a multi-arch image with SBOM/provenance to `ghcr.io/balakrishnagatla/infralens`
|
|
7
|
+
- GitHub Sponsors button (`.github/FUNDING.yml`)
|
|
8
|
+
- **AWS deploy uses the shared [`aws-readonly-role`](https://github.com/balakrishnagatla/infralens-modules) module**
|
|
9
|
+
(pinned to `aws-readonly-role/v0.1.0`): same read-only permissions plus an explicit Deny on data reads, with only
|
|
10
|
+
infralens's own secrets and state file exempt. `deploy/aws/iam_policy.json` is removed.
|
|
11
|
+
- **Kubernetes provider**: reliability alerts (CrashLoopBackOff, OOMKilled, Pending pods, NotReady nodes) with
|
|
12
|
+
Deployment-rollout correlation; cost savings (unmounted volume claims, Released volumes, LoadBalancers with no
|
|
13
|
+
ready backends); ownership gaps for unlabelled workloads; pod log search
|
|
14
|
+
- Read-only RBAC (`deploy/kubernetes/rbac.yaml`) and a broken demo namespace (`demo/k8s`)
|
|
15
|
+
- CI runs a real kind cluster and scans it using only the read-only role
|
|
16
|
+
|
|
17
|
+
## 0.1.0 (2026-11-29)
|
|
18
|
+
|
|
19
|
+
First release.
|
|
20
|
+
|
|
21
|
+
- **Discoveries** across clouds through one schema: cost savings opportunities, reliability alerts, ownership gaps
|
|
22
|
+
- AWS provider (idle EC2/RDS, unattached EBS, unused IPs, old snapshots, alarms, log error spikes, CloudTrail
|
|
23
|
+
"what changed?" correlation); Azure provider (beta); mock provider for credential-free demos
|
|
24
|
+
- MCP server over stdio and Streamable HTTP (bearer token, constant-time compare, refuses to start without one)
|
|
25
|
+
- Watch mode: daily discoveries report with an optional summary from any LLM, published to GitHub Issues or Slack
|
|
26
|
+
- Policy as code, discovery lifecycle and deduplication, cost savings tracking
|
|
27
|
+
- Secret masking, audit log, least-privilege read-only IAM
|
|
28
|
+
- OpenTofu deploy for AWS (App Runner, Lambda, EventBridge Scheduler), Docker demo, CI with security scanning
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Contributing to infralens
|
|
2
|
+
|
|
3
|
+
Thanks for helping! The easiest high-impact contributions:
|
|
4
|
+
|
|
5
|
+
- **A new provider** (GCP, Kubernetes, OCI, DigitalOcean, ...): subclass `infralens.providers.base.Provider`.
|
|
6
|
+
- **A new check** for an existing provider (e.g. idle NAT gateways, unused load balancers, oversized log retention).
|
|
7
|
+
- **Real-world validation** of the Azure (beta) provider on your subscription.
|
|
8
|
+
|
|
9
|
+
## Rules every provider follows
|
|
10
|
+
|
|
11
|
+
1. **Read-only.** Only describe/list/get/query APIs. A PR that adds a write call will not be merged.
|
|
12
|
+
2. **Return the standard models** (`Finding`, `Change`); never raw SDK objects.
|
|
13
|
+
3. **Put the numbers in `evidence`** (sizes, ages, CPU averages, error counts) so an AI can reason about them.
|
|
14
|
+
4. **Fill `tags`** so owner/team/env and ignore rules work.
|
|
15
|
+
5. **Give a `recommendation`** a human can copy-paste.
|
|
16
|
+
6. **Estimate `est_monthly_cost_usd`** for cost savings opportunities, using `providers/pricing.py` (list prices; overridable).
|
|
17
|
+
7. **Test without real credentials**: moto for AWS, SDK-shaped fakes for others (see `tests/test_azure.py`).
|
|
18
|
+
|
|
19
|
+
## Dev loop
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install -e ".[aws,dev]"
|
|
23
|
+
pytest -q
|
|
24
|
+
ruff check src tests demo
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Out-of-tree plugins can register through the `infralens.providers` entry-point group:
|
|
28
|
+
|
|
29
|
+
```toml
|
|
30
|
+
[project.entry-points."infralens.providers"]
|
|
31
|
+
gcp = "infralens_gcp:GCPProvider"
|
|
32
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# MCP server image (Streamable HTTP on :8080). Also runs `infralens daily` for watch mode.
|
|
2
|
+
FROM python:3.12-slim AS base
|
|
3
|
+
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
6
|
+
COPY src ./src
|
|
7
|
+
RUN pip install ".[aws,k8s,ai]" && useradd -r -u 10001 infralens && mkdir -p /data && chown infralens /data
|
|
8
|
+
ENV INFRALENS_DB=/data/state.db INFRALENS_AUDIT_LOG=/data/audit.jsonl PORT=8080
|
|
9
|
+
USER infralens
|
|
10
|
+
EXPOSE 8080
|
|
11
|
+
HEALTHCHECK --interval=30s --timeout=3s CMD python -c "import urllib.request,sys; urllib.request.urlopen('http://127.0.0.1:8080/healthz')" || exit 1
|
|
12
|
+
ENTRYPOINT ["infralens"]
|
|
13
|
+
CMD ["serve", "--http", "--host", "0.0.0.0", "--port", "8080"]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Watch-mode image for AWS Lambda (scheduled daily scan).
|
|
2
|
+
FROM public.ecr.aws/lambda/python:3.14
|
|
3
|
+
COPY pyproject.toml README.md LICENSE ./
|
|
4
|
+
COPY src ./src
|
|
5
|
+
RUN pip install ".[aws,ai]" --target "${LAMBDA_TASK_ROOT}"
|
|
6
|
+
# Lambda already runs functions as an unprivileged user; this makes it explicit for scanners and local runs.
|
|
7
|
+
USER 1000
|
|
8
|
+
CMD ["infralens.lambda_handler.handler"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 infralens contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|