Skip to content
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

Bookworm + Portal rework #1657

Draft
wants to merge 518 commits into
base: dev
Choose a base branch
from
Draft

Bookworm + Portal rework #1657

wants to merge 518 commits into from

Conversation

alexAubin
Copy link
Member

@alexAubin alexAubin force-pushed the bookworm branch 2 times, most recently from cd1bb22 to bed9ecc Compare May 15, 2023 20:13
debian/changelog Outdated Show resolved Hide resolved
src/user.py Fixed Show fixed Hide fixed
@alexAubin alexAubin force-pushed the bookworm branch 4 times, most recently from 945ecdb to 8ac48ee Compare June 14, 2023 06:07
@alexAubin alexAubin added the 🏗️ Major project Big decision label Jul 10, 2023
src/dyndns.py Fixed Show fixed Hide fixed
src/dyndns.py Fixed Show fixed Hide fixed
src/utils/form.py Fixed Show fixed Hide fixed
src/utils/form.py Fixed Show fixed Hide fixed
src/utils/form.py Fixed Show fixed Hide fixed
src/utils/form.py Fixed Show fixed Hide fixed
src/utils/form.py Fixed Show fixed Hide fixed
@alexAubin alexAubin changed the title Bookworm Bookworm + Portal rework Sep 27, 2023
src/authenticators/ldap_ynhuser.py Fixed Show fixed Hide fixed
allowed_cors_origins_file = "/etc/yunohost/.admin-api-allowed-cors-origins"

if os.path.exists(allowed_cors_origins_file):
allowed_cors_origins = open(allowed_cors_origins_file).read().strip().split(",")

Check warning

Code scanning / CodeQL

File is not always closed Warning

File is opened but is not closed.
allowed_cors_origins_file = "/etc/yunohost/.portal-api-allowed-cors-origins"

if os.path.exists(allowed_cors_origins_file):
allowed_cors_origins = open(allowed_cors_origins_file).read().strip().split(",")

Check warning

Code scanning / CodeQL

File is not always closed Warning

File is opened but is not closed.
@alexAubin alexAubin marked this pull request as draft September 27, 2023 18:12
@alexAubin alexAubin force-pushed the bookworm branch 2 times, most recently from 5322f83 to fae3b67 Compare October 6, 2023 15:22
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

export experimental="$(yunohost settings get 'security.experimental.security_experimental_enabled' | int_to_bool)"
export redirect_to_https="$(jq -r '.nginx_redirect_to_https' <<< "$YNH_SETTINGS" | int_to_bool)"
export compatibility="$(jq -r '.nginx_compatibility' <<< "$YNH_SETTINGS" | int_to_bool)"
export experimental="$(jq -r '.security_experimental_enabled' <<< "$YNH_SETTINGS" | int_to_bool)"
Copy link
Member

@kay0u kay0u Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is moving security.experimental.security_experimental_enabled to security.nginx.security_experimental_enabled intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uuuh not sure what you mean ? The setting "long name" is still security.experimental.security_experimental_enabled but $YNH_SETTINGS contains only the short name for whatever reason

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, I misread the python code associated with the commit

if not option.is_visible(context):
if isinstance(option, BaseInputOption):
# FIXME There could be several use case if the question is not displayed:
# - we doesn't want to give a specific value
# - we want to keep the previous value
# - we want the default value
option.value = context[option.id] = None
context[option.id] = None

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
option.choices if isinstance(option, BaseChoicesOption) else []
)
# only update the context with the value
context[option.id] = option.normalize(form[option.id])

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
option = next(opt for opt in options if option.id == option_id)
if option and isinstance(option, BaseInputOption):
form[option.id] = option.normalize(value, option)
context[option.id] = form[option.id]

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
# ╰───────────────────────────────────────────────────────╯

if TYPE_CHECKING:
FilterKey = Sequence[Union[str, None]]

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'FilterKey' is not used.

if TYPE_CHECKING:
FilterKey = Sequence[Union[str, None]]
RawConfig = OrderedDict[str, Any]

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'RawConfig' is not used.

def print_config_panel_docs():
fname = "../src/utils/configpanel.py"
content = open(fname).read()

Check warning

Code scanning / CodeQL

File is not always closed Warning documentation

File is opened but is not closed.

def print_form_doc():
fname = "../src/utils/form.py"
content = open(fname).read()

Check warning

Code scanning / CodeQL

File is not always closed Warning documentation

File is opened but is not closed.
src/utils/form.py Fixed Show fixed Hide fixed
src/authenticators/ldap_ynhuser.py Fixed Show fixed Hide fixed
src/tests/test_permission.py Dismissed Show dismissed Hide dismissed
…that users can't log in or add mail aliases for a domain they aint allowed to access. The fact that they are able to access a domain is derived from the fact that they have access to at least one app on that domain (actually .. we may want to bypass this check for admins, otherwise this is gonna be hella confusing for fresh intalls).
src/authenticators/ldap_ynhuser.py Fixed Show fixed Hide fixed
src/authenticators/ldap_ynhuser.py Fixed Show fixed Hide fixed
try:
# Normalize and validate
form[option.id] = option.normalize(value, option)
context[option.id] = form[option.id]

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
context[option.id] = form[option.id]
# In case of boolean option, yes/no may be custom, set a true boolean as context
if isinstance(option, BooleanOption) and form[option.id] is not None:
context[option.id] = form[option.id] == option.yes

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
if can_install_letsencrypt:
try:
_certificate_install_letsencrypt([domain], force=True, no_checks=True)
except:

Check notice

Code scanning / CodeQL

Except block handles 'BaseException' Note

Except block directly handles BaseException.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants