Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# Install the package in editable mode with dev dependencies
pip install -e .[dev]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The REST API is documented using Swagger (OpenAPI). After installing and running


## Change Log
- 1.1.2 - minor security updates (removed unused JS files), setup.py now reads dependencies from requirements.txt
- 1.1.1 - Machine API Key rewrited.
- 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.
- 1.1.0 - Major Architecture Refactoring and Whitelist Integration
Expand Down
2 changes: 1 addition & 1 deletion flowapp/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.1"
__version__ = "1.1.2"
9 changes: 4 additions & 5 deletions flowapp/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def check_rule_limit(org_id: int, rule_type: RuleTypes) -> bool:
:param rule_type: RuleType rule type
:return: boolean
"""
flowspec_limit = current_app.config.get("FLOWSPEC_MAX_RULES", 9000)
flowspec4_limit = current_app.config.get("FLOWSPEC4_MAX_RULES", 9000)
flowspec6_limit = current_app.config.get("FLOWSPEC6_MAX_RULES", 9000)
rtbh_limit = current_app.config.get("RTBH_MAX_RULES", 100000)
fs4 = db.session.query(Flowspec4).filter_by(rstate_id=1).count()
fs6 = db.session.query(Flowspec6).filter_by(rstate_id=1).count()
Expand All @@ -32,10 +33,10 @@ def check_rule_limit(org_id: int, rule_type: RuleTypes) -> bool:
org = Organization.query.filter_by(id=org_id).first()
if rule_type == RuleTypes.IPv4 and org.limit_flowspec4 > 0:
count = db.session.query(Flowspec4).filter_by(org_id=org_id, rstate_id=1).count()
return count >= org.limit_flowspec4 or fs4 >= flowspec_limit
return count >= org.limit_flowspec4 or fs4 >= flowspec4_limit
if rule_type == RuleTypes.IPv6 and org.limit_flowspec6 > 0:
count = db.session.query(Flowspec6).filter_by(org_id=org_id, rstate_id=1).count()
return count >= org.limit_flowspec6 or fs6 >= flowspec_limit
return count >= org.limit_flowspec6 or fs6 >= flowspec6_limit
if rule_type == RuleTypes.RTBH and org.limit_rtbh > 0:
count = db.session.query(RTBH).filter_by(org_id=org_id, rstate_id=1).count()
return count >= org.limit_rtbh or rtbh >= rtbh_limit
Expand Down Expand Up @@ -244,13 +245,11 @@ def get_user_actions(user_roles):
Return list of actions based on current user role
"""
max_role = max(user_roles)
print(max_role)
if max_role == 3:
actions = db.session.query(Action).order_by("id").all()
else:
actions = db.session.query(Action).filter_by(role_id=max_role).order_by("id").all()
result = [(g.id, g.name) for g in actions]
print(actions, result)
return result


Expand Down
15 changes: 0 additions & 15 deletions flowapp/static/js/check_all.js

This file was deleted.

Loading