Skip to content

feat(agent-bff): gate the OpenAPI HTTP route behind a env variable - #1816

Open
Tonours wants to merge 2 commits into
feature/prd-887-openapi-cli-exportfrom
feature/bff-openapi-http-enabled
Open

feat(agent-bff): gate the OpenAPI HTTP route behind a env variable#1816
Tonours wants to merge 2 commits into
feature/prd-887-openapi-cli-exportfrom
feature/bff-openapi-http-enabled

Conversation

@Tonours

@Tonours Tonours commented Aug 10, 2026

Copy link
Copy Markdown
Member

Stacked on #1811 (feature/prd-887-openapi-cli-export), itself stacked on #1810 and #1809. Base is #1811's branch, not main: parents merge first, in order. The diff below is only this branch's commit.

Adds BFF_OPENAPI_ENABLED. Defaults to true, so nothing changes unless you set it.

true (default) false
/agent/openapi.json, authenticated 200 + document 404 openapi_disabled
/agent/openapi.json, unauthenticated 401 401
forest-bff openapi document on stdout document on stdout

The flag gates the HTTP route only, whatever the method. The CLI never reads it, so codegen keeps working on an instance that does not expose the route.

Accepted values: true and false, case-insensitive, padding trimmed. Anything else fails fast at boot with an error that never echoes the value.

How to test

yarn workspace @forestadmin/agent-bff build
BFF_OPENAPI_ENABLED=false yarn workspace @forestadmin/agent-bff start
curl -i -H "Authorization: Bearer <session>" localhost:3450/agent/openapi.json   # 404 openapi_disabled
curl -i localhost:3450/agent/openapi.json                                        # 401, still gated
yarn workspace @forestadmin/agent-bff exec node dist/cli.js openapi | head -c 40  # document, flag ignored

Definition of Done

General

  • Write an explicit title for the Pull Request, following Conventional Commits specification
  • Test manually the implemented changes
  • Validate the code quality (indentation, syntax, style, simplicity, readability)

Security

  • Consider the security impact of the changes made

@qltysh

qltysh Bot commented Aug 10, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (3)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/agent-bff/src/config/env-config.ts100.0%
Coverage rating: A Coverage rating: A
packages/agent-bff/src/openapi/openapi-routes.ts100.0%
Coverage rating: A Coverage rating: A
packages/agent-bff/src/http/bff-local-errors.ts100.0%
Total100.0%
馃殾 See full report on Qlty Cloud 禄

馃洘 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@Tonours
Tonours force-pushed the feature/bff-openapi-http-enabled branch from 51f088e to ef0070d Compare August 10, 2026 12:48
@Tonours Tonours changed the title feat(agent-bff): gate the OpenAPI HTTP route behind BFF_OPENAPI_ENABLED feat(agent-bff): gate the OpenAPI HTTP route behind a env variable Aug 10, 2026
Comment thread packages/agent-bff/src/openapi/openapi-routes.ts Outdated
Comment thread packages/agent-bff/src/openapi/openapi-routes.ts Outdated
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