-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/github-pages-connector
- Loading branch information
Showing
338 changed files
with
12,173 additions
and
5,606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Scan for problematic software licenses | ||
|
||
# trivy has their own rate limiting issues causing this action to flake | ||
# we worked around it by hardcoding to different db repos in env | ||
# can re-enable when they figure it out | ||
# https://github.com/aquasecurity/trivy/discussions/7538 | ||
# https://github.com/aquasecurity/trivy-action/issues/389 | ||
|
||
name: 'Nightly - Scan licenses' | ||
on: | ||
# schedule: | ||
# - cron: '0 14 * * *' # Runs every day at 6 AM PST / 7 AM PDT / 2 PM UTC | ||
workflow_dispatch: # Allows manual triggering | ||
|
||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
jobs: | ||
scan-licenses: | ||
# See https://runs-on.com/runners/linux/ | ||
runs-on: [runs-on,runner=2cpu-linux-x64,"run-id=${{ github.run_id }}"] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
cache-dependency-path: | | ||
backend/requirements/default.txt | ||
backend/requirements/dev.txt | ||
backend/requirements/model_server.txt | ||
- name: Get explicit and transitive dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install --retries 5 --timeout 30 -r backend/requirements/default.txt | ||
pip install --retries 5 --timeout 30 -r backend/requirements/dev.txt | ||
pip install --retries 5 --timeout 30 -r backend/requirements/model_server.txt | ||
pip freeze > requirements-all.txt | ||
- name: Check python | ||
id: license_check_report | ||
uses: pilosus/action-pip-license-checker@v2 | ||
with: | ||
requirements: 'requirements-all.txt' | ||
fail: 'Copyleft' | ||
exclude: '(?i)^(pylint|aio[-_]*).*' | ||
|
||
- name: Print report | ||
if: ${{ always() }} | ||
run: echo "${{ steps.license_check_report.outputs.report }}" | ||
|
||
- name: Install npm dependencies | ||
working-directory: ./web | ||
run: npm ci | ||
|
||
- name: Run Trivy vulnerability scanner in repo mode | ||
uses: aquasecurity/trivy-action@0.28.0 | ||
with: | ||
scan-type: fs | ||
scanners: license | ||
format: table | ||
# format: sarif | ||
# output: trivy-results.sarif | ||
severity: HIGH,CRITICAL | ||
|
||
# - name: Upload Trivy scan results to GitHub Security tab | ||
# uses: github/codeql-action/upload-sarif@v3 | ||
# with: | ||
# sarif_file: trivy-results.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
backend/alembic/versions/5b29123cd710_nullable_search_settings_for_historic_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
"""nullable search settings for historic index attempts | ||
Revision ID: 5b29123cd710 | ||
Revises: 949b4a92a401 | ||
Create Date: 2024-10-30 19:37:59.630704 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "5b29123cd710" | ||
down_revision = "949b4a92a401" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# Drop the existing foreign key constraint | ||
op.drop_constraint( | ||
"fk_index_attempt_search_settings", "index_attempt", type_="foreignkey" | ||
) | ||
|
||
# Modify the column to be nullable | ||
op.alter_column( | ||
"index_attempt", "search_settings_id", existing_type=sa.INTEGER(), nullable=True | ||
) | ||
|
||
# Add back the foreign key with ON DELETE SET NULL | ||
op.create_foreign_key( | ||
"fk_index_attempt_search_settings", | ||
"index_attempt", | ||
"search_settings", | ||
["search_settings_id"], | ||
["id"], | ||
ondelete="SET NULL", | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
# Warning: This will delete all index attempts that don't have search settings | ||
op.execute( | ||
""" | ||
DELETE FROM index_attempt | ||
WHERE search_settings_id IS NULL | ||
""" | ||
) | ||
|
||
# Drop foreign key constraint | ||
op.drop_constraint( | ||
"fk_index_attempt_search_settings", "index_attempt", type_="foreignkey" | ||
) | ||
|
||
# Modify the column to be not nullable | ||
op.alter_column( | ||
"index_attempt", | ||
"search_settings_id", | ||
existing_type=sa.INTEGER(), | ||
nullable=False, | ||
) | ||
|
||
# Add back the foreign key without ON DELETE SET NULL | ||
op.create_foreign_key( | ||
"fk_index_attempt_search_settings", | ||
"index_attempt", | ||
"search_settings", | ||
["search_settings_id"], | ||
["id"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.