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

anonymous metadata queries should use discovery config only #108

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

gsfk
Copy link
Member

@gsfk gsfk commented Sep 16, 2024

Anonymous users should not have access to arbitrary fields in phenopackets or experiments metadata (for example they should not be able to query subject ids). So anonymous queries about metadata should use values from discovery config only.

Changes:

  • move request parsing earlier (so we don't have to do it multiple times)
  • add reject_query_if_not_permitted() to request handling (throws "bad request" for forbidden queries)

Copy link
Member

@davidlougheed davidlougheed left a comment

Choose a reason for hiding this comment

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

lgtm

@gsfk gsfk merged commit b3b8b78 into master Sep 16, 2024
2 checks passed
@@ -169,6 +169,9 @@ class Config:
PHENOPACKETS_SCHEMA_REFERENCE = {"entityType": "individual", "schema": "phenopackets v1"}

MAX_RETRIES_FOR_CENSORSHIP_PARAMS = 2

# don't let anonymous users query arbitrary phenopacket or experiment fields
ANONYMOUS_METADATA_QUERY_USES_DISCOVERY_CONFIG_ONLY = True
Copy link
Member

Choose a reason for hiding this comment

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

technically these aren't anonymous users per se, just ones without query:data - could be called CENSORED_METADATA_QUERY_USES_DISCOVERY_CONFIG_ONLY

Copy link
Member

Choose a reason for hiding this comment

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

(oops)

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