Skip to content

Add Registries and its metadata creation part#18

Open
ghimiresdp wants to merge 12 commits intomainfrom
feature/registries
Open

Add Registries and its metadata creation part#18
ghimiresdp wants to merge 12 commits intomainfrom
feature/registries

Conversation

@ghimiresdp
Copy link
Copy Markdown
Owner

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation
  • Performance improvement

Checklist

  • I have run cargo fmt to ensure consistent code style.
  • I have run cargo test and all tests passed.
  • I have added new tests that prove my fix is effective or that my feature works.
  • I have updated the README.md (if applicable).

Performance Impact

Comment on lines +11 to +49
name: Build APT package
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: Install Debian packaging tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
debhelper \
devscripts \
pkg-config

- name: Build Debian package
run: |
cd registries/apt
dpkg-buildpackage -us -uc -b

- name: Collect Debian artifacts
run: |
mkdir -p artifacts/apt
find registries -maxdepth 1 -type f -name "*.deb" -exec cp {} artifacts/apt/ \;

- name: Upload Debian artifacts
uses: actions/upload-artifact@v4
with:
name: apt-package
path: artifacts/apt/*.deb

build_flatpak:

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 23 days ago

In general, the fix is to define an explicit permissions: block that grants only the minimal required scopes for the GITHUB_TOKEN, either at the workflow root (applies to all jobs) or per job. Since neither job needs to modify repository contents, a restrictive root‑level block such as permissions: { contents: read } is appropriate; the jobs use actions/checkout and actions/upload-artifact, both of which work with contents: read and do not require write access.

The best fix here without changing existing functionality is to add a single permissions: block at the top level of .github/workflows/package-registries.yml, between on: and env: (or directly under name: / on:), setting contents: read. No job appears to need any additional scopes (packages, pull-requests, etc.), and there are no GitHub API calls that would require broader access. This single block will satisfy CodeQL, document the required permissions, and ensure that if the repo/org defaults change, this workflow continues to run with only read access to repository contents.

Concretely, edit .github/workflows/package-registries.yml to insert:

permissions:
    contents: read

just after the on: block (line 5), leaving the rest of the workflow unchanged.

Suggested changeset 1
.github/workflows/package-registries.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/package-registries.yml b/.github/workflows/package-registries.yml
--- a/.github/workflows/package-registries.yml
+++ b/.github/workflows/package-registries.yml
@@ -3,6 +3,9 @@
 on:
     workflow_dispatch:
 
+permissions:
+    contents: read
+
 env:
     CARGO_TERM_COLOR: always
 
EOF
@@ -3,6 +3,9 @@
on:
workflow_dispatch:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

Copilot is powered by AI and may make mistakes. Always verify output.
Comment on lines +50 to +90
name: Build Flatpak bundle
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Flatpak tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
flatpak \
flatpak-builder \
curl

- name: Install Flatpak runtimes
run: |
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08

- name: Resolve source SHA when placeholder is present
run: |
manifest="registries/flatpak/io.github.ghimiresdp.furl.yml"
if grep -q "REPLACE_WITH_ACTUAL_SHA256" "$manifest"; then
url=$(grep -E "^[[:space:]]*url:" "$manifest" | head -n 1 | sed -E "s/^[[:space:]]*url:[[:space:]]*//")
curl -L "$url" -o /tmp/furl-source.tar.gz
sha=$(sha256sum /tmp/furl-source.tar.gz | awk '{print $1}')
sed -i "s/REPLACE_WITH_ACTUAL_SHA256/$sha/" "$manifest"
fi

- name: Build Flatpak repo and bundle
run: |
mkdir -p artifacts/flatpak
flatpak-builder --force-clean --repo=flatpak-repo flatpak-build registries/flatpak/io.github.ghimiresdp.furl.yml
flatpak build-bundle flatpak-repo artifacts/flatpak/io.github.ghimiresdp.furl.flatpak io.github.ghimiresdp.furl

- name: Upload Flatpak artifacts
uses: actions/upload-artifact@v4
with:
name: flatpak-bundle
path: artifacts/flatpak/*.flatpak

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 23 days ago

In general, fix this by explicitly setting a restricted permissions block for the workflow (applies to all jobs) or for each job individually. For this workflow, both jobs only need to read repository contents (for checkout) and upload artifacts (which does not require repo write permissions), so we can safely restrict the GITHUB_TOKEN to contents: read at the top level. This documents the intended permissions and prevents the token from obtaining broader rights if repo/org defaults change or the workflow is copied elsewhere.

The best minimal fix without changing functionality is to add a root-level permissions: section beneath the on: block in .github/workflows/package-registries.yml, with contents: read. This will apply to both build_apt and build_flatpak jobs since neither defines its own permissions block. No other changes, imports, or YAML restructuring are necessary.

Suggested changeset 1
.github/workflows/package-registries.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/package-registries.yml b/.github/workflows/package-registries.yml
--- a/.github/workflows/package-registries.yml
+++ b/.github/workflows/package-registries.yml
@@ -3,6 +3,9 @@
 on:
     workflow_dispatch:
 
+permissions:
+    contents: read
+
 env:
     CARGO_TERM_COLOR: always
 
EOF
@@ -3,6 +3,9 @@
on:
workflow_dispatch:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always

Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants