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
7 changes: 6 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extend-select = [
'PLE', # pylint errors
'PLR', # pylint refactors
'PLW', # pylint warnings
# 'S', # flake8-bandit
'S', # flake8-bandit
'SIM', # flake8-simplify
'UP', # pyupgrade
'W' # pycodestyle
Expand All @@ -36,3 +36,8 @@ known-first-party = [
'user_agent',
'typings'
]

[lint.per-file-ignores]
"**/test_*.py" = [
"S101" # allow using assert in tests
]
2 changes: 1 addition & 1 deletion scripts/download_sa_advisories.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def download_sa_advisories_from_rest_api(last_modified_timestamp: int) -> None:
retry = True
while url != '':
print(f'fetching {url}')
response = requests.get(url, headers={'user-agent': user_agent})
response = requests.get(url, headers={'user-agent': user_agent}, timeout=60)

# if we're making too many requests and have not already retried the current
# url, wait the requested number of seconds before doing a retry
Expand Down
5 changes: 4 additions & 1 deletion scripts/generate_osv_advisories.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def fetch_drupal_node(nid: str) -> drupal.Node:
resp = requests.get(
f'https://www.drupal.org/api-d7/node/{nid}.json',
headers={'user-agent': user_agent},
timeout=60,
)

if resp.status_code == 200:
Expand Down Expand Up @@ -365,7 +366,9 @@ def fetch_drupal_packages_available_on_packagist() -> list[str]:
"""
Fetches a list of all Drupal packages that are available on packagist.org
"""
resp = requests.get('https://packagist.org/packages/list.json?vendor=drupal')
resp = requests.get(
'https://packagist.org/packages/list.json?vendor=drupal', timeout=60
)

if resp.status_code != 200:
raise RuntimeError(
Expand Down
3 changes: 2 additions & 1 deletion scripts/list_changed_advisories.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import subprocess

output = subprocess.check_output(
['git', 'status', '--untracked-files', '--porcelain'], text=True
['git', 'status', '--untracked-files', '--porcelain'], # noqa: S607
text=True,
)

for line in output.split('\n'):
Expand Down
2 changes: 1 addition & 1 deletion scripts/precache_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def fetch_drupal_nodes(nids: list[str], retry: bool = True) -> list[drupal.Node]
for nid in nids:
url += f'nid[]={nid}&'

resp = requests.get(url, headers={'user-agent': user_agent})
resp = requests.get(url, headers={'user-agent': user_agent}, timeout=60)

if retry and resp.status_code == 429:
seconds = int(resp.headers.get('Retry-After', 0))
Expand Down
3 changes: 2 additions & 1 deletion scripts/validate_advisories.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
report_valid = False

resp = requests.get(
'https://raw.githubusercontent.com/ossf/osv-schema/refs/heads/main/validation/schema.json'
'https://raw.githubusercontent.com/ossf/osv-schema/refs/heads/main/validation/schema.json',
timeout=60,
)

if resp.status_code != 200:
Expand Down