Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
de371f4
chore: add skeleton files and requirements
Vishnu2707 Apr 25, 2026
dd24ce0
fix: remove embedded git repo
Vishnu2707 Apr 25, 2026
e872074
Core Structure Created
Vishnu2707 Apr 25, 2026
ee77377
feat: build complete core — scanner engine, 10 rules, API, playbooks,…
Vishnu2707 Apr 25, 2026
053be03
docs: replace ASCII architecture with interactive Mermaid diagram
Vishnu2707 Apr 25, 2026
b31ecb7
feat: Sentinel integration — ingest.py, 4 KQL rules, setup guide (#12)
TFT444 May 2, 2026
d545744
fix: add AZ-STOR-003 compliance mappings, correct NIST control to PR.…
Vishnu2707 May 4, 2026
6c0c58e
docs: add real-world breach scenarios for all 10 starter rules (#15)
TFT444 May 4, 2026
e4382cd
feat: add AZ-KV-002 key vault public access rule and remediation play…
parthrohit22 May 4, 2026
7593ba0
Merge branch 'main' into dev
Vishnu2707 May 4, 2026
0ec2290
Merge remote-tracking branch 'origin/main' into dev
Vishnu2707 May 4, 2026
e8fed83
docs: update README with rule count, roadmap progress and contributors
Vishnu2707 May 4, 2026
35312d4
feat: add network security rules AZ-NET-003 to AZ-NET-010 (#16)
TFT444 May 4, 2026
aee88b2
Merge remote-tracking branch 'origin/main' into dev
Vishnu2707 May 4, 2026
2badbce
Feat/az stor 003 (#21)
ritiksah141 May 5, 2026
1e7a81f
docs: add SOC 2 Type II compliance framework mapping (#33)
TFT444 May 8, 2026
f409b67
Refactor/azure client network methods (#22)
TFT444 May 9, 2026
bb47779
feat: add CI pipeline with 6 automated checks (#34)
ritiksah141 May 9, 2026
0d99e2d
Merge branch 'main' into dev
Vishnu2707 May 9, 2026
46096a6
Merge remote-tracking branch 'origin/main' into dev
Vishnu2707 May 9, 2026
9e5d355
docs: update .github/ISSUE_TEMPLATE/new_rule.md to reflect current co…
Vishnu2707 May 9, 2026
2a5655e
docs: update .github/PULL_REQUEST_TEMPLATE.md to reflect current code…
Vishnu2707 May 9, 2026
57f25a6
docs: update CONTRIBUTING.md to reflect current codebase state
Vishnu2707 May 9, 2026
309deca
docs: update README.md to reflect current codebase state
Vishnu2707 May 9, 2026
693b20c
docs: update compliance/frameworks/iso27001.json to reflect current c…
Vishnu2707 May 9, 2026
c292efc
docs: update compliance/frameworks/nist_csf.json to reflect current c…
Vishnu2707 May 9, 2026
034b9d5
docs: update docs/adding-a-rule.md to reflect current codebase state
Vishnu2707 May 9, 2026
936a7d6
docs: update docs/architecture.md to reflect current codebase state
Vishnu2707 May 9, 2026
3cd0f00
docs: update docs/az-stor-003-test-plan.md to reflect current codebas…
Vishnu2707 May 9, 2026
17c29f4
docs: update docs/azure-setup.md to reflect current codebase state
Vishnu2707 May 9, 2026
6275396
docs: update docs/ci-pipeline.md to reflect current codebase state
Vishnu2707 May 9, 2026
ab16a16
docs: update docs/sentinel-setup.md to reflect current codebase state
Vishnu2707 May 9, 2026
1cd89dd
docs: update sentinel/TEST_PLAN.md to reflect current codebase state
Vishnu2707 May 9, 2026
a2fed2e
docs: update docs/api-reference.md to reflect current codebase state
Vishnu2707 May 9, 2026
98894bc
docs: update docs/rules-reference.md to reflect current codebase state
Vishnu2707 May 9, 2026
fdae7e7
Merge remote-tracking branch 'origin/dev' into dev
Vishnu2707 May 9, 2026
85bbb7f
docs: update README.md for professional open source style
Vishnu2707 May 9, 2026
0643eaf
docs: update CONTRIBUTING.md for professional open source style
Vishnu2707 May 9, 2026
5ebcdd9
docs: update docs/adding-a-rule.md for professional open source style
Vishnu2707 May 9, 2026
eb88659
Merge branch 'main' into dev
Vishnu2707 May 9, 2026
2d230dd
docs: update deployment guide to use Render instead of Azure App Service
Vishnu2707 May 9, 2026
bac6146
Merge remote-tracking branch 'origin/dev' into dev
Vishnu2707 May 9, 2026
d4384fe
feat: add rule AZ-STOR-004 storage account diagnostic logging check (…
SHAURYAKSHARMA24 May 13, 2026
826396a
feat: add rule AZ-IDN-003 Adds scanner rule AZ-IDN-003 detecting Entr…
TFT444 May 13, 2026
cd47b68
feat: add rule AZ-CMP-002 — VM disk not protected by CMK or ADE (#47)
TFT444 May 13, 2026
1efe1f3
Feat/api deployment (#46)
ritiksah141 May 13, 2026
ba6c70c
feat: AZ-NET-011 Network Watcher not enabled in all regions (#42)
emon22-ts May 13, 2026
e7c3487
feat: add AZ-DB-003 PostgreSQL Flexible Server SSL enforcement rule a…
emon22-ts May 16, 2026
024e635
Merge branch 'main' into dev
Vishnu2707 May 16, 2026
bc146ef
[RULE] AZ-CMP-003: VM without endpoint protection installed (#57)
TFT444 May 23, 2026
923cc75
[DOCS] Add OpenShield learning and onboarding portal (#51)
parthrohit22 May 23, 2026
954505c
Merge branch 'main' into dev
Vishnu2707 May 24, 2026
4a2ef01
refactor: reuse database connection per request using Flask g (#41)
safidnadaf May 24, 2026
0e82402
docs: add security policy, issue template, and README badges (#64)
ritiksah141 May 24, 2026
1b25a74
feat: add rule AZ-KV-004 Key Vault purge protection disabled (#55)
aav-wh May 24, 2026
4a1b153
feat: add AZ-STOR-005 geo-redundant storage rule (#74)
SHAURYAKSHARMA24 May 27, 2026
cd339e1
feat: add rule AZ-DB-004 SQL Server firewall allows all Azure service…
aav-wh May 27, 2026
00dad53
docs: add 6 README badges (#79)
ritiksah141 May 28, 2026
d362cc7
feat: add AZ-KV-005 Key Vault certificate expiring within 30 days (#75)
TFT444 May 28, 2026
82efdfb
[RULE] AZ-CMP-004: VM without automatic OS patching enabled (#73)
TFT444 May 28, 2026
1757c84
Merge branch 'main' into dev
Vishnu2707 May 29, 2026
6ff2686
feat: add AI provider abstraction layer for Anthropic, Groq and Gemin…
TFT444 May 29, 2026
5dedde9
Smoke Test Alginment after the recent changes to the Repository causi…
ritiksah141 May 29, 2026
8cf18db
feat: add AZ-IDN-004 PIM not configured for admin roles rule and play…
emon22-ts May 30, 2026
4b2afb5
feat: add AI executive summary and remediation endpoint (#95)
SHAURYAKSHARMA24 May 30, 2026
3636dd7
feat(scanner): add AZ-NET-014 VNet peering gateway transit rule (#94)
aav-wh May 30, 2026
70cb686
feat: add AZ-NET-013 Azure Firewall VNet rule (#99)
SHAURYAKSHARMA24 May 31, 2026
bf82c39
Implement AI Q&A over scan findings (#98)
SHAURYAKSHARMA24 May 31, 2026
9a1f824
Merge branch 'main' into dev
Vishnu2707 May 31, 2026
c0116f8
Feat/CVE correlation (#96)
ritiksah141 Jun 1, 2026
3d17d7b
feat: add RAG powered AI insights layer with Azure security skill emb…
TFT444 Jun 1, 2026
a2263a4
feat: add AZ-NET-012 - NSG flow logs not enabled rule (#76)
safidnadaf Jun 1, 2026
808a9c6
fix: resolve CodeQL warnings in embed.py and test files
Vishnu2707 Jun 1, 2026
c9592c0
Merge branch 'main' into dev
Vishnu2707 Jun 1, 2026
931d32c
feat(frontend): build complete 7-page security dashboard (#111)
vogonPrayas Jun 3, 2026
673511e
Feat/jwt secret prod fail closed (#117)
ritiksah141 Jun 3, 2026
03cd7cb
feat: AI-004 RAG Pipeline - Document Ingestion and Vector Store (#104)
emon22-ts Jun 3, 2026
115320f
Potential fix for pull request finding 'Unused import'
Vishnu2707 Jun 4, 2026
4ad4ceb
feat: add AZ-PQC-001 to AZ-PQC-003 post-quantum cryptography scanner …
Vishnu2707 Jun 4, 2026
6e5e9a4
feat: add PQC compliance mappings, azure client methods and dependencies
Vishnu2707 Jun 4, 2026
83502d9
docs: update README with post-quantum cryptography scanning and rule …
Vishnu2707 Jun 4, 2026
16f7e77
Feat/live data wiring (#122)
ritiksah141 Jun 4, 2026
ffc3652
Feat/decouple CVE enrichment (#127)
ritiksah141 Jun 5, 2026
1e09618
docs: update OpenShield Learn content, navigation, and hosting suppor…
parthrohit22 Jun 5, 2026
c938551
feat(tests): MockAzureClient rule regression test harness — 7 rules o…
TFT444 Jun 5, 2026
cdcbb2b
AZ-IDN-005 to AZ-IDN-009 — Entra ID identity scanner rules (#109)
TFT444 Jun 5, 2026
9da652b
Merge branch 'main' into dev
Vishnu2707 Jun 5, 2026
7dd74b9
Potential fix for pull request finding 'Empty except'
Vishnu2707 Jun 5, 2026
1ba73b1
Potential fix for pull request finding 'Unused variable, import, func…
Vishnu2707 Jun 5, 2026
d537461
Implement threat simulation prompt builder (#138)
TFT444 Jun 13, 2026
852768d
docs: add frontend API validation guide (#134)
SHAURYAKSHARMA24 Jun 13, 2026
42a0399
fix(compliance): align rule reference and framework mappings (#130)
m-khan-97 Jun 13, 2026
d7c59db
feat: implement asynchronous scan execution with background worker (#…
ritiksah141 Jun 13, 2026
6b5b75f
feat(scanner): add AZ-NET-015 public DNS zone enumeration rule (#106)
aav-wh Jun 13, 2026
d37e8dc
fix: scope posture endpoints to latest completed scan (#145)
TFT444 Jun 21, 2026
4abc2d6
Fix: Make Flask app test-safe and run full pytest suite in CI (#143)
emon22-ts Jun 21, 2026
e0512bc
feat: Integrate Azure Offensive Skills and Dynamic AI Grounding (#137)
ritiksah141 Jun 21, 2026
3c951ce
feat(auth): require JWT for GET /api/* endpoints with optional public…
TFT444 Jul 2, 2026
15d0537
fix(scanner): improve AZ-NET-008 with SOC2 mapping and azure_client a…
aav-wh Jul 2, 2026
e137e64
CI: parallel jobs, lint/format gate, security scanning, coverage (#15…
ritiksah141 Jul 6, 2026
cdd5b42
Fix async scan state recovery (#169)
ritiksah141 Jul 8, 2026
82cf855
feat(infra): observability layer — structured logs, request IDs, metr…
SHAURYAKSHARMA24 Jul 8, 2026
b6b312a
fix(compliance): correct duplicate CIS control mappings, TLS version …
TFT444 Jul 8, 2026
c4f7e0a
build(deps): bump react-router (#148)
dependabot[bot] Jul 8, 2026
69d1f5e
build(deps-dev): bump vite (#147)
dependabot[bot] Jul 8, 2026
6f138b2
docs: add Azure scanner validation docs (#142)
parthrohit22 Jul 8, 2026
0abe4bd
Merge branch 'main' into dev
Vishnu2707 Jul 8, 2026
fea9314
fix: disable auto deploy to Render, manual trigger only
Vishnu2707 Jul 8, 2026
0e85ecf
fix: ruff auto fixes
Vishnu2707 Jul 8, 2026
8cd0406
fix: resolve CodeQL high findings - XSS innerHTML, clear text logging…
Vishnu2707 Jul 8, 2026
8becdd1
chore: add CODEOWNERS, issue templates, Docker setup and autonomous C…
Vishnu2707 Jul 8, 2026
7170af4
fix: raise dependency review threshold to critical only
Vishnu2707 Jul 8, 2026
886a283
fix: upgrade vulnerable dependencies flagged by pip-audit and npm audit
Vishnu2707 Jul 8, 2026
1ca80bc
fix: revert dependency review threshold back to high
Vishnu2707 Jul 8, 2026
52ec129
fix: use python:3.11-slim-bookworm base image to reduce Trivy vulnera…
Vishnu2707 Jul 8, 2026
eec36fe
fix: upgrade jaraco.context, transformers and wheel to fix Trivy HIGH…
Vishnu2707 Jul 8, 2026
a0ac0d0
Merge branch 'main' into dev
Vishnu2707 Jul 8, 2026
3443a85
feat(db): implement Alembic migrations (#164)
parthrohit22 Jul 9, 2026
fa6817d
fix: remediate container scan vulnerabilities (#175)
ritiksah141 Jul 11, 2026
418bcba
Reliability fixes: score 500, DB pooling, async CVE enrichment, threa…
TFT444 Jul 11, 2026
b0a57a7
test: add comprehensive validation coverage (#146)
SHAURYAKSHARMA24 Jul 11, 2026
cbb7374
infra 7 : Terraform for Render/Vercel + GitHub OIDC for Azure credent…
TFT444 Jul 12, 2026
c253547
Security hardening: body size limit, Gemini key header, AI rate limit…
TFT444 Jul 12, 2026
d39f270
Infra: add deterministic Render deploy pipeline and separate worker s…
SHAURYAKSHARMA24 Jul 13, 2026
34011ca
Merge branch 'main' into dev
Vishnu2707 Jul 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.git
.github
.pytest_cache
.ruff_cache
.venv
venv
**/.venv
**/venv
**/__pycache__
**/node_modules
*.py[cod]
*.log
.env
.env.*
ai/vectorstore
coverage.xml
.coverage
htmlcov
sbom.cyclonedx.json
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ jobs:
with:
image-ref: openshield-ci-scan:${{ github.sha }}
severity: CRITICAL,HIGH
ignore-unfixed: true
exit-code: "1"

# ── Backend test suite with coverage ─────────────────────────────────────
Expand Down Expand Up @@ -512,6 +513,11 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Apply database migrations
env:
DATABASE_URL: "postgresql://ci:ci@localhost:5432/ci_db"
run: alembic upgrade head

- name: Run test suite with coverage
env:
DATABASE_URL: "postgresql://ci:ci@localhost:5432/ci_db"
Expand Down
156 changes: 109 additions & 47 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
name: Deploy API to Render
name: Deploy API and worker to Render

on:
workflow_dispatch: # allows manual trigger from GitHub UI
workflow_dispatch:
inputs:
environment:
description: Target Render environment
required: true
type: choice
options:
- staging
- production
run_smoke_tests:
description: Run smoke tests after deploy
required: true
default: true
type: boolean

concurrency:
group: deploy-${{ inputs.environment }}
cancel-in-progress: false

permissions:
contents: read

permissions:
id-token: write
contents: read

jobs:
deploy:
name: Deploy to Render
name: Deploy to Render (${{ inputs.environment }})
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}

steps:
- name: Checkout repository
Expand All @@ -17,7 +42,6 @@ jobs:
with:
python-version: "3.11"

# ── Dependency caching ─────────────────────────────────────────────
- name: Cache pip dependencies
uses: actions/cache@v4
with:
Expand All @@ -31,30 +55,86 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt

# ── Secret check (Determines if smoke tests should run) ───────────
- name: Check for JWT_SECRET
id: check_config
run: |
if [ -n "${{ secrets.JWT_SECRET }}" ]; then
echo "is_configured=true" >> $GITHUB_OUTPUT
else
echo "is_configured=false" >> $GITHUB_OUTPUT
fi
# This must remain before either create step: invalid branch/environment
# combinations and missing configuration must result in zero Render POSTs.
- name: Validate deployment preflight
env:
DEPLOY_ENVIRONMENT: ${{ inputs.environment }}
RUN_SMOKE_TESTS: ${{ inputs.run_smoke_tests }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_SHA: ${{ github.sha }}
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
RENDER_STAGING_SERVICE_ID: ${{ secrets.RENDER_STAGING_SERVICE_ID }}
RENDER_STAGING_WORKER_SERVICE_ID: ${{ secrets.RENDER_STAGING_WORKER_SERVICE_ID }}
RENDER_PRODUCTION_SERVICE_ID: ${{ secrets.RENDER_PRODUCTION_SERVICE_ID }}
RENDER_PRODUCTION_WORKER_SERVICE_ID: ${{ secrets.RENDER_PRODUCTION_WORKER_SERVICE_ID }}
STAGING_API_URL: ${{ secrets.STAGING_API_URL }}
PRODUCTION_API_URL: ${{ secrets.PRODUCTION_API_URL }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
run: python scripts/render_deploy_preflight.py

# Creation and polling are separate so both exact deployment IDs are
# retained and independently monitored. POST creation is never retried.
- name: Create API deployment
id: create_api
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
RENDER_SERVICE_ID: ${{ env.RENDER_API_SERVICE_ID }}
RENDER_SERVICE_NAME: API
GITHUB_SHA: ${{ github.sha }}
run: python scripts/render_deploy.py create

- name: Create worker deployment
id: create_worker
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
RENDER_SERVICE_ID: ${{ env.RENDER_WORKER_SERVICE_ID }}
RENDER_SERVICE_NAME: worker
GITHUB_SHA: ${{ github.sha }}
run: python scripts/render_deploy.py create

# ── Wait for Render auto-deployment ────────────────────────────────
# Render handles the actual physical deployment when you push.
# We just pause the Action to let Render's servers finish building.
- name: Wait for app to initialise
- name: Wait for API deployment
id: wait_api
continue-on-error: true
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
RENDER_SERVICE_ID: ${{ env.RENDER_API_SERVICE_ID }}
RENDER_SERVICE_NAME: API
RENDER_DEPLOY_ID: ${{ steps.create_api.outputs.deploy_id }}
GITHUB_SHA: ${{ github.sha }}
run: python scripts/render_deploy.py wait

- name: Wait for worker deployment
id: wait_worker
continue-on-error: true
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}
RENDER_SERVICE_ID: ${{ env.RENDER_WORKER_SERVICE_ID }}
RENDER_SERVICE_NAME: worker
RENDER_DEPLOY_ID: ${{ steps.create_worker.outputs.deploy_id }}
GITHUB_SHA: ${{ github.sha }}
run: python scripts/render_deploy.py wait

- name: Require both deployments to be live
if: always()
env:
API_RESULT: ${{ steps.wait_api.outcome }}
WORKER_RESULT: ${{ steps.wait_worker.outcome }}
API_DEPLOY_ID: ${{ steps.create_api.outputs.deploy_id }}
WORKER_DEPLOY_ID: ${{ steps.create_worker.outputs.deploy_id }}
GITHUB_SHA: ${{ github.sha }}
run: |
echo "Waiting 120 seconds for Render to build and start the app..."
sleep 120
if [ "$API_RESULT" != "success" ] || [ "$WORKER_RESULT" != "success" ]; then
echo "ERROR: coordinated deployment failed for SHA $GITHUB_SHA. API deploy $API_DEPLOY_ID: $API_RESULT; worker deploy $WORKER_DEPLOY_ID: $WORKER_RESULT."
exit 1
fi
echo "API deploy $API_DEPLOY_ID and worker deploy $WORKER_DEPLOY_ID are live at SHA $GITHUB_SHA."

# ── Health gate ────────────────────────────────────────────────────
- name: Health gate check
id: health_gate
env:
# Use secret URL if provided, otherwise fallback to default
API_URL: ${{ secrets.API_URL || 'https://openshield-api.onrender.com' }}
run: |
MAX_RETRIES=5
RETRY_DELAY=15
Expand All @@ -64,42 +144,24 @@ jobs:
for i in $(seq 1 $MAX_RETRIES); do
echo "Health check attempt $i of $MAX_RETRIES..."
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$URL" --max-time 30) || true

if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Health check passed (HTTP $HTTP_STATUS)"
exit 0
fi

echo "Got HTTP $HTTP_STATUS — retrying in ${RETRY_DELAY}s..."
echo "Got HTTP $HTTP_STATUS; retrying in ${RETRY_DELAY}s..."
sleep $RETRY_DELAY
done
echo "ERROR: Health gate failed after $MAX_RETRIES attempts on ${{ inputs.environment }}."
exit 1

echo "HEALTH GATE FAILED after $MAX_RETRIES attempts"
echo "Note: If you haven't set up Render for this fork, this is expected."
# Only allow failure on feature branches; fail on main/dev
if [[ "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/dev" ]]; then
echo "ERROR: Health check failed on protected branch. Deployment verification required."
exit 1
else
echo "Allowing health check failure on feature branch (infra may not be set up)"
exit 0
fi

# ── Smoke tests ────────────────────────────────────────────────────
- name: Run smoke tests against live deployment
if: steps.check_config.outputs.is_configured == 'true' || github.event_name == 'workflow_dispatch'
if: inputs.run_smoke_tests
env:
API_URL: ${{ secrets.API_URL || 'https://openshield-api.onrender.com' }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
RUN_REAL_SCAN: "true"
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" && -z "${{ secrets.JWT_SECRET }}" ]]; then
echo "ERROR: Cannot run smoke tests on main branch without JWT_SECRET configured"
exit 1
fi
echo "Running smoke tests against: $API_URL"
python tests/smoke_test.py
python tests/smoke_test.py
62 changes: 62 additions & 0 deletions .github/workflows/terraform-plan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Terraform Plan

on:
pull_request:
paths:
- "infra/terraform/**"

permissions:
contents: read
pull-requests: write

jobs:
plan:
name: Terraform fmt / validate / plan
runs-on: ubuntu-latest
defaults:
run:
working-directory: infra/terraform
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: "~1.6"
terraform_wrapper: false

- name: Terraform fmt
run: terraform fmt -check -recursive

- name: Check for Terraform Cloud token
id: check_token
run: |
if [ -n "${{ secrets.TF_API_TOKEN }}" ]; then
echo "has_token=true" >> "$GITHUB_OUTPUT"
else
echo "has_token=false" >> "$GITHUB_OUTPUT"
fi

- name: Terraform validate (no credentials)
if: steps.check_token.outputs.has_token == 'false'
run: |
echo "TF_API_TOKEN not configured — skipping real plan, running structural validation only."
echo 'terraform {' > override.tf
echo ' backend "local" {}' >> override.tf
echo '}' >> override.tf
terraform init -backend=false
terraform validate
rm override.tf

- name: Terraform init (real backend)
if: steps.check_token.outputs.has_token == 'true'
env:
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
run: terraform init

- name: Terraform plan
if: steps.check_token.outputs.has_token == 'true'
env:
TF_TOKEN_app_terraform_io: ${{ secrets.TF_API_TOKEN }}
run: terraform plan -no-color
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,29 @@ Most list methods return an empty list on failure. Methods that fetch one resour
```bash
# Python 3.10+
pip install -r requirements.txt
# Installs Flask, Azure SDK clients, requests, psycopg2, PyJWT, and PyYAML for CI workflow validation.
# Installs Flask, Alembic, Azure SDK clients, requests, psycopg2, PyJWT, and PyYAML for CI workflow validation.

# Frontend
# The frontend directory is currently a scaffold. The React dashboard MVP is on the roadmap.

# API
FLASK_APP=api/app.py flask run --debug

# Database (Docker)
docker run --name openshield-db \
-e POSTGRES_USER=openshield \
-e POSTGRES_PASSWORD=openshield \
-e POSTGRES_DB=openshield \
-p 5432:5432 -d postgres

export DATABASE_URL=postgresql://openshield:openshield@localhost:5432/openshield
alembic upgrade head

# API
FLASK_APP=api/app.py flask run --debug
```

See [Database Migrations](docs/database-migrations.md) before creating or applying
a schema change. Migration revisions are written explicitly because OpenShield
does not use ORM metadata.

---

## Code Standards
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM python:3.11-slim-bookworm
FROM python:3.11-slim-trixie

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
RUN pip install --no-cache-dir --upgrade \
pip==26.1.2 \
setuptools==83.0.0 \
wheel==0.46.3 && \
pip install --no-cache-dir -r requirements.txt

COPY . .
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ export AZURE_CLIENT_ID=your-client-id
export AZURE_CLIENT_SECRET=your-client-secret
export AZURE_TENANT_ID=your-tenant-id
export JWT_SECRET=your-strong-secret # used to protect write endpoints (scan trigger, AI)
export DATABASE_URL=postgresql://openshield:openshield@localhost:5432/openshield

# Create or update the database schema
alembic upgrade head

# Run a scan
python -c "
Expand All @@ -175,6 +179,9 @@ print(json.dumps(result, indent=2))
FLASK_APP=api/app.py flask run
```

See [Database Migrations](docs/database-migrations.md) for schema changes and the
one-time onboarding step required for existing production databases.

**Frontend (React dashboard)**

```bash
Expand Down
Loading
Loading