Skip to content

Conversation

@YuriZmytrakov
Copy link
Collaborator

@YuriZmytrakov YuriZmytrakov commented Nov 2, 2025

Description:

Add the HIDE_PRIVATE_DATA and PRIVATE_DATA_FIELD environment variables to toggle inclusion of private or technical fields in SFEOS responses:

  • true: hides private data
  • false: returns full response
    Improves control over sensitive data exposure while maintaining backward compatibility.

PR Checklist:

  • Code is formatted and linted (run pre-commit run --all-files)
  • Tests pass (run make test)
  • Documentation has been updated to reflect changes, if applicable
  • Changes are added to the changelog

@YuriZmytrakov YuriZmytrakov force-pushed the CAT-1522 branch 4 times, most recently from 4b6e7e0 to 379ea80 Compare November 3, 2025 15:06
Copy link
Collaborator

@jonhealy1 jonhealy1 left a comment

Choose a reason for hiding this comment

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

This is really useful, just a couple of thoughts:

  1. let's allow for a list of private data fields.
  2. most Users will have private fields listed under properties so we need to account for nested fields

ie. PRIVATE_DATA_FIELDS=properties.private_id,properties.private_name

private_data_field = os.getenv("PRIVATE_DATA_FIELD")
if get_bool_env("HIDE_PRIVATE_DATA") and private_data_field:
stac_item.pop(private_data_field, None)
return stac_item
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. let's allow for a list of private data fields. PRIVATE_DATA_FIELDS
  2. most Users will have private fields listed under properties so we need to account for nested fields

@YuriZmytrakov YuriZmytrakov force-pushed the CAT-1522 branch 6 times, most recently from 83990d9 to 1eaf552 Compare November 5, 2025 21:57


@pytest.mark.asyncio
async def test_hide_private_data_from_item(app_client, txn_client, load_test_data):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Everything is looking really good. Let's just add a test case with a field like properties.confidential to make sure that nested fields are being excluded.

Copy link
Collaborator Author

@YuriZmytrakov YuriZmytrakov Nov 6, 2025

Choose a reason for hiding this comment

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

Thank you @jonhealy1 I have expanded the test with a test case properties.private_data.

Copy link
Collaborator

@jonhealy1 jonhealy1 left a comment

Choose a reason for hiding this comment

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

Looks great thanks!

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.

3 participants