Skip to content
Closed
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
33 changes: 33 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish Docker image

on:
release:
types: [created]

jobs:
push_to_registry:
name: Build and push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v3

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Publish Docker image' step
Uses Step
uses 'docker/login-action' with ref 'v3', not a pinned commit hash
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
Comment thread Dismissed
with:
images: falkordb/queryweaver

- name: Build and push Docker image
uses: docker/build-push-action@v5
Comment thread Dismissed
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Comment on lines +9 to +33

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 year ago

To fix the problem, add a permissions block to the workflow or the specific job to explicitly set the minimal required permissions for the GITHUB_TOKEN. In this case, since the workflow only checks out code and pushes to Docker Hub (using Docker credentials, not the GITHUB_TOKEN), it only needs read access to repository contents. The best way to fix this is to add permissions: contents: read at the top level of the workflow (just after the name and before on:), so it applies to all jobs in the workflow. No changes to imports or other code are necessary.


Suggested changeset 1
.github/workflows/publish-docker.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml
--- a/.github/workflows/publish-docker.yml
+++ b/.github/workflows/publish-docker.yml
@@ -1,2 +1,4 @@
 name: Publish Docker image
+permissions:
+  contents: read
 
EOF
@@ -1,2 +1,4 @@
name: Publish Docker image
permissions:
contents: read

Copilot is powered by AI and may make mistakes. Always verify output.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tqdm = "~=4.67.1"
boto3 = "~=1.37.29"
psycopg2-binary = "~=2.9.9"
flask-dance = "~=7.1.0"
disposable-email-domains = "~=0.0.129"

[dev-packages]
pytest = "~=8.2.0"
Expand Down
33 changes: 20 additions & 13 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions api/app_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
from flask_dance.consumer.storage.session import SessionStorage

from api.auth.oauth_handlers import setup_oauth_handlers
from api.routes.auth import auth_bp
from api.routes.main import main_bp
from api.routes.graphs import graphs_bp
from api.routes.database import database_bp
from api.routes.organization import organization_bp

# Load environment variables from .env file
load_dotenv()
Expand Down Expand Up @@ -59,9 +60,10 @@ def create_app():
setup_oauth_handlers(google_bp, github_bp)

# Register blueprints
app.register_blueprint(auth_bp)
app.register_blueprint(main_bp)
app.register_blueprint(graphs_bp)
app.register_blueprint(database_bp)
app.register_blueprint(organization_bp)

@app.errorhandler(Exception)
def handle_oauth_error(error):
Expand All @@ -70,7 +72,7 @@ def handle_oauth_error(error):
if "token" in str(error).lower() or "oauth" in str(error).lower():
logging.warning("OAuth error occurred: %s", error)
session.clear()
return redirect(url_for("auth.home"))
return redirect(url_for("main.home"))

# If it's an HTTPException (like abort(403)), re-raise so Flask handles it properly
if isinstance(error, HTTPException):
Expand Down
Loading
Loading