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

[FIX] Security - useing Safeloader #3459

Open
wants to merge 5 commits into
base: 3.1.x
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion sapl/legacy/migracao_usuarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def migrar_usuarios(dir_repo):

ARQUIVO_USUARIOS = Path(dir_repo).child('usuarios.yaml')
with open(ARQUIVO_USUARIOS, 'r') as f:
usuarios = yaml.load(f, yaml.Loader)
usuarios = yaml.load(f, yaml.SafeLoader)
# conferimos de que só há um nome de usuário
assert all(nome == dados['name'] for nome, dados in usuarios.items())
usuarios = [
Expand Down
4 changes: 2 additions & 2 deletions sapl/legacy/scripts/ressuscita_dependencias.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def get_apaga_materias_de_proposicoes(fks, slug):
def get_dependencias_a_ressuscitar(slug):
ocorrencias = yaml.load(
Path(DIR_REPO.child('ocorrencias.yaml').read_file()),
yaml.Loader
yaml.SafeLoader
)
fks_faltando = ocorrencias.get('fk')
if not fks_faltando:
Expand Down Expand Up @@ -414,7 +414,7 @@ def get_ressuscitar(slug):
def get_slug():
arq = DIR_DADOS_MIGRACAO.child('siglas_para_slugs.yaml')
with open(arq, 'r') as arq:
siglas_para_slugs = yaml.load(arq, yaml.Loader)
siglas_para_slugs = yaml.load(arq, yaml.SafeLoader)
sigla = NOME_BANCO_LEGADO[-3:]
return siglas_para_slugs[sigla]

Expand Down
2 changes: 1 addition & 1 deletion sapl/legacy_migration_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
SIGLA_CASA = match.group(1)
_PATH_TABELA_TIMEZONES = DIR_DADOS_MIGRACAO.child('tabela_timezones.yaml')
with open(_PATH_TABELA_TIMEZONES, 'r') as arq:
tabela_timezones = yaml.load(arq, yaml.Loader)
tabela_timezones = yaml.load(arq, yaml.SafeLoader)
municipio, uf, nome_timezone = tabela_timezones[SIGLA_CASA]
if nome_timezone:
PYTZ_TIMEZONE = pytz.timezone(nome_timezone)
Expand Down
2 changes: 1 addition & 1 deletion sapl/test_crispy_layout_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_read_layout_from_yaml(tmpdir):
- highlander '''

with mock.patch('sapl.crispy_layout_mixin.read_yaml_from_file') as ryff:
ryff.return_value = yaml.load(stub_content, yaml.Loader)
ryff.return_value = yaml.load(stub_content, yaml.SafeLoader)
assert read_layout_from_yaml('....', 'ModelName') == [
['Cool Legend',
[('name', 9), ('place', 2), ('tiny', 1)],
Expand Down