fix(auth): hide instance token when exposure disabled by aim1sh · Pull Request #2736 · evolution-foundation/evolution-api · GitHub
Skip to content

fix(auth): hide instance token when exposure disabled - #2736

Open
aim1sh wants to merge 1 commit into
evolution-foundation:developfrom
aim1sh:fix/hide-instance-token
Open

aim1sh wants to merge 1 commit into
evolution-foundation:developfrom
aim1sh:fix/hide-instance-token

Conversation

@aim1sh

@aim1sh aim1sh commented Sep 22, 2026 •

Copy link
Copy Markdown

📋 Description

Prevent GET /instance/fetchInstances from returning instance tokens when AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES=false.

The response is sanitized consistently for:

  • lookups authenticated with an instance token
  • lookups by instance ID or number
  • unfiltered and name-filtered instance listings

When exposure is explicitly enabled, the existing response remains unchanged.

🔗 Related Issue

Closes #2677

🧪 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🔒 Security fix

🧪 Testing

  • No breaking changes introduced
  • npx eslint src/api/controllers/instance.controller.ts
  • npx tsc --noEmit
  • npm run build

✅ Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • My changes generate no new warnings

📝 Additional Notes

The change only removes the token property from returned copies of instance records; it does not mutate the records returned by the monitoring service.

Summary by Sourcery

Hide instance tokens from fetch responses unless token exposure is explicitly enabled.

Bug Fixes:

  • Prevent instance tokens from being returned by the instance listing endpoint when token exposure is disabled.

Enhancements:

  • Apply consistent token redaction across token-authenticated, ID/number-based, and filtered or unfiltered instance lookups while preserving existing responses when exposure is enabled.

Remove instance tokens from fetchInstances responses unless AUTHENTICATION_EXPOSE_IN_FETCH_INSTANCES is explicitly enabled.
@sourcery-ai

sourcery-ai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. This changes whether authenticated callers receive instance tokens, which are credentials and could affect access to instances. Reverting restores the previous response behavior, but any tokens exposed during an incorrect configuration or implementation could be used before the revert.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

This branch has not been deployed

No deployments
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.

1 participant