Skip to content

Commit 416d8e4

Browse files
authored
Merge pull request #61 from CESNET/develop
This PR upgrades to version 1.1.2 by removing unused JavaScript assets, migrating to a pyproject.toml–based build, cleaning up debug statements, and enhancing type safety in API views. Removed legacy setup.py and requirements-backup.txt in favor of pyproject.toml Deleted unused JS files under static/js and cleaned debug print calls Added type annotations in flowapp/views/api_common.py and updated configuration keys for rule limits
2 parents 17fab31 + 8a69d5e commit 416d8e4

File tree

19 files changed

+183
-1305
lines changed

19 files changed

+183
-1305
lines changed

.github/workflows/python-app.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ jobs:
2828
run: |
2929
python -m pip install --upgrade pip
3030
pip install flake8 pytest
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
# Install the package in editable mode with dev dependencies
32+
pip install -e .[dev]
3233
- name: Lint with flake8
3334
run: |
3435
# stop the build if there are Python syntax errors or undefined names

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The REST API is documented using Swagger (OpenAPI). After installing and running
5959

6060

6161
## Change Log
62+
- 1.1.2 - minor security updates (removed unused JS files), setup.py now reads dependencies from requirements.txt
6263
- 1.1.1 - Machine API Key rewrited.
6364
- API keys for machines are now tied to one of the existing users. If there is a need to have API access for machine, first create service user, and set the access rights. Then create machine key as Admin and assign it to this user.
6465
- 1.1.0 - Major Architecture Refactoring and Whitelist Integration

flowapp/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.1"
1+
__version__ = "1.1.2"

flowapp/models/utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def check_rule_limit(org_id: int, rule_type: RuleTypes) -> bool:
2222
:param rule_type: RuleType rule type
2323
:return: boolean
2424
"""
25-
flowspec_limit = current_app.config.get("FLOWSPEC_MAX_RULES", 9000)
25+
flowspec4_limit = current_app.config.get("FLOWSPEC4_MAX_RULES", 9000)
26+
flowspec6_limit = current_app.config.get("FLOWSPEC6_MAX_RULES", 9000)
2627
rtbh_limit = current_app.config.get("RTBH_MAX_RULES", 100000)
2728
fs4 = db.session.query(Flowspec4).filter_by(rstate_id=1).count()
2829
fs6 = db.session.query(Flowspec6).filter_by(rstate_id=1).count()
@@ -32,10 +33,10 @@ def check_rule_limit(org_id: int, rule_type: RuleTypes) -> bool:
3233
org = Organization.query.filter_by(id=org_id).first()
3334
if rule_type == RuleTypes.IPv4 and org.limit_flowspec4 > 0:
3435
count = db.session.query(Flowspec4).filter_by(org_id=org_id, rstate_id=1).count()
35-
return count >= org.limit_flowspec4 or fs4 >= flowspec_limit
36+
return count >= org.limit_flowspec4 or fs4 >= flowspec4_limit
3637
if rule_type == RuleTypes.IPv6 and org.limit_flowspec6 > 0:
3738
count = db.session.query(Flowspec6).filter_by(org_id=org_id, rstate_id=1).count()
38-
return count >= org.limit_flowspec6 or fs6 >= flowspec_limit
39+
return count >= org.limit_flowspec6 or fs6 >= flowspec6_limit
3940
if rule_type == RuleTypes.RTBH and org.limit_rtbh > 0:
4041
count = db.session.query(RTBH).filter_by(org_id=org_id, rstate_id=1).count()
4142
return count >= org.limit_rtbh or rtbh >= rtbh_limit
@@ -244,13 +245,11 @@ def get_user_actions(user_roles):
244245
Return list of actions based on current user role
245246
"""
246247
max_role = max(user_roles)
247-
print(max_role)
248248
if max_role == 3:
249249
actions = db.session.query(Action).order_by("id").all()
250250
else:
251251
actions = db.session.query(Action).filter_by(role_id=max_role).order_by("id").all()
252252
result = [(g.id, g.name) for g in actions]
253-
print(actions, result)
254253
return result
255254

256255

flowapp/static/js/check_all.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)