Skip to content

Commit 4dca608

Browse files
Merge branches 'security-fix-1' and 'security-fix-2'
* security-fix-1: Fix CWE-73 found in PR #37 * security-fix-2: Harden default permissions of GH actions ( - Fixes #39 - )
3 parents 2b8730a + c2194fe + cdba8ce commit 4dca608

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

.github/workflows/Labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
types: [opened, reopened]
55
branches: [ master, stable ]
66

7+
# Declare default permissions as none.
8+
permissions: none
9+
710
jobs:
811
triage:
912
permissions:

.github/workflows/Tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
tags:
88
- v*
99

10+
# Declare default permissions as read only.
11+
permissions: read-all
12+
1013
jobs:
1114
BUILD:
1215
if: github.repository == 'reactive-firewall/python-repo'

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
schedule:
2121
- cron: '17 5 * * 1'
2222

23+
# Declare default permissions as read only.
24+
permissions: read-all
25+
2326
jobs:
2427
analyze:
2528
name: Analyze

setup.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
def readFile(filename):
2929
"""Helper Function to read files"""
3030
theResult = None
31-
try:
32-
with open(str("""./{}""").format(str(filename))) as f:
33-
theResult = f.read()
34-
except Exception:
35-
theResult = str(
36-
"""See https://github.com/reactive-firewall/python-repo/{}"""
37-
).format(filename)
31+
if filename in ("""README.md""", """LICENSE.md"""):
32+
try:
33+
with open(str("""./{}""").format(str(filename))) as f:
34+
theResult = f.read()
35+
except Exception:
36+
theResult = str(
37+
"""See https://github.com/reactive-firewall/python-repo/{}"""
38+
).format(filename)
3839
return theResult
3940

4041

0 commit comments

Comments
 (0)