Skip to content

Commit 4bbc33e

Browse files
authored
Merge branch 'fix/resolve_vulnerabilities' into broadcast-link-checker-fix
2 parents 2961992 + 3388520 commit 4bbc33e

File tree

10 files changed

+114
-48
lines changed

10 files changed

+114
-48
lines changed

.github/workflows/automatic-pr-labeler.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
if: (github.event.pull_request.merged == false) && (github.event.pull_request.user.login != 'dependabot[bot]') && (github.event.pull_request.user.login != 'github-actions[bot]')
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
28+
with:
29+
persist-credentials: false
2830

2931
- name: "Execute assign labels"
3032
id: action-assign-labels
@@ -42,4 +44,4 @@ jobs:
4244
echo "⚠️ Pull request from fork! ⚠️";
4345
echo "Labels will not be applied to PR. Assign them manually please.";
4446
echo "Labels to assign: ${{ steps.action-assign-labels.outputs.labels-next }}";
45-
} >> $GITHUB_STEP_SUMMARY
47+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/cla.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ on:
77
types: [opened, closed, synchronize]
88

99
permissions:
10-
actions: write
1110
contents: read
12-
pull-requests: write
13-
statuses: write
1411

1512
jobs:
1613
CLAAssistant:
14+
if: github.event.pull_request.draft == false
15+
permissions:
16+
actions: write
17+
contents: write
18+
pull-requests: write
19+
statuses: write
1720
runs-on: ubuntu-latest
1821
steps:
1922
- name: "CLA Assistant"

.github/workflows/link-checker.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
push: null
66
repository_dispatch: null
77
workflow_dispatch: null
8-
pull_request:
9-
branches: [main]
10-
types:
11-
[opened, reopened, synchronize]
128
permissions:
139
contents: read
1410
jobs:

.github/workflows/pr-conventional-commits.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
name: Conventional Commits
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+
with:
21+
persist-credentials: false
2022

2123
- uses: webiny/action-conventional-commits@v1.3.0

.github/workflows/pr-lint-title.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
name: Validate PR title
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: amannn/action-semantic-pull-request@v5
21+
- uses: amannn/action-semantic-pull-request@v6
2222
env:
2323
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/super-linter.yaml

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,70 @@ permissions:
2929
contents: read
3030

3131
jobs:
32+
prepare-configs:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: "Get the common linters configuration"
36+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37+
with:
38+
ref: main # fix/superlinter-config
39+
repository: netcracker/.github
40+
persist-credentials: false
41+
sparse-checkout: |
42+
config/linters
43+
- name: "Upload the common linters configuration"
44+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
45+
with:
46+
name: linter-config
47+
path: "${{ github.workspace }}/config"
48+
include-hidden-files: true
3249
run-lint:
50+
needs: [prepare-configs]
3351
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
packages: read
55+
# To report GitHub Actions status checks
56+
statuses: write
3457
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@v4
37-
with:
38-
# Full git history is needed to get a proper list of changed files within `super-linter`
39-
fetch-depth: 0
58+
- name: Checkout code
59+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
60+
with:
61+
# Full git history is needed to get a proper list of changed files within `super-linter`
62+
fetch-depth: 0
63+
persist-credentials: false
64+
- name: "Get the common linters configuration"
65+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
66+
id: download
67+
with:
68+
name: linter-config
69+
path: /tmp/linter-config
70+
- name: "Apply the common linters configuration"
71+
if: ${{ steps.download.outputs.download-path != '' }}
72+
run: |
73+
mkdir -p ./.github/linters
74+
cp --update=none -vRT /tmp/linter-config/linters ./.github/linters
75+
76+
- name: "Load super-linter environment file"
77+
shell: bash
78+
run: |
79+
# shellcheck disable=2086
80+
if [ -f "${GITHUB_WORKSPACE}/.github/super-linter.env" ]; then
81+
echo "Applying local linter environment:"
82+
grep "\S" ${GITHUB_WORKSPACE}/.github/super-linter.env | grep -v "^#"
83+
grep "\S" ${GITHUB_WORKSPACE}/.github/super-linter.env | grep -v "^#" >> $GITHUB_ENV
84+
elif [ -f "/tmp/linter-config/linters/super-linter.env" ]; then
85+
echo "::warning:: Local linter environment file .github/super-linter.env is not found"
86+
echo "Applying common linter environment:"
87+
grep "\S" /tmp/linter-config/linters/super-linter.env | grep -v "^#"
88+
grep "\S" /tmp/linter-config/linters/super-linter.env | grep -v "^#" >> $GITHUB_ENV
89+
fi
4090
41-
- name: "Load super-linter environment file"
42-
run: |
43-
# shellcheck disable=2086
44-
if [ -f "./.github/super-linter.env" ]; then
45-
grep "\S" ./.github/super-linter.env | grep -v "^#"
46-
grep "\S" ./.github/super-linter.env | grep -v "^#" >> $GITHUB_ENV
47-
fi
91+
- name: Lint Code Base
92+
uses: super-linter/super-linter/slim@ffde3b2b33b745cb612d787f669ef9442b1339a6 # v8.1.0
93+
env:
94+
VALIDATE_ALL_CODEBASE: ${{ inputs.full_scan || false }}
95+
# To report GitHub Actions status checks
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
DEFAULT_BRANCH: ${{ github.event.pull_request.base.ref || github.event.push.ref }}
4898

