Security: Stop Denied/Pending ChallengeHost rows from retaining host privileges - #5194
Draft
cursor[bot] wants to merge 1 commit into
Draft
Security: Stop Denied/Pending ChallengeHost rows from retaining host privileges#5194cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Denied/Pending host membership rows previously still unlocked host APIs via is_user_a_host_of_challenge, including kubeconfig and EKS tokens. Align hostship checks with Accepted/Self only. Co-authored-by: Rishabh Jain <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5194 +/- ##
=======================================
Coverage 91.30% 91.30%
=======================================
Files 115 115
Lines 8996 8997 +1
=======================================
+ Hits 8214 8215 +1
Misses 782 782
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
is_user_a_host_of_challenge/get_challenge_host_teams_for_userpreviously treated anyChallengeHostrow as active hostship, ignoringstatus. After a host was Denied (or left Pending/Unknown), they could still call host-gated APIs and retrieve cluster secrets (kube_config, EKS bearer tokens).This change aligns hostship checks with
Accepted/Selfonly (matchingget_challenge_host_required_errorand participant host helpers), and updates related call sites.Finding
apps/hosts/utils.pyChallengeHostrow → host APIs still authorize → evaluation cluster credentials / host mutations remain availableChanges
ACTIVE_HOST_STATUSES = (Accepted, Self)and filter hostship helpersTests
pytest tests/unit/hosts/(50 passed)pytest tests/unit/challenges/test_permissions.py tests/unit/participants/test_utils.py(25 passed)