Skip to content

Commit 2b674ad

Browse files
authored
Add trivy scan (#115)
* Add trivy scan * Add misconfig scanner * update pyproject.toml * run on schedule * Change service for testing
1 parent d2b8084 commit 2b674ad

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

.github/workflows/security-scans.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Security scans
2+
on:
3+
schedule:
4+
- "15 12 * * *"
5+
pull_request:
6+
jobs:
7+
build:
8+
name: Trivy repository scan
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Run Trivy vulnerability scanner in repo mode
15+
uses: aquasecurity/trivy-action@master
16+
with:
17+
scan-type: 'fs'
18+
scanners: 'vuln,misconfig,secret,license'
19+
ignore-unfixed: true
20+
format: 'sarif'
21+
output: 'trivy-results.sarif'
22+
severity: 'HIGH'
23+
24+
- name: Upload Trivy scan results to GitHub Security tab
25+
uses: github/codeql-action/upload-sarif@v3
26+
with:
27+
sarif_file: 'trivy-results.sarif'

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ import httpx
7878
async def web_request():
7979
"""Sends a slow web request"""
8080
async with httpx.AsyncClient() as client:
81-
response = await client.get("https://httpstat.us/200?sleep=100")
81+
response = await client.get("https://httpbin.org/status/200?sleep=100")
8282
return response
8383

8484

dike/_limit_jobs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def limit_jobs(*, limit: int) -> Callable[..., Coroutine[Any, Any, Any]]:
3737
>>> @dike.limit_jobs(limit=2)
3838
... async def web_request():
3939
... async with httpx.AsyncClient() as client:
40-
... response = await client.get("https://httpstat.us/200?sleep=100")
40+
... response = await client.get("https://httpbin.org/status/200?sleep=100")
4141
... return response
4242
...
4343
...

dike/_retry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def retry(
4646
>>> @dike.retry(attempts=2, delay=datetime.timedelta(milliseconds=10))
4747
... async def web_request():
4848
... async with httpx.AsyncClient() as client:
49-
... response = await client.get("https://httpstat.us/400")
49+
... response = await client.get("https://httpbin.org/status/400")
5050
... if response.status_code != httpx.codes.OK:
5151
... raise RuntimeError("Request failed!")
5252
... return response

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ homepage = "https://github.com/chr1st1ank/dike"
66
description = "Python asyncio tools for web service resilience."
77
authors = ["Christian Krudewig <[email protected]>"]
88
readme = "README.md"
9-
license = {file = "LICENSE"}
9+
license = "Apache-2.0"
1010
classifiers = [
1111
'Development Status :: 5 - Production/Stable',
1212
'Intended Audience :: Developers',

0 commit comments

Comments
 (0)