Skip to content

fix(api): scope configuration lookup to authenticated owner#4161

Open
sgoel2be24-cyber wants to merge 1 commit into
topoteretes:devfrom
sgoel2be24-cyber:codex/fix-principal-config-authorization
Open

fix(api): scope configuration lookup to authenticated owner#4161
sgoel2be24-cyber wants to merge 1 commit into
topoteretes:devfrom
sgoel2be24-cyber:codex/fix-principal-config-authorization

Conversation

@sgoel2be24-cyber

@sgoel2be24-cyber sgoel2be24-cyber commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

An authenticated user could request a configuration using its UUID without verifying that the configuration belonged to them. This change passes the authenticated principal ID into the lookup and filters by both configuration ID and owner ID.
Unauthorized and nonexistent configurations continue returning the existing empty-object response, avoiding resource enumeration.
Acceptance Criteria
A configuration is returned only when it belongs to the authenticated principal.
Another user’s configuration cannot be retrieved by UUID.
Missing and unauthorized configurations return {}.
Regression tests cover both the API route and database query.
Type of Change
Check only:

  • Bug fix (non-breaking change that fixes an issue)
    Screenshots
    Run this command and attach a screenshot of the result:
    uv run pytest cognee/tests/unit/api/test_configuration_router_authorization.py cognee/tests/unit/modules/users/test_get_principal_configuration.py cognee/tests/unit/modules/users -q
    It should show 19 passed.
    Checklist
    Check these:
  • I have tested my changes thoroughly before submitting this PR
  • This PR contains minimal changes necessary to address the issue/feature
  • My code follows the project's coding standards and style guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if applicable)
  • All new and existing tests pass
  • I have searched existing PRs to ensure this change hasn't been submitted already
  • I have linked any relevant issues in the description
  • My commits have clear and descriptive messages

DCO Affirmation

I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.

Signed-off-by: shikhar <sgoel2_be24@thapar.edu>
@sgoel2be24-cyber
sgoel2be24-cyber changed the base branch from main to dev July 20, 2026 21:19
@sgoel2be24-cyber
sgoel2be24-cyber force-pushed the codex/fix-principal-config-authorization branch from 6c86bd0 to 7e8e9e0 Compare July 20, 2026 21:27
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