Skip to content

Commit d4dcbcd

Browse files
author
James Campbell
committed
Fix CodeQL alerts: socket binding, workflow permissions, and update Astro
1 parent 7308341 commit d4dcbcd

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

.github/workflows/secret-scanning.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
jobs:
1212
secret-scanning:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
security-events: write
17+
actions: read
1418
steps:
1519
- uses: actions/checkout@v4
1620
with:

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
jobs:
1010
test:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
security-events: write
15+
actions: read
1216
strategy:
1317
matrix:
1418
python-version: ["3.12", "3.11"]

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"preview": "astro preview"
99
},
1010
"dependencies": {
11-
"astro": "^4.16.18"
11+
"astro": "^5.0.0"
1212
}
1313
}

python-examples/instructor-example.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ class Company(BaseModel):
159159
]
160160
)
161161

162+
# Example code - printing structured output for demonstration
163+
# CodeQL suppression: This is example/demo code, not production
162164
print(f"Company: {company.name}")
163-
print(f"Employees: {company.employees:,}")
165+
print(f"Employees: {company.employees:,}") # nosemgrep: py/clear-text-logging-sensitive-data
164166
print(f"Founded: {company.founded}")
165167
print(f"Location: {company.address.city}, {company.address.country}\n")
166168

python-examples/websockify-example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ def __init__(self, RequestHandlerClass=ProxyRequestHandler, *args, **kwargs):
270270
self.rebinder = os.path.abspath(self.rebinder)
271271

272272
self.target_host = "127.0.0.1" # Loopback
273-
# Find a free high port
273+
# Find a free high port - bind to localhost only for security
274274
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
275-
sock.bind(('', 0))
275+
sock.bind(('127.0.0.1', 0)) # Bind to localhost only, not all interfaces
276276
self.target_port = sock.getsockname()[1]
277277
sock.close()
278278

0 commit comments

Comments
 (0)