49-
- name: Lint Code Base
50-
uses: super-linter/super-linter@v7
51-
env:
52-
VALIDATE_ALL_CODEBASE: ${{ inputs.full_scan || false }}
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.qubership/grand-report.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"exclusions" : [ {
3+
"t-hash" : "14ff48a222e433c0dc21ba755e1990034a4c35e1e9bde940516f190323a73619",
4+
"f-hash" : "a82fe1c8cecf4df558b8f06a146f9857d7706e9dbda4df8b84a559c857255332"
5+
}, {
6+
"t-hash" : "9a012439f50df45095bcebd75aa1efe2615c1f28c137c55cfbef11f9d9ceb730",
7+
"f-hash" : "eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055"
8+
}, {
9+
"t-hash" : "322aa41d6d24e719b096f97c792be784ef4b494d6f4ec2dacaa58f4f2941d2db",
10+
"f-hash" : "f6ed156e4bf5c791680662464b94ea5d753f219ee816b385f67870e2c0d7d4c7"
11+
} ]
12+
}

alpine/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ ENV BACKUP_DAEMON_HOME=/opt/backup
44
ENV S3_CERT_PATH_INTERNAL=/s3CertInternal
55

66
ARG PY_APSW_VER="3.40.1.0"
7-
ARG PIP="22.2.0"
8-
ARG SETUPTOOLS="78.1.1"
7+
ARG PIP="25.3"
8+
ARG SETUPTOOLS="80.9.0"
99
ARG TMP_DIR="/tmp"
1010

1111
COPY requirements.txt ${BACKUP_DAEMON_HOME}/

requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ aniso8601==9.0.1
22
appdirs==1.4.4
33
apsw==3.40.1.0
44
attrs==21.4.0
5-
boto3==1.28.62
6-
botocore==1.31.62
5+
boto3==1.34.63
6+
botocore==1.34.63
77
CacheControl==0.12.10
88
certifi==2024.7.4
99
charset-normalizer==2.0.7
@@ -19,7 +19,7 @@ flask-restx==1.1.0
1919
html5lib==1.1
2020
idna==3.7
2121
itsdangerous==2.0.1
22-
Jinja2==3.1.5
22+
Jinja2==3.1.6
2323
jmespath==0.10.0
2424
jsonschema==4.4.0
2525
lockfile==0.12.2
@@ -37,12 +37,12 @@ pyrsistent==0.18.1
3737
python-dateutil==2.8.2
3838
pytz==2021.3
3939
PyYAML==6.0.1
40-
requests==2.31.0
40+
requests==2.32.4
4141
retrying==1.3.3
42-
s3transfer==0.7.0
42+
s3transfer==0.10.0
4343
six==1.16.0
4444
toml==0.10.2
4545
tomli==1.2.2
46-
urllib3==2.0.6
46+
urllib3==2.6.3
4747
webencodings==0.5.1
48-
Werkzeug==3.0.6
48+
Werkzeug==3.1.5

src/db.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import logging
16+
import threading
1617
import apsw
1718

1819

@@ -29,6 +30,8 @@ class DbException(Exception):
2930

3031

3132
class DB:
33+
_lock = threading.Lock()
34+
3235
def __init__(self, dbfile):
3336
"""
3437
Create a connection to sqlite database
@@ -41,7 +44,7 @@ def __init__(self, dbfile):
4144
self.__dbfile = dbfile
4245
try:
4346
log.debug("Database file: %s" % self.__dbfile)
44-
self.__cursor = DB.__create_connection(dbfile).cursor()
47+
self.__conn = DB.__create_connection(dbfile)
4548
except apsw.Error as err:
4649
log.exception("Database error during init: %s" % err)
4750
raise DbException("Database error during init")
@@ -67,24 +70,27 @@ def __create_connection(db_file):
6770

6871
def __create_table(self, query):
6972
try:
70-
self.__cursor.execute(query)
73+
cursor = self.__conn.cursor()
74+
with cursor:
75+
cursor.execute(query)
7176
except apsw.Error as err:
7277
log.exception("Database Error: %s" % err)
7378
return 0
7479

7580
@staticmethod
7681
def __log_and_execute(cursor, sql, args):
77-
log.debug("SQL command: " + sql.replace('?', '%s') % args)
78-
cursor.execute(sql, args)
82+
with DB._lock:
83+
log.debug("SQL command: " + sql.replace('?', '%s') % args)
84+
cursor.execute(sql, args)
7985

8086
def __insert_or_delete(self, query, params, login=False):
8187
try:
8288
if login:
8389
cursor = DB.__create_connection(self.__dbfile).cursor()
8490
else:
85-
cursor = self.__cursor
86-
87-
DB.__log_and_execute(cursor, query, params)
91+
cursor = self.__conn.cursor()
92+
with cursor:
93+
DB.__log_and_execute(cursor, query, params)
8894
return 1
8995
except apsw.Error as err:
9096
log.exception("Database Error: %s" % err)
@@ -95,10 +101,10 @@ def __select(self, query, params, login=False):
95101
if login:
96102
cursor = DB.__create_connection(self.__dbfile).cursor()
97103
else:
98-
cursor = self.__cursor
99-
100-
DB.__log_and_execute(cursor, query, params)
101-
return cursor.fetchall()
104+
cursor = self.__conn.cursor()
105+
with cursor:
106+
DB.__log_and_execute(cursor, query, params)
107+
return cursor.fetchall()
102108
except apsw.Error as err:
103109
log.exception("Database Error: %s" % err)
104110
return None

0 commit comments

Comments
 (0)