Skip to content

Conversation

@bwalsh
Copy link

@bwalsh bwalsh commented Aug 25, 2025

Overview: https://github.com/calypr/fence/blob/feature/dynamic-buckets/docs/fence-buckets/docs/index.md

New Features

  • Dynamic Bucket Registry stored in DB (replaces static S3_BUCKETS YAML lookups at runtime).
  • Admin APIs to manage buckets: create, update, list, suspend/resume; optional prefix bindings and policy mapping.
  • Secrets Manager integration via a pluggable resolver layer (AWS Secrets Manager, Kubernetes Secrets [mount/API]; stubs for GCP SM / Vault).
  • Credential rotation support (read latest secret/version with TTL cache; no redeploy required).
  • Feature flag FENCE_ENABLE_DYNAMIC_BUCKETS with YAML fallback for backward compatibility.
  • (Docs) Architecture overview, migration steps, and usage notes added. ([GitHub][1])

Breaking Changes

  • None by default. Dynamic buckets are gated behind a feature flag and preserve legacy YAML behavior when disabled.
  • Deployments that enable dynamic buckets must run DB migrations and configure resolver access (IAM/RBAC).

Bug Fixes

  • N/A (scope is additive; no regressions intentionally targeted).

Improvements

  • Clear separation of responsibilities: metadata in DB, credentials in an external secrets store.
  • Reduced operational toil: add/rotate buckets without Helm changes or pod restarts.
  • Security posture: secrets removed from app config; least‑privilege access to individual secrets.
  • Caching with sensible TTLs for both bucket metadata and secrets to minimize external calls.

Dependency updates

  • Optional runtime deps when corresponding backend is used:

    • boto3 (for AWS STS/S3 clients in examples)
    • kubernetes (for Kubernetes Secret API mode)
  • No mandatory dependency changes for existing (YAML‑only) deployments.

Deployment changes

  • New DB objects: bucket, bucket_prefix (optional), bucket_policy_binding, and audit table (optional).

  • App config/env:

    • FENCE_ENABLE_DYNAMIC_BUCKETS=true to activate
    • FENCE_SECRETS_BACKEND = aws_sm | k8s (etc.)
    • TTLs: FENCE_BUCKET_CACHE_TTL_SECONDS, FENCE_SECRET_CACHE_TTL_SECONDS
  • AuthZ/IAM:

    • Ensure the Fence pod identity can read only the referenced secrets (AWS SM policy / K8s Role/RoleBinding).
    • If using role‑based access, permit sts:AssumeRole for configured ARNs.
  • Helm/K8s:

    • (If using K8s Secrets) mount secret files or enable API mode with RBAC for specific Secrets.
  • Migration:

    • Apply Alembic migration for the registry tables.
    • (Optional) seed from existing YAML (fence-create sync-buckets-from-yaml) before enabling the flag.

@bwalsh bwalsh force-pushed the feature/dynamic-buckets branch from 4db6cdc to 14365b0 Compare August 25, 2025 21:31
github now rendering ```mermaid !
**Flow (validate):**
AuthN → Admin RBAC → resolve secret/assume role → optional HEAD to storage → return `{ok, reason}` (no secrets).

## 3) Data Model (Shared DB)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should not have a shared db. We need to abstract microservices from each other with APIs as the only coupling.


**Separation of concerns**
- `presigned-urls`: *read-only* DB, read secrets or assume-role, generate presigned URLs. No DB writes.
- `secret-admin`: CRUD + validate; never returns raw secrets; enforces admin RBAC.
Copy link
Contributor

Choose a reason for hiding this comment

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

The raw secrets are required for signing URLs

This package contains a focused **architecture + rollout plan** to split signing from admin into two services:

- **`presigned-urls`** — high-throughput signer (download/upload single + multipart), read-only DB + secrets access.
- **`secret-admin`** — low-QPS (queries per second) admin CRUD + validation for the bucket registry, write access to DB; validate-only access to secrets/STS.
Copy link
Contributor

Choose a reason for hiding this comment

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

We will need this service to be able to be configured as included or excluded, b/c we will likely not utilize it. We'd like to still have the option of the current state: configure creds explicitly for the presigned-urls service


### A) `presigned-urls`
**Endpoints (Fence-compatible):**
- `GET /data/download/{guid}` → signed GET
Copy link
Contributor

Choose a reason for hiding this comment

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

should also include /drs/{{guid}}/access endpoints

* **`FENCE_DYNAMIC_BUCKETS=true`**

* Split service deployment. Fence continues to handle auth flows and GA4GH endpoints.
* Presign and bucket-admin endpoints are served by new services.
Copy link
Contributor

Choose a reason for hiding this comment

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

GA4GH should be included in presigned. presigned needs a config flag on whether or not to rely on bucket-admin or just look for creds in configuration

@bwalsh
Copy link
Author

bwalsh commented Oct 13, 2025

motivation

From https://latch.bio/product
image


* **`FENCE_DYNAMIC_BUCKETS=false` (default)**

* Fence behaves as today: all endpoints are served by the Fence service itself.
Copy link
Contributor

Choose a reason for hiding this comment

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

we should consider a clean split, at least for AWS. Have PRs to remove AWS signed URL logic from Fence and add new service(s) that handle AWS, GCP. The new presigned url service should handle GCP without all the crazy group management we have currently in Fence. We don't need that anymore. We should model the AWS approach in GCP in the new service. e.g. one admin service account signing URLs.

Copy link
Contributor

@Avantol13 Avantol13 left a comment

Choose a reason for hiding this comment

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

See comments

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