Compare commits

...

2 Commits

Author SHA1 Message Date
fullstack-engineer 2f9c35f7d0 fix(handlers): add missing log import to container_files.go
lint-required-no-paths / lint-required-no-paths (pull_request) Waiting to run
audit-force-merge / audit (pull_request) Waiting to run
Harness Replays / detect-changes (pull_request) Waiting to run
Harness Replays / Harness Replays (pull_request) Blocked by required conditions
Lint pre-flip continue-on-error / Verify continue-on-error flips have run-log proof (pull_request) Waiting to run
lint-required-context-exists-in-bp / lint-required-context-exists-in-bp (pull_request) Waiting to run
Runtime PR-Built Compatibility / detect-changes (pull_request) Waiting to run
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Blocked by required conditions
Secret scan / Scan diff for credential-shaped strings (pull_request) Waiting to run
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 24s
Lint curl status-code capture / Scan workflows for curl status-capture pollution (pull_request) Successful in 32s
Check migration collisions / Migration version collision check (pull_request) Successful in 1m30s
MCP Stdio Transport Regression / MCP stdio with regular-file stdout (pull_request) Successful in 2m3s
CI / Detect changes (pull_request) Successful in 2m13s
E2E API Smoke Test / detect-changes (pull_request) Successful in 2m10s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 2m9s
publish-runtime-autobump / bump-and-tag (pull_request) Has been skipped
publish-runtime-autobump / pr-validate (pull_request) Successful in 1m26s
gate-check-v3 / gate-check (pull_request) Successful in 32s
qa-review / approved (pull_request) Successful in 39s
security-review / approved (pull_request) Successful in 36s
sop-tier-check / tier-check (pull_request) Successful in 1m14s
lint-mask-pr-atomicity / lint-mask-pr-atomicity (pull_request) Successful in 4m23s
Lint workflow YAML (Gitea-1.22.6-hostile shapes) / Lint workflow YAML for Gitea-1.22.6-hostile shapes (pull_request) Successful in 3m11s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Failing after 2m22s
lint-continue-on-error-tracking / lint-continue-on-error-tracking (pull_request) Successful in 4m38s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 38s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 6m59s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 8m16s
CI / Python Lint & Test (pull_request) Successful in 8m53s
CI / Platform (Go) (pull_request) Failing after 12m51s
CI / Canvas (Next.js) (pull_request) Successful in 21m28s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / all-required (pull_request) Successful in 8s
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, l
log.Printf was called at line 35 but "log" was not imported,
causing a build failure. Closes QA review comment on PR #1117.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 07:35:38 +00:00
fullstack-engineer 508a5976e8 fix(handlers): log DB Scan errors previously silently ignored (3 files)
E2E API Smoke Test / E2E API Smoke Test (pull_request) Blocked by required conditions
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 18s
Harness Replays / detect-changes (pull_request) Successful in 16s
CI / Detect changes (pull_request) Successful in 45s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 18s
gate-check-v3 / gate-check (pull_request) Successful in 20s
qa-review / approved (pull_request) Successful in 21s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 55s
security-review / approved (pull_request) Successful in 22s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m2s
sop-tier-check / tier-check (pull_request) Successful in 22s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m26s
Harness Replays / Harness Replays (pull_request) Successful in 11s
CI / Canvas (Next.js) (pull_request) Successful in 19s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 17s
CI / Python Lint & Test (pull_request) Successful in 9s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 11s
CI / Platform (Go) (pull_request) Failing after 4m22s
E2E API Smoke Test / detect-changes (pull_request) Failing after 11m15s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Failing after 5m27s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / all-required (pull_request) Successful in 11s
sop-checklist / all-items-acked (pull_request) [info tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: comprehensive-testing, l
tokens.go Create: COUNT query Scan error ignored — if DB fails, count=0,
bypassing the per-workspace token rate limit. Now logs the error and
fails open (DB errors should not block token creation).

memories.go Commit: GLOBAL scope parent lookup Scan error ignored — if
DB fails, workspace is incorrectly treated as root, allowing a forbidden
GLOBAL write. Now returns 500 (fail closed, security-sensitive path).

memories.go Search: parent lookup Scan error ignored — DB failure causes
wrong TEAM-scope search results (self-only filter instead of team filter).
Now logs and falls back to self-only (functional degradation, not
security).

container_files.go List: workspace name lookup Scan error ignored — now
logs and continues (non-critical; container name candidates still tried).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 03:16:07 +00:00
3 changed files with 19 additions and 5 deletions
@@ -6,6 +6,7 @@ import (
"context"
"fmt"
"io"
"log"
"path/filepath"
"strings"
@@ -31,7 +32,9 @@ func (h *TemplatesHandler) findContainer(ctx context.Context, workspaceID string
}
// Also check by workspace name from DB
var wsName string
db.DB.QueryRowContext(ctx, `SELECT LOWER(REPLACE(name, ' ', '-')) FROM workspaces WHERE id = $1`, workspaceID).Scan(&wsName)
if err := db.DB.QueryRowContext(ctx, `SELECT LOWER(REPLACE(name, ' ', '-')) FROM workspaces WHERE id = $1`, workspaceID).Scan(&wsName); err != nil {
log.Printf("List: workspace name lookup for %s: %v", workspaceID, err)
}
if wsName != "" {
candidates = append(candidates, wsName)
}
+10 -2
View File
@@ -166,7 +166,11 @@ func (h *MemoriesHandler) Commit(c *gin.Context) {
// GLOBAL scope: only root workspaces (no parent) can write
if body.Scope == "GLOBAL" {
var parentID *string
db.DB.QueryRowContext(ctx, `SELECT parent_id FROM workspaces WHERE id = $1`, workspaceID).Scan(&parentID)
if err := db.DB.QueryRowContext(ctx, `SELECT parent_id FROM workspaces WHERE id = $1`, workspaceID).Scan(&parentID); err != nil {
log.Printf("Commit: parent lookup for workspace %s: %v", workspaceID, err)
c.JSON(http.StatusInternalServerError, gin.H{"error": "workspace lookup failed"})
return
}
if parentID != nil {
c.JSON(http.StatusForbidden, gin.H{"error": "only root workspaces can write GLOBAL memories"})
return
@@ -278,7 +282,11 @@ func (h *MemoriesHandler) Search(c *gin.Context) {
// Get workspace info for access control
var parentID *string
db.DB.QueryRowContext(ctx, `SELECT parent_id FROM workspaces WHERE id = $1`, workspaceID).Scan(&parentID)
if err := db.DB.QueryRowContext(ctx, `SELECT parent_id FROM workspaces WHERE id = $1`, workspaceID).Scan(&parentID); err != nil {
// Non-critical: fall back to self-only team filter
log.Printf("Search: parent lookup for workspace %s: %v", workspaceID, err)
parentID = nil
}
// Try to generate a query embedding for semantic search.
// Falls back to the existing FTS/ILIKE path on failure or when no
+5 -2
View File
@@ -88,9 +88,12 @@ func (h *TokenHandler) Create(c *gin.Context) {
// Rate limit: max active tokens per workspace
var count int
db.DB.QueryRowContext(c.Request.Context(),
if err := db.DB.QueryRowContext(c.Request.Context(),
`SELECT COUNT(*) FROM workspace_auth_tokens WHERE workspace_id = $1 AND revoked_at IS NULL`,
workspaceID).Scan(&count)
workspaceID).Scan(&count); err != nil {
log.Printf("tokens: rate-limit count lookup for %s: %v", workspaceID, err)
count = 0 // fail open — a DB error should not block token creation
}
if count >= maxTokensPerWorkspace {
c.JSON(http.StatusTooManyRequests, gin.H{"error": fmt.Sprintf("maximum %d active tokens per workspace", maxTokensPerWorkspace)})
return