Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6624995
fix(security): remediation bundle — AES-256-GCM, DOMPurify, WebSocket…
Jul 28, 2026
f08fe6e
fix(review): address AI scanner findings
Jul 28, 2026
957e149
fix(review): address second OCR scan findings (#193-#197)
Jul 28, 2026
68b49b8
fix(review): collapse redundant if/else in droplet-interface.ts
Jul 28, 2026
95c672f
fix(review): address third OCR scan (#191)
Jul 28, 2026
ce4404d
fix(review): address fourth OCR scan — key zeroing, URI regexp, WS ha…
Jul 28, 2026
a88864e
fix(review): fix URI regexp regression + WS dead code
Jul 28, 2026
5286f72
fix(ci): allow sonar-pr-comment to run when quality gate fails
Jul 28, 2026
8f98e92
fix(review): minor cleanup — semver consistency + sanitize error logging
Jul 28, 2026
3e7bf2d
fix(review): expose resetHooks() for test/HMR cleanup
Jul 28, 2026
c6790e2
fix(review): DoS timeout, remove ftp from URI regexp, add auth failur…
Jul 28, 2026
773a8f1
fix(review): address OCR timeout suggestions + fix CI lint + cargo audit
Jul 28, 2026
b396cbc
chore(hooks): add ocr review to pre-push hook
Jul 28, 2026
a67ea0b
chore(hooks): add non-blocking ocr review to pre-push hook
Jul 28, 2026
357606f
fix(review): address OCR race condition + hook cleanup findings
Jul 28, 2026
09991f1
fix(review): address 12 OCR findings across 6 files
Jul 28, 2026
863ca0b
fix(hooks): refine base branch detection — skip self-tracking upstream
Jul 28, 2026
8439c5e
chore: sync pnpm-lock after removing dompurify dep
Jul 28, 2026
094f9f7
fix(hooks): mktemp template — move XXXXXX to end for macOS compat
Jul 28, 2026
981b638
fix(hooks): make ocr review blocking on push
Jul 28, 2026
05cbbe8
fix: resolve 7 remediation items from AI scanners (OCR/Sourcery/CodeR…
Jul 28, 2026
708b123
fix: resolve 2 open PR review threads
Jul 29, 2026
e94289f
chore: add fallow-ignore-file to false-positive files
Jul 29, 2026
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
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,9 @@ jobs:
name: SonarCloud PR Comment
runs-on: ubuntu-latest
needs: sonar
# Only run when the scan succeeded — otherwise the API has no findings
# to comment on and the script would post a confusing empty/errored
# comment. Branch protection enforces SonarCloud Scan as required, so
# a scan failure correctly blocks the merge regardless.
if: github.event_name == 'pull_request' && needs.sonar.result == 'success'
# The scan uploads findings to SonarCloud API before quality gate check.
# Run even when quality gate fails — the API still has data to comment.
if: github.event_name == 'pull_request' && !cancelled()
permissions:
contents: read
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile --ignore-scripts
run: pnpm install --frozen-lockfile --ignore-scripts # NOSONAR

- name: Generate Nuxt and Prisma artifacts
run: pnpm --filter drop run postinstall
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/open-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: alibaba/open-code-review@0ced7165718725e15223c3e5a506df7b7e9de51f # v1.7.17
- uses: alibaba/open-code-review@0ced7165718725e15223c3e5a506df7b7e9de51f # v1.7.17 # NOSONAR
with:
# Configure in GitHub repo settings → Secrets and variables → Actions
llm_url: ${{ secrets.OCR_LLM_URL }}
Expand Down
24 changes: 24 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# Incremental test run: only tests affected by pushed changes.
# Full suite still runs in CI.
pnpm --filter drop test:changed

# OpenCodeReview gate: compare local branch against remote base.
# Runs only when ocr CLI is installed and remote base is fetchable.
# Detect base from upstream tracking. If upstream matches current branch
# (PR branch self-tracking) or unset, fall back to origin/rebuild.
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
UPSTREAM="$(git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null || true)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using both --symbolic-full-name and --abbrev-ref together in git rev-parse is contradictory and the behavior is not well-defined across Git versions. --symbolic-full-name returns the full ref path (e.g., refs/remotes/origin/rebuild) while --abbrev-ref returns the short form (e.g., origin/rebuild). Subsequent string operations like ${REMOTE_BASE#origin/} may behave differently depending on which flag wins.

Use only --abbrev-ref to reliably get origin/rebuild format.

Suggestion:

Suggested change
UPSTREAM="$(git rev-parse --abbrev-ref --symbolic-full-name '@{upstream}' 2>/dev/null || true)"
UPSTREAM="$(git rev-parse --abbrev-ref '@{upstream}' 2>/dev/null || true)"

REMOTE_BASE="${UPSTREAM}"
if [ -z "${REMOTE_BASE}" ] || [ "${REMOTE_BASE#origin/}" = "${CURRENT_BRANCH}" ]; then
REMOTE_BASE="origin/rebuild"
fi

if command -v ocr >/dev/null 2>&1 && git rev-parse --quiet --verify "${REMOTE_BASE}" >/dev/null 2>&1; then
printf '\n:: Running OpenCodeReview against %s (blocking)...\n' "${REMOTE_BASE}"
ocr review --from "${REMOTE_BASE}" --to HEAD --audience agent --exclude 'pnpm-lock.yaml,Cargo.lock' || {
rc=$?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--to HEAD passes the literal string "HEAD" to ocr review, which will be resolved later when the background process runs. If the user makes new commits after the push starts but before the review process runs (unlikely but possible in a busy workflow), the review would compare against the wrong revision (newer HEAD, not the one being pushed). To guarantee correctness, resolve HEAD to its commit hash immediately in the hook script.

Suggestion:

Suggested change
rc=$?
REVISION_HEAD="$(git rev-parse HEAD)"
nohup ocr review --from "${REMOTE_BASE}" --to "${REVISION_HEAD}" --audience agent --exclude 'pnpm-lock.yaml,Cargo.lock' >"${OCR_LOG}" 2>&1 &

printf '\n⚠️ OCR found issues (exit %d). Fix before pushing, or use --no-verify to skip.\n' "$rc"
Comment on lines +17 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The temp file created by mktemp in /tmp is never cleaned up. Each push creates a new log file that persists indefinitely, potentially accumulating many orphaned files in /tmp over time. Consider either adding a cleanup mechanism (e.g., a trap to remove the file on a best-effort basis), or writing to a dedicated directory with a rotation/cleanup strategy. If the logs are important for debugging, consider adding a retention policy.

Suggestion:

Suggested change
printf '\n:: Running OpenCodeReview against %s (blocking)...\n' "${REMOTE_BASE}"
ocr review --from "${REMOTE_BASE}" --to HEAD --audience agent --exclude 'pnpm-lock.yaml,Cargo.lock' || {
rc=$?
printf '\n⚠️ OCR found issues (exit %d). Fix before pushing, or use --no-verify to skip.\n' "$rc"
OCR_LOG="$(mktemp /tmp/ocr-pre-push.XXXXXX)"
trap 'rm -f "${OCR_LOG}" || true' EXIT
printf '\n:: Starting OpenCodeReview against %s (non-blocking)...\n' "${REMOTE_BASE}"
nohup ocr review --from "${REMOTE_BASE}" --to HEAD --audience agent --exclude 'pnpm-lock.yaml,Cargo.lock' >"${OCR_LOG}" 2>&1 &
printf ' Review running in background — check %s later.\n' "${OCR_LOG}"

Comment on lines +17 to +20

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The temp file created by mktemp in /tmp is never cleaned up. Each push creates a new log file that persists indefinitely, potentially accumulating many orphaned files in /tmp over time. Consider cleaning up old logs (e.g., prune files older than 24 hours) at the start of each push, or using a fixed log location with a timestamp suffix that gets rotated out. A simple approach: find and remove OCR log files older than 1 day at the top of the script.

Suggestion:

Suggested change
printf '\n:: Running OpenCodeReview against %s (blocking)...\n' "${REMOTE_BASE}"
ocr review --from "${REMOTE_BASE}" --to HEAD --audience agent --exclude 'pnpm-lock.yaml,Cargo.lock' || {
rc=$?
printf '\n⚠️ OCR found issues (exit %d). Fix before pushing, or use --no-verify to skip.\n' "$rc"
# Clean up OCR logs older than 1 day
find /tmp -maxdepth 1 -name 'ocr-pre-push.*' -mtime +1 -delete 2>/dev/null || true
OCR_LOG="$(mktemp /tmp/ocr-pre-push.XXXXXX)"
printf '\n:: Starting OpenCodeReview against %s (non-blocking)...\n' "${REMOTE_BASE}"
nohup ocr review --from "${REMOTE_BASE}" --to HEAD --audience agent --exclude 'pnpm-lock.yaml,Cargo.lock' >"${OCR_LOG}" 2>&1 &
printf ' Review running in background — check %s later.\n' "${OCR_LOG}"

exit "$rc"
}
elif ! command -v ocr >/dev/null 2>&1; then
printf ':: ocr CLI not found — skipping OpenCodeReview gate\n'
else
printf ':: Remote base %s not found locally — run `git fetch origin` first.\n' "${REMOTE_BASE}"
fi
Comment thread
BillyOutlast marked this conversation as resolved.
Comment thread
BillyOutlast marked this conversation as resolved.
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
## libarchive-dev + pkg-config let libarchive3-sys link libarchive dynamically (glibc).
## protobuf-compiler is kept for parity (torrential's build.rs uses a vendored protoc).
# hadolint ignore=DL3008
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \

Check failure on line 31 in Dockerfile

View workflow job for this annotation

GitHub Actions / Dockerfile Lint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 31 in Dockerfile

View workflow job for this annotation

GitHub Actions / Dockerfile Lint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
libarchive-dev \
pkg-config \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3002
USER nobody
Comment on lines +36 to +37

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above — the # hadolint ignore=DL3002 comment is placed before the non-root USER nobody, but should be before USER root to suppress the DL3002 warning effectively.

Suggestion:

Suggested change
# hadolint ignore=DL3002
USER nobody
# hadolint ignore=DL3002
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
libarchive-dev \
pkg-config \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
USER nobody

WORKDIR /build
COPY . .
RUN cargo build --locked --release --manifest-path ./torrential/Cargo.toml
Comment on lines +37 to 40

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After USER nobody, WORKDIR /build creates the directory with root ownership (Docker daemon runs as root), and COPY . . always creates files as root regardless of USER. Then RUN cargo build runs as nobody, which cannot write to root-owned /build and its files. This will cause the cargo build to fail with permission errors.

Suggestion:

Suggested change
USER nobody
WORKDIR /build
COPY . .
RUN cargo build --locked --release --manifest-path ./torrential/Cargo.toml
# Option A: Run cargo build as root (simplest, keeps the intent)
USER root
WORKDIR /build
COPY . .
RUN cargo build --locked --release --manifest-path ./torrential/Cargo.toml
# Option B: Fix permissions before dropping to nobody
WORKDIR /build
COPY . .
RUN chown -R nobody:nobody /build
USER nobody
RUN cargo build --locked --release --manifest-path ./torrential/Cargo.toml

Expand All @@ -43,8 +46,11 @@
ENV NUXT_TELEMETRY_DISABLED=1

## add git so drop can determine its git ref at build
USER root
RUN apt-get update && apt-get install -y --no-install-recommends git \

Check failure on line 50 in Dockerfile

View workflow job for this annotation

GitHub Actions / Dockerfile Lint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 50 in Dockerfile

View workflow job for this annotation

GitHub Actions / Dockerfile Lint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
&& rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3002
USER node
Comment on lines +52 to +53

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The # hadolint ignore=DL3002 comment is placed before the non-root USER node/USER nobody instruction, but DL3002 ("Last USER should not be 'root'") warns about USER root usage. The ignore comment should be placed before USER root instead, or alternatively removed if DL3002 doesn't trigger here since the last USER in each stage is already non-root.

Suggestion:

Suggested change
# hadolint ignore=DL3002
USER node
USER root
RUN apt-get update && apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3002
USER node


## copy deps and rest of project files
COPY . .
Expand All @@ -71,7 +77,8 @@
# fails with EACCES. With it gone, resolution falls through to the `torrential`
# binary installed on PATH (/usr/bin/torrential) below.
# hadolint ignore=DL3008
USER root
RUN rm -rf /app/torrential && \

Check failure on line 81 in Dockerfile

View workflow job for this annotation

GitHub Actions / Dockerfile Lint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check failure on line 81 in Dockerfile

View workflow job for this annotation

GitHub Actions / Dockerfile Lint

DL3008 warning: Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libarchive13 \
Expand Down
11 changes: 8 additions & 3 deletions cli/Cargo.lock

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

3 changes: 3 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ tokio-util = { version = "0.7.18", features = ["compat"] }
url = "2.5.8"
webbrowser = "1.0.6"

[patch.crates-io]
quick-xml = { git = "https://github.com/tafia/quick-xml.git", tag = "v0.41.0" }
Comment thread
BillyOutlast marked this conversation as resolved.
Comment thread
BillyOutlast marked this conversation as resolved.

[dev-dependencies]
tempfile = "3.23.0"
8 changes: 4 additions & 4 deletions desktop/optimize-appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ APPIMAGE=$(ls ./src-tauri/target/release/bundle/appimage/*.AppImage)

# strip binary
APPIMAGE_UNPACK="./squashfs-root"
find $APPIMAGE_UNPACK -type f -exec strip -s {} \;
find "$APPIMAGE_UNPACK" -type f -exec strip -s {} \;

APPIMAGETOOL=$(echo "obsolete-appimagetool-$ARCH.AppImage")
curl --proto '=https' -fsSLo "$APPIMAGETOOL" "https://github.com/AppImage/AppImageKit/releases/download/13/$APPIMAGETOOL"
chmod +x $APPIMAGETOOL
chmod +x "$APPIMAGETOOL"

APPIMAGE_OUTPUT=$(./$APPIMAGETOOL $APPIMAGE_UNPACK | grep ".AppImage" | grep squashfs-root | awk '{ print $6 }')
APPIMAGE_OUTPUT=$(./"$APPIMAGETOOL" "$APPIMAGE_UNPACK" | grep ".AppImage" | grep squashfs-root | awk '{ print $6 }')

mv $APPIMAGE_OUTPUT "$APPIMAGE"
mv "$APPIMAGE_OUTPUT" "$APPIMAGE"
74 changes: 66 additions & 8 deletions desktop/src-tauri/Cargo.lock

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

1 change: 1 addition & 0 deletions desktop/src-tauri/database/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2024"

[dependencies]
aes = "0.8.4"
aes-gcm = "0.10.3"
anyhow = "1.0.101"
chrono = "0.4.42"
ctr = "0.9.2"
Expand Down
Loading
Loading