Skip to content

Commit 6fbd4da

Browse files
fix(security): use sha256 instead of sha1 for hashing
1 parent 7279b81 commit 6fbd4da

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/edit_python_pe/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _compute_file_name(aliases: list[str], name: str, email: str) -> str:
3434
else:
3535
alias_for_name = name.lower().replace(" ", "_")
3636

37-
sha_hash = hashlib.sha1(
37+
sha_hash = hashlib.sha256(
3838
(alias_for_name + email + datetime.now().isoformat()).encode("utf-8")
3939
).hexdigest()[:8]
4040
return f"{alias_for_name}-{sha_hash}.md"
@@ -188,9 +188,9 @@ def create_pr(
188188
pr_title = commit_msg
189189
first_alias = aliases[0] if aliases else ""
190190
pr_body = (
191-
f"Changing an entry to `blog/members` for {name} (alias: {first_alias})."
191+
f"Changing an entry to `blog/members` for {name} (alias: {first_alias})." # noqa: E501
192192
if current_file
193-
else f"Creating a new entry to `blog/members` for {name} (alias: {first_alias})."
193+
else f"Creating a new entry to `blog/members` for {name} (alias: {first_alias})." # noqa: E501
194194
)
195195
fork_owner = forked_repo.owner.login
196196
head_branch = f"{fork_owner}:main"
@@ -208,7 +208,7 @@ def create_pr(
208208
pr_found = pr
209209
break
210210
if pr_found:
211-
# Push to the PR branch (simulate, as actual branch logic may differ)
211+
# Push to the PR branch (simulate, as actual branch logic may differ) # noqa: E501
212212
remote.push([repo.head.name], callbacks=callbacks)
213213
return MESSAGE_FILE_EDITED_PR.format(name_file=name_file)
214214
else:
@@ -311,14 +311,14 @@ def load_file_into_form(app: MemberApp, filename: str) -> None:
311311
if python_match:
312312
app.python_area.text = python_match.group(1).strip()
313313
contrib_match = re.search(
314-
r"### ¿Tienes algún aporte a la comunidad de Python\?\n(.*?)(?=^### |\Z)",
314+
r"### ¿Tienes algún aporte a la comunidad de Python\?\n(.*?)(?=^### |\Z)", # noqa: E501
315315
content,
316316
re.DOTALL | re.MULTILINE,
317317
)
318318
if contrib_match:
319319
app.contributions_area.text = contrib_match.group(1).strip()
320320
avail_match = re.search(
321-
r"### ¿Estás disponible para hacer mentoring, consultorías, charlas\?\n(.*?)(?=^### |\Z)",
321+
r"### ¿Estás disponible para hacer mentoring, consultorías, charlas\?\n(.*?)(?=^### |\Z)", # noqa: E501
322322
content,
323323
re.DOTALL | re.MULTILINE,
324324
)

0 commit comments

Comments
 (0)