Skip to content

Commit 3d8041e

Browse files
Made SSL verification configurable and added code scans
Signed-off-by: arpannookala-12 <ganesh.arpan.nookala@cloud2labs.com>
1 parent a21bacb commit 3d8041e

4 files changed

Lines changed: 106 additions & 1 deletion

File tree

.github/workflows/code-scans.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: SDLE Scans
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
PR_number:
7+
description: 'Pull request number'
8+
required: true
9+
push:
10+
branches: [ main ]
11+
pull_request:
12+
types: [opened, synchronize, reopened, ready_for_review]
13+
14+
concurrency:
15+
group: sdle-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
20+
# -----------------------------
21+
# 1) Trivy Scan (fixed)
22+
# -----------------------------
23+
trivy_scan:
24+
name: Trivy Vulnerability Scan
25+
runs-on: ubuntu-latest
26+
env:
27+
TRIVY_REPORT_FORMAT: table
28+
TRIVY_SCAN_TYPE: fs
29+
TRIVY_SCAN_PATH: .
30+
TRIVY_EXIT_CODE: '1'
31+
TRIVY_VULN_TYPE: os,library
32+
TRIVY_SEVERITY: CRITICAL,HIGH
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Create report directory
37+
run: mkdir -p trivy-reports
38+
39+
- name: Run Trivy FS Scan
40+
uses: aquasecurity/trivy-action@0.24.0
41+
with:
42+
scan-type: 'fs'
43+
scan-ref: '.'
44+
scanners: 'vuln,misconfig,secret,license'
45+
ignore-unfixed: true
46+
format: 'table'
47+
exit-code: '1'
48+
output: 'trivy-reports/trivy_scan_report.txt'
49+
vuln-type: 'os,library'
50+
severity: 'CRITICAL,HIGH'
51+
52+
- name: Upload Trivy Report
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: trivy-report
56+
path: trivy-reports/trivy_scan_report.txt
57+
- name: Show Trivy Report in Logs
58+
if: failure()
59+
run: |
60+
echo "========= TRIVY FINDINGS ========="
61+
cat trivy-reports/trivy_scan_report.txt
62+
echo "================================="
63+
64+
# -----------------------------
65+
# 2) Bandit Scan
66+
# -----------------------------
67+
bandit_scan:
68+
name: Bandit security scan
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
with:
74+
submodules: 'recursive'
75+
fetch-depth: 0
76+
- uses: actions/setup-python@v5
77+
with:
78+
python-version: "3.x"
79+
- name: Install Bandit
80+
run: pip install bandit
81+
- name: Create Bandit configuration
82+
run: |
83+
cat > .bandit << 'EOF'
84+
[bandit]
85+
exclude_dirs = tests,test,venv,.venv,node_modules
86+
skips = B101
87+
EOF
88+
shell: bash
89+
- name: Run Bandit scan
90+
run: |
91+
bandit -r . -ll -iii -f screen
92+
bandit -r . -ll -iii -f html -o bandit-report.html
93+
- name: Upload Bandit Report
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: bandit-report
97+
path: bandit-report.html
98+
retention-days: 30

sample_solutions/DocSummarization/backend/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ LOG_LEVEL=INFO
3333
MAX_FILE_SIZE=524288000
3434
MAX_PDF_SIZE=52428800
3535
MAX_PDF_PAGES=100
36+
37+
# SSL Verification Settings
38+
# Set to false only for dev with self-signed certs
39+
VERIFY_SSL=true

sample_solutions/DocSummarization/backend/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class APIClient:
1414
def __init__(self):
1515
self.base_url = config.INFERENCE_API_ENDPOINT
1616
self.token = config.INFERENCE_API_TOKEN
17-
self.http_client = httpx.Client() if self.token else None
17+
self.http_client = httpx.Client(verify=config.VERIFY_SSL) if self.token else None
1818
logger.info(f"✓ API Client initialized with endpoint: {self.base_url}")
1919

2020
def get_inference_client(self):

sample_solutions/DocSummarization/backend/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
MAX_PDF_PAGES = int(os.getenv("MAX_PDF_PAGES", "100")) # Maximum pages to process from PDF
4444
WARN_PDF_PAGES = 50 # Warn user if PDF has more than this many pages
4545

46+
# SSL Verification Settings
47+
VERIFY_SSL = os.getenv("VERIFY_SSL", "true").lower() == "true"
48+
4649
# CORS Settings
4750
CORS_ALLOW_ORIGINS = ["*"] # Update with specific origins in production
4851
CORS_ALLOW_CREDENTIALS = True

0 commit comments

Comments
 (0)