-
Notifications
You must be signed in to change notification settings - Fork 18
fix: add bounty video bug-report challenge #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,20 @@ | ||
| [workspace] | ||
| resolver = "3" | ||
| members = ["crates/*", "bins/*", "xtask"] | ||
|
|
||
| [workspace.package] | ||
| [package] | ||
| name = "base-bounty" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| license = "Apache-2.0" | ||
| repository = "https://github.com/BaseIntelligence/base" | ||
| rust-version = "1.96" | ||
|
|
||
| [workspace.lints.rust] | ||
| unsafe_code = "forbid" | ||
|
|
||
| [workspace.lints.clippy] | ||
| pedantic = { level = "warn", priority = -1 } | ||
| unwrap_used = "deny" | ||
| expect_used = "deny" | ||
| [dependencies] | ||
| axum = { version = "0.7", features = ["multipart", "macros"] } | ||
| tokio = { version = "1", features = ["full"] } | ||
| sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "postgres", "chrono", "uuid"] } | ||
| reqwest = { version = "0.11", features = ["json", "multipart"] } | ||
| serde = { version = "1", features = ["derive"] } | ||
| serde_json = "1" | ||
| toml = "0.8" | ||
| uuid = { version = "1", features = ["v4", "serde"] } | ||
| chrono = { version = "0.4", features = ["serde"] } | ||
| tracing = "0.1" | ||
| tracing-subscriber = "0.3" | ||
| anyhow = "1" | ||
| multer = "2.1" | ||
| tempfile = "3.9" | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FROM rust:1.75-slim-bookworm as builder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN apt-get update && apt-get install -y pkg-config libssl-dev ffmpeg && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| COPY . . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN cargo build --release --bin base-bounty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check for sqlx compile-time macros, an offline cache, and a .dockerignore file.
rg -nP '\bsqlx::query(_as|_scalar)?!\s*\(' --type=rust -C2
fd -H -t d '^\.sqlx$'
fd -H -t f '^sqlx-data\.json$'
fd -H -t f '^\.dockerignore$'
rg -n 'name\s*=\s*"base-bounty"|\[\[bin\]\]' -C3 Cargo.tomlRepository: BaseIntelligence/base Length of output: 159 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- Dockerfile.bounty ---'
cat -n Dockerfile.bounty
printf '%s\n' '--- relevant project files ---'
git ls-files | sed -n '1,160p'
printf '%s\n' '--- SQLx macros and configuration ---'
rg -n -C3 'sqlx::(query|query_as|query_scalar)!|SQLX_OFFLINE|DATABASE_URL|sqlx' --glob '*.rs' --glob 'Cargo.toml' --glob 'Cargo.lock' --glob 'build.rs' .
printf '%s\n' '--- offline metadata and ignore files ---'
find . -maxdepth 3 \( -name .sqlx -o -name sqlx-data.json -o -name .dockerignore \) -print
printf '%s\n' '--- binaries ---'
rg -n -C3 'name\s*=\s*"base-bounty"|\[\[bin\]\]' Cargo.tomlRepository: BaseIntelligence/base Length of output: 50378 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- .dockerignore ---'
cat -n .dockerignore
printf '%s\n' '--- root Cargo.toml ---'
cat -n Cargo.toml | sed -n '1,140p'
printf '%s\n' '--- root package and workspace metadata ---'
python3 - <<'PY'
import re
from pathlib import Path
text = Path("Cargo.toml").read_text()
for key in ("[package]", "[workspace]", "[[bin]]"):
print(f"{key}: {text.find(key)}")
print("base-bounty occurrences:", len(re.findall(r'base-bounty', text)))
PY
printf '%s\n' '--- tracked potentially sensitive files ---'
git ls-files | rg '(^|/)(\.env($|\.)|.*\.(pem|key|age|tfstate|tfstate\.backup)$|terraform\.tfstate|credentials|wallet|receipt)'
printf '%s\n' '--- SQLx offline metadata ---'
find . -type d -name .sqlx -print
find . -type f -name sqlx-data.json -print
printf '%s\n' '--- SQLx environment assignments ---'
rg -n '^(ENV|ARG) +(SQLX_OFFLINE|DATABASE_URL)|SQLX_OFFLINE|DATABASE_URL' Dockerfile.bounty Cargo.toml .cargo 2>/dev/null || trueRepository: BaseIntelligence/base Length of output: 1542 🏁 Script executed: #!/bin/bash
printf '%s\n' '--- .dockerignore ---'
cat -n .dockerignore
printf '%s\n' '--- root Cargo.toml ---'
cat -n Cargo.toml | sed -n '1,140p'
printf '%s\n' '--- root package and workspace metadata ---'
python3 - <<'PY'
import re
from pathlib import Path
text = Path("Cargo.toml").read_text()
for key in ("[package]", "[workspace]", "[[bin]]"):
print(f"{key}: {text.find(key)}")
print("base-bounty occurrences:", len(re.findall(r'base-bounty', text)))
PY
printf '%s\n' '--- tracked potentially sensitive files ---'
git ls-files | rg '(^|/)(\.env($|\.)|.*\.(pem|key|age|tfstate|tfstate\.backup)$|terraform\.tfstate|credentials|wallet|receipt)' || true
printf '%s\n' '--- SQLx offline metadata ---'
find . -type d -name .sqlx -print
find . -type f -name sqlx-data.json -print
printf '%s\n' '--- SQLx environment assignments ---'
rg -n '^(ENV|ARG) +(SQLX_OFFLINE|DATABASE_URL)|SQLX_OFFLINE|DATABASE_URL' Dockerfile.bounty Cargo.toml .cargo 2>/dev/null || trueRepository: BaseIntelligence/base Length of output: 1542 🌐 Web query:
💡 Result: In SQLx 0.7 and later, the offline workflow is designed to store query metadata in a dedicated Citations:
🏁 Script executed: #!/bin/bash
python3 - <<'PY'
from pathlib import Path
import re
docker = Path("Dockerfile.bounty").read_text()
cargo = Path("Cargo.toml").read_text()
source = Path("src/routes/bounty.rs").read_text()
sqlx_dirs = [p for p in Path(".").rglob(".sqlx") if p.is_dir()]
print("root package:", re.search(r'(?m)^name\s*=\s*"([^"]+)"', cargo).group(1))
print("docker sets DATABASE_URL:", bool(re.search(r'(?m)^(?:ENV|ARG)\s+DATABASE_URL(?:\s|=)', docker)))
print("docker sets SQLX_OFFLINE:", bool(re.search(r'(?m)^(?:ENV|ARG)\s+SQLX_OFFLINE(?:\s|=)', docker)))
print("root query macros:", len(re.findall(r'\bsqlx::query(?:_as|_scalar)?!\s*\(', source)))
print("sqlx directories:", [str(p) for p in sqlx_dirs])
print("root .sqlx exists:", Path(".sqlx").is_dir())
print("nested cache files:", sum(1 for p in Path("crates/db/.sqlx").rglob("*") if p.is_file()) if Path("crates/db/.sqlx").is_dir() else 0)
PY
printf '%s\n' '--- ignore coverage for common local artifacts ---'
for p in .env terraform.tfstate terraform.tfstate.backup example.pem example.key wallet.json; do
if git check-ignore -q "$p"; then printf '%s ignored\n' "$p"; else printf '%s not-ignored\n' "$p"; fi
doneRepository: BaseIntelligence/base Length of output: 551 Provide SQLx metadata for the release build. The root package contains two The existing 🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FROM debian:bookworm-slim | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| RUN apt-get update && apt-get install -y ffmpeg ca-certificates curl && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| COPY --from=builder /app/target/release/base-bounty /usr/local/bin/base-bounty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CMD ["base-bounty"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Run the service as a non-root user and slim the builder stage. The image has no 🔒️ Proposed hardening-FROM rust:1.75-slim-bookworm as builder
+FROM rust:1.75-slim-bookworm AS builder
-RUN apt-get update && apt-get install -y pkg-config libssl-dev ffmpeg && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y --no-install-recommends pkg-config libssl-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . .
RUN cargo build --release --bin base-bounty
FROM debian:bookworm-slim
-RUN apt-get update && apt-get install -y ffmpeg ca-certificates curl && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg ca-certificates curl && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/base-bounty /usr/local/bin/base-bounty
+RUN useradd --system --uid 10001 --no-create-home bounty
+USER 10001:10001
+EXPOSE 8095
-CMD ["base-bounty"]
+CMD ["/usr/local/bin/base-bounty"]📝 Committable suggestion
Suggested change
🧰 Tools🪛 Trivy (0.73.0)[error] 1-1: Image user should not be 'root' Specify at least 1 USER command in Dockerfile with non-root user as argument Rule: DS-0002 (IaC/Dockerfile) [error] 10-10: 'apt-get' missing '--no-install-recommends' '--no-install-recommends' flag is missed: 'apt-get update && apt-get install -y ffmpeg ca-certificates curl && rm -rf /var/lib/apt/lists/*' Rule: DS-0029 (IaC/Dockerfile) [error] 3-3: 'apt-get' missing '--no-install-recommends' '--no-install-recommends' flag is missed: 'apt-get update && apt-get install -y pkg-config libssl-dev ffmpeg && rm -rf /var/lib/apt/lists/*' Rule: DS-0029 (IaC/Dockerfile) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [epoch] | ||
| target = 50 | ||
| uid0_burn_sink = true | ||
|
|
||
| [weights] | ||
| design_bps = 3000 | ||
| prism_bps = 4500 | ||
| bounty_bps = 2500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift
Keep the existing workspace when adding
base-bounty.This replacement removes the workspace members and the
xtaskpackage. Root-level CI commands can no longer validate the existing crates or run the requiredxtaskgates.Restore the workspace manifest and add
base-bountyas a workspace member. Preserve the shared lint policy and package metadata.As per coding guidelines, run formatting, Clippy with warnings denied, tests, cargo deny, and the
xtaskgates before merging.🤖 Prompt for AI Agents
Source: Coding guidelines