-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release v0.4.0 #79
Release v0.4.0 #79
Conversation
…branch provisioning
… during branch provisioning
* Closes #52: Introduce the max_branches config parameter * Improve documentation for config parameter
* add pyproject.toml Signed-off-by: Michal Fiedorowicz <[email protected]> * add docker-compose setup based on NetBox v4.1-beta1-2.9.1 image with netbox_branching plugin installed Signed-off-by: Michal Fiedorowicz <[email protected]> * add Makefile recipes for docker compose Signed-off-by: Michal Fiedorowicz <[email protected]> * add GHA workflow to run lint and test Signed-off-by: Michal Fiedorowicz <[email protected]> * tidy up docker-compose.yaml Signed-off-by: Michal Fiedorowicz <[email protected]> * move workflow into correct directory Signed-off-by: Michal Fiedorowicz <[email protected]> * fix mounting of local_settings.py Signed-off-by: Michal Fiedorowicz <[email protected]> * ignore missing docstrings checks Signed-off-by: Michal Fiedorowicz <[email protected]> * add step for building documentation Signed-off-by: Michal Fiedorowicz <[email protected]> * catch make docker-compose-test exit code (test) Signed-off-by: Michal Fiedorowicz <[email protected]> * catch make docker-compose-test exit code (test 2) Signed-off-by: Michal Fiedorowicz <[email protected]> * tidy up make docker-compose-test Signed-off-by: Michal Fiedorowicz <[email protected]> * rename GHA job Signed-off-by: Michal Fiedorowicz <[email protected]> * ignore all missing docstrings Signed-off-by: Michal Fiedorowicz <[email protected]> * change workflow file ext Signed-off-by: Michal Fiedorowicz <[email protected]> * run tests with more native way with matrix of python versions Signed-off-by: Michal Fiedorowicz <[email protected]> * fix matrix with python version Signed-off-by: Michal Fiedorowicz <[email protected]> * fix test command for plugin Signed-off-by: Michal Fiedorowicz <[email protected]> * list tests Signed-off-by: Michal Fiedorowicz <[email protected]> * comment out exclude-package-data from pyproject.toml Signed-off-by: Michal Fiedorowicz <[email protected]> * tidy up Signed-off-by: Michal Fiedorowicz <[email protected]> * keep db when running tests Signed-off-by: Michal Fiedorowicz <[email protected]> * Remove v4.1-beta1 tag --------- Signed-off-by: Michal Fiedorowicz <[email protected]> Co-authored-by: Jeremy Stretch <[email protected]>
…a new object within a branch
… is modified in main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Jit has detected 5 important findings in this PR that you should review.
The findings are detailed below as separate comments.
It’s highly recommended that you fix these security issues before merge.
) | ||
# Copy data from the source table | ||
cursor.execute( | ||
f"INSERT INTO {schema}.{table} SELECT * FROM public.{table}" | ||
f"INSERT INTO {schema_table} SELECT * FROM {main_table}" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security control: Static Code Analysis Python Semgrep
Type: Python.Sqlalchemy.Security.Sqlalchemy-Execute-Raw-Query.Sqlalchemy-Execute-Raw-Query
Description: Avoiding SQL string concatenation: untrusted input concatenated with raw SQL query can result in SQL Injection. In order to execute raw query safely, prepared statement should be used. SQLAlchemy provides TextualSQL to easily used prepared statement with named parameters. For complex SQL composition, use SQL Expression Language or Schema Definition Language. In most cases, SQLAlchemy ORM will be a better option.
Severity: HIGH
Jit Bot commands and options (e.g., ignore issue)
You can trigger Jit actions by commenting on this PR review:
#jit_ignore_fp
Ignore and mark this specific single instance of finding as “False Positive”#jit_ignore_accept
Ignore and mark this specific single instance of finding as “Accept Risk”#jit_ignore_type_in_file
Ignore any finding of type "python.sqlalchemy.security.sqlalchemy-execute-raw-query.sqlalchemy-execute-raw-query" in netbox_branching/models/branches.py; future occurrences will also be ignored.#jit_undo_ignore
Undo ignore command
# Create the table in the new schema | ||
cursor.execute( | ||
f"CREATE TABLE {schema}.{table} ( LIKE public.{table} INCLUDING INDEXES )" | ||
f"CREATE TABLE {schema_table} ( LIKE {main_table} INCLUDING INDEXES )" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security control: Static Code Analysis Python Semgrep
Type: Python.Sqlalchemy.Security.Sqlalchemy-Execute-Raw-Query.Sqlalchemy-Execute-Raw-Query
Description: Avoiding SQL string concatenation: untrusted input concatenated with raw SQL query can result in SQL Injection. In order to execute raw query safely, prepared statement should be used. SQLAlchemy provides TextualSQL to easily used prepared statement with named parameters. For complex SQL composition, use SQL Expression Language or Schema Definition Language. In most cases, SQLAlchemy ORM will be a better option.
Severity: HIGH
Jit Bot commands and options (e.g., ignore issue)
You can trigger Jit actions by commenting on this PR review:
#jit_ignore_fp
Ignore and mark this specific single instance of finding as “False Positive”#jit_ignore_accept
Ignore and mark this specific single instance of finding as “Accept Risk”#jit_ignore_type_in_file
Ignore any finding of type "python.sqlalchemy.security.sqlalchemy-execute-raw-query.sqlalchemy-execute-raw-query" in netbox_branching/models/branches.py; future occurrences will also be ignored.#jit_undo_ignore
Undo ignore command
cursor.execute( | ||
f"CREATE TABLE {schema}.{table} ( LIKE public.{table} INCLUDING INDEXES )" | ||
f"CREATE TABLE {schema_table} ( LIKE {main_table} INCLUDING INDEXES )" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security control: Static Code Analysis Python Semgrep
Type: Python.Sqlalchemy.Security.Sqlalchemy-Execute-Raw-Query.Sqlalchemy-Execute-Raw-Query
Description: Avoiding SQL string concatenation: untrusted input concatenated with raw SQL query can result in SQL Injection. In order to execute raw query safely, prepared statement should be used. SQLAlchemy provides TextualSQL to easily used prepared statement with named parameters. For complex SQL composition, use SQL Expression Language or Schema Definition Language. In most cases, SQLAlchemy ORM will be a better option.
Severity: HIGH
Jit Bot commands and options (e.g., ignore issue)
You can trigger Jit actions by commenting on this PR review:
#jit_ignore_fp
Ignore and mark this specific single instance of finding as “False Positive”#jit_ignore_accept
Ignore and mark this specific single instance of finding as “Accept Risk”#jit_ignore_type_in_file
Ignore any finding of type "python.sqlalchemy.security.sqlalchemy-execute-raw-query.sqlalchemy-execute-raw-query" in netbox_branching/models/branches.py; future occurrences will also be ignored.#jit_undo_ignore
Undo ignore command
# Set the default value for the ID column to the sequence associated with the source table | ||
cursor.execute( | ||
f"ALTER TABLE {schema}.{table} ALTER COLUMN id SET DEFAULT nextval('public.{table}_id_seq')" | ||
f"ALTER TABLE {schema_table} ALTER COLUMN id SET DEFAULT nextval(%s)", [sequence_name] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security control: Static Code Analysis Python Semgrep
Type: Python.Sqlalchemy.Security.Sqlalchemy-Execute-Raw-Query.Sqlalchemy-Execute-Raw-Query
Description: Avoiding SQL string concatenation: untrusted input concatenated with raw SQL query can result in SQL Injection. In order to execute raw query safely, prepared statement should be used. SQLAlchemy provides TextualSQL to easily used prepared statement with named parameters. For complex SQL composition, use SQL Expression Language or Schema Definition Language. In most cases, SQLAlchemy ORM will be a better option.
Severity: HIGH
Jit Bot commands and options (e.g., ignore issue)
You can trigger Jit actions by commenting on this PR review:
#jit_ignore_fp
Ignore and mark this specific single instance of finding as “False Positive”#jit_ignore_accept
Ignore and mark this specific single instance of finding as “Accept Risk”#jit_ignore_type_in_file
Ignore any finding of type "python.sqlalchemy.security.sqlalchemy-execute-raw-query.sqlalchemy-execute-raw-query" in netbox_branching/models/branches.py; future occurrences will also be ignored.#jit_undo_ignore
Undo ignore command
cursor.execute( | ||
f"ALTER TABLE {schema}.{table} " | ||
f"ALTER COLUMN id SET DEFAULT nextval('public.{table}_id_seq')" | ||
f"ALTER TABLE {schema_table} ALTER COLUMN id SET DEFAULT nextval(%s)", [sequence_name] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Security control: Static Code Analysis Python Semgrep
Type: Python.Sqlalchemy.Security.Sqlalchemy-Execute-Raw-Query.Sqlalchemy-Execute-Raw-Query
Description: Avoiding SQL string concatenation: untrusted input concatenated with raw SQL query can result in SQL Injection. In order to execute raw query safely, prepared statement should be used. SQLAlchemy provides TextualSQL to easily used prepared statement with named parameters. For complex SQL composition, use SQL Expression Language or Schema Definition Language. In most cases, SQLAlchemy ORM will be a better option.
Severity: HIGH
Jit Bot commands and options (e.g., ignore issue)
You can trigger Jit actions by commenting on this PR review:
#jit_ignore_fp
Ignore and mark this specific single instance of finding as “False Positive”#jit_ignore_accept
Ignore and mark this specific single instance of finding as “Accept Risk”#jit_ignore_type_in_file
Ignore any finding of type "python.sqlalchemy.security.sqlalchemy-execute-raw-query.sqlalchemy-execute-raw-query" in netbox_branching/models/branches.py; future occurrences will also be ignored.#jit_undo_ignore
Undo ignore command
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct, versions are updated.
Enhancements
max_branches
config parameterBug Fixes
BranchAwareRouter
should consider branching support for model when determining database connection to use