Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(edge-identities): prevent unauthorised identity access #5135

Merged
merged 10 commits into from
Feb 20, 2025

Conversation

matthewelwell
Copy link
Contributor

Changes

Fixes permissions on EdgeIdentityViewSet

How did you test this code?

Added / updated tests

@matthewelwell matthewelwell requested a review from a team as a code owner February 19, 2025 14:24
@matthewelwell matthewelwell requested review from khvn26 and removed request for a team February 19, 2025 14:24
Copy link

vercel bot commented Feb 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 9:12pm
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 9:12pm
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 9:12pm

@github-actions github-actions bot added the api Issue related to the REST API label Feb 19, 2025
Copy link
Contributor

github-actions bot commented Feb 19, 2025

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-5135 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-5135 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-5135 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-5135 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-5135 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-5135 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-5135 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-5135 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-5135 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-5135 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-5135 Finished ✅ Results

@github-actions github-actions bot added the fix label Feb 19, 2025
Copy link
Contributor

github-actions bot commented Feb 19, 2025

Uffizzi Preview deployment-61098 was deleted.

@github-actions github-actions bot added fix and removed fix labels Feb 19, 2025
self.kwargs["identity_uuid"]
)
edge_identity = EdgeIdentity.from_identity_document(identity_document)
self.check_object_permissions(self.request, edge_identity)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is the main fix in this PR. There's a lot of other changes here too, mostly related to the refactor implemented to remove this TODO, but I wanted to highlight the actual fix.

@github-actions github-actions bot added fix and removed fix labels Feb 19, 2025
@github-actions github-actions bot added fix and removed fix labels Feb 19, 2025
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.46%. Comparing base (5de0b42) to head (ef10cb0).
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5135      +/-   ##
==========================================
+ Coverage   97.45%   97.46%   +0.01%     
==========================================
  Files        1216     1224       +8     
  Lines       42368    42573     +205     
==========================================
+ Hits        41289    41495     +206     
+ Misses       1079     1078       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot added fix and removed fix labels Feb 19, 2025
self._reset_initial_state() # type: ignore[no-untyped-call]

@classmethod
def from_identity_document(cls, identity_document: dict) -> "EdgeIdentity": # type: ignore[type-arg]
return EdgeIdentity(IdentityModel.model_validate(identity_document))

@property
def django_id(self) -> int:
return self._engine_identity_model.django_id # type: ignore[return-value]
def django_id(self) -> int: # pragma: no cover
Copy link
Member

Choose a reason for hiding this comment

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

Is this dead code? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think so. I removed it.

@github-actions github-actions bot added fix and removed fix labels Feb 19, 2025
@github-actions github-actions bot added fix and removed fix labels Feb 19, 2025
@matthewelwell matthewelwell merged commit 690f87c into main Feb 20, 2025
37 checks passed
@matthewelwell matthewelwell deleted the fix/prevent-unauthroised-identity-access branch February 20, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants