Skip to content

Expose backend security and org authorization settings#87

Merged
Olmo Maldonado (ibolmo) merged 5 commits into
mainfrom
sec-ssrf-env-vars
Jun 25, 2026
Merged

Expose backend security and org authorization settings#87
Olmo Maldonado (ibolmo) merged 5 commits into
mainfrom
sec-ssrf-env-vars

Conversation

@ibolmo

@ibolmo Olmo Maldonado (ibolmo) commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Context

Self-hosted Braintrust deployments need first-class Helm values for two backend security controls that previously required extraEnvVars: URL-security behavior for outbound requests to user-supplied URLs, and organization authorization settings for hybrid/self-hosted data planes. This mirrors the Terraform data-plane inputs for API and AI Gateway runtime security configuration.

Description

  • Adds optional URL-security values for unsafe request mode, DNS resolvers, and allowed CIDRs, rendering the corresponding BRAINTRUST_* ConfigMap env vars for the API and AI Gateway only when trimmed values are non-empty.
  • Documents the Terraform-supported unsafe request modes, including proxy, while preserving application defaults when values are unset.
  • Adds global organization authorization values for ALLOWED_ORG_IDS and PRIMARY_ORG_NAME, preserving current behavior when unset or blank.
  • Requires a primary org when global.orgName is empty or "*", while preserving existing deployments that already provide PRIMARY_ORG_NAME through api.extraEnvVars.
  • Covers omitted, blank, configured, wildcard, extra-env override, and validation cases in the ConfigMap template tests.

@ibolmo Olmo Maldonado (ibolmo) changed the title add url security env vars Expose API URL security env vars Jun 3, 2026
Comment thread braintrust/templates/api-configmap.yaml
Olmo Maldonado (ibolmo) and others added 3 commits June 23, 2026 19:12
The chart should pass through trimmed API URL security settings without
blocking render-time values, leaving mode validation to the application.
* add allowed org ids

* fix: Accept PRIMARY_ORG_NAME from API env

Deploys that source the primary organization through extra environment
variables should satisfy the same self-hosted service-token requirement
as
the chart value, while still rejecting wildcard or empty orgs with no
primary
organization configured.
@ibolmo Olmo Maldonado (ibolmo) changed the title Expose API URL security env vars Expose API security and org authorization settings Jun 24, 2026
@ibolmo Olmo Maldonado (ibolmo) changed the title Expose API security and org authorization settings Expose backend security and org authorization settings Jun 24, 2026
Keep outbound URL validation behavior consistent between the API and AI
Gateway when operators configure shared URL security values. Update
tests
and value guidance to preserve trimming and ID allowlist expectations.
@ibolmo Olmo Maldonado (ibolmo) marked this pull request as ready for review June 25, 2026 21:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: adaadcb50e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

{{- $hasPrimaryOrgNameExtraEnv = true -}}
{{- end -}}
{{- end -}}
{{- if and (or (eq $orgName "") (eq $orgName "*")) (eq $primaryOrgName "") (not $hasPrimaryOrgNameExtraEnv) -}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate ORG_NAME after extraEnvVars overrides

When api.extraEnvVars sets ORG_NAME to "*" or "", this guard still evaluates only global.orgName; because api-deployment.yaml injects the ConfigMap with envFrom and then appends api.extraEnvVars under env, that explicit env var becomes the runtime value. In that override scenario the pod can still run with a wildcard/empty org and no PRIMARY_ORG_NAME, bypassing the new primary-org requirement; derive the effective org name from api.extraEnvVars here or reject unsafe ORG_NAME overrides without a primary org.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the api handler should take care of the validation. this is more of a user/dev convenience.

@ibolmo Olmo Maldonado (ibolmo) merged commit 04a956e into main Jun 25, 2026
3 checks passed
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.

3 participants