← Back to Pull requests

feat(secrets): reuse named organization secrets across Boxes #3185

Closed
unknown closed this pull request without merging on Dec 04, 2026 06:03 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 12:26 UTC
Author

TL;DR

Boxes can share a named organization secret, keep an inline secret private to one Box, and use both in the same creation request.

Design #3168 · API and lifecycle documentation

How it works

Save openai with POST /api/v1/secrets. Create Box A with an inline value and {"secret":"openai"}, then create B with the same named reference. The API resolves each name in the caller's organization and binds the ID to the Box and Runner's single-use fetch credential.

| Action | Result |
| --- | --- |
| List with GET /api/v1/secrets and read:secrets | Each entry contains the immutable ID and name. |
| Stop and restart A | Its inline and shared credentials remain usable. |
| Destroy A | The cleanup worker removes A's private records. B keeps the shared credential. |
| Delete the shared ID while B exists | DELETE /api/v1/secrets/{secret_id} returns 409, including while B is stopped. |
| Delete after B is destroyed | With write:secrets, the owner gets 204 after Secret Server confirms removal. A repeat request also returns 204. |

sequenceDiagram
    actor Caller
    participant API
    participant DB as Box database
    participant SS as Secret Server
    Caller->>API: Delete shared ID
    API->>DB: Lock organization and secret ID
    API->>SS: Verify the org owns the secret ID
    API->>DB: Check Box references under the deletion lock
    alt A Box references this ID
        API-->>Caller: 409
    else No remaining references
        API->>DB: Record deletion and block stale Box inserts
        API->>SS: Remove the ID for this organization
        SS-->>API: Confirm removal
        API->>DB: Mark delivery complete
        API-->>Caller: 204
    end

Both private cleanup and pending organization deletions retry every 30 seconds. A retry uses the original ID, so a replacement with the same name remains usable.

Verification

  • The focused API run passed 267 tests. They exercised permissions, retries, PostgreSQL concurrency and API calls to a running Go Secret Server.

  • Under repeatable read, deletion previously missed a newly committed Box. A Box writer with an older snapshot could also accept a retired ID. Both regression tests passed after the fix.

  • Secret Server tests, PostgreSQL and credential integration, the API production build, OpenAPI tests, and focused dashboard permission tests passed.

  • The hosted two-Box case covers guest placeholders, proxy substitution across restart, private cleanup, and shared deletion. Running it requires a deployment with a VM Runner, HTTPS preview, and two organizations. This revision was verified locally at the service boundary.
  • The design review flagged incomplete source and SDK coverage in its research snapshot. Two concurrent Boxes now exercise opposite-order references in PostgreSQL. The review also recommended separate proof for the earlier orphan recovery change.

    Unresolved findings

    The rebase push included two commits already on upstream main. The push audit retained both historical title findings.

  • push@b0cac35:F1 — upstream f0ed993eb uses ci: without a scope.

  • push@b0cac35:F2 — upstream 45e0f1e75 has a 104-character title. The repository limit is 72.
  • Rebase audit tracking issue

    Diff: 437 lines (+327 / -110) across 5 files Reviewer: DorianZheng Review duration: 5377m
    All Vouch review confidence checks passed
    Residual risk 0.29 = Change Risk (0.73) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.73 · 437 lines diff across 5 files
    0.73
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.364
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.073
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #3185"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 73.4% (HIGH) · Higher = larger blast radius
    73.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.0% · Safe to merge
    29.0%