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.

jonhealy1
jonhealy1 previously approved these changes Nov 6, 2025
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!

Gomez324
Gomez324 previously approved these changes Nov 13, 2025
@YuriZmytrakov YuriZmytrakov dismissed stale reviews from Gomez324 and jonhealy1 via 29ce3df November 13, 2025 10:45
@jonhealy1 jonhealy1 merged commit b726926 into main Nov 13, 2025
12 checks passed
@jonhealy1 jonhealy1 deleted the CAT-1522 branch November 13, 2025 11:48
@jonhealy1 jonhealy1 mentioned this pull request Nov 13, 2025
4 tasks
jonhealy1 added a commit that referenced this pull request Nov 13, 2025
**Related Issue(s):**

- None

**Description:**

### Added 

- Environment variable `EXCLUDED_FROM_ITEMS` to exclude specific fields
from items endpoint response. Supports comma-separated list of fully
qualified field names (e.g.,
`properties.auth:schemes,properties.storage:schemes`)
[#518](#518)

**PR Checklist:**

- [x] Code is formatted and linted (run `pre-commit run --all-files`)
- [x] Tests pass (run `make test`)
- [x] Documentation has been updated to reflect changes, if applicable
- [x] Changes are added to the changelog
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.

4 participants