Repository navigation
feat: add optional allow-list for fetching json schemas #1828
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
Open
jsignell
wants to merge
5
commits into
stac-utils:main
Choose a base branch
from
jsignell:allow-list
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b7b666b
Add optional allow-list for fetching json schemas
jsignell d327e94
Add SecureJsonSchemaSTACValidator
jsignell ba12498
Add tests for SecureJsonSchemaSTACValidator
jsignell 8278420
Add some minimal docs
jsignell 3082980
Merge branch 'main' into allow-list
jsignell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
70 changes: 70 additions & 0 deletions
70
tests/validation/cassettes/test_validate/test_secure_validator_allows_trusted_schema.yaml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| interactions: | ||
| - request: | ||
| body: null | ||
| headers: {} | ||
| method: GET | ||
| uri: https://stac-extensions.github.io/projection/v2.0.0/schema.json | ||
| response: | ||
| body: | ||
| string: "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": | ||
| \"https://stac-extensions.github.io/projection/v2.0.0/schema.json\",\n \"title\": | ||
| \"Projection Extension\",\n \"description\": \"STAC Projection Extension | ||
| for STAC Items.\",\n \"$comment\": \"This schema succeeds if the proj: fields | ||
| are not used at all, please keep this in mind.\",\n \"oneOf\": [\n {\n | ||
| \ \"$comment\": \"This is the schema for STAC Items.\",\n \"allOf\": | ||
| [\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n },\n | ||
| \ {\n \"type\": \"object\",\n \"required\": [\n \"type\",\n | ||
| \ \"properties\",\n \"assets\"\n ],\n \"properties\": | ||
| {\n \"type\": {\n \"const\": \"Feature\"\n },\n | ||
| \ \"properties\": {\n \"$ref\": \"#/definitions/fields\"\n | ||
| \ },\n \"assets\": {\n \"type\": \"object\",\n | ||
| \ \"additionalProperties\": {\n \"$ref\": \"#/definitions/fields\"\n | ||
| \ }\n }\n }\n }\n ]\n },\n | ||
| \ {\n \"$comment\": \"This is the schema for STAC Collections.\",\n | ||
| \ \"allOf\": [\n {\n \"type\": \"object\",\n \"required\": | ||
| [\n \"type\"\n ],\n \"properties\": {\n \"type\": | ||
| {\n \"const\": \"Collection\"\n },\n \"assets\": | ||
| {\n \"type\": \"object\",\n \"additionalProperties\": | ||
| {\n \"$ref\": \"#/definitions/fields\"\n }\n },\n | ||
| \ \"item_assets\": {\n \"type\": \"object\",\n \"additionalProperties\": | ||
| {\n \"$ref\": \"#/definitions/fields\"\n }\n }\n | ||
| \ }\n },\n {\n \"$ref\": \"#/definitions/stac_extensions\"\n | ||
| \ }\n ]\n }\n ],\n \"definitions\": {\n \"stac_extensions\": | ||
| {\n \"type\": \"object\",\n \"required\": [\n \"stac_extensions\"\n | ||
| \ ],\n \"properties\": {\n \"stac_extensions\": {\n \"type\": | ||
| \"array\",\n \"contains\": {\n \"const\": \"https://stac-extensions.github.io/projection/v2.0.0/schema.json\"\n | ||
| \ }\n }\n }\n },\n \"fields\": {\n \"type\": | ||
| \"object\",\n \"properties\": {\n \"proj:code\":{\n \"title\":\"Projection | ||
| code\",\n \"type\":[\n \"string\",\n \"null\"\n | ||
| \ ]\n },\n \"proj:wkt2\":{\n \"title\":\"Coordinate | ||
| Reference System in WKT2 format\",\n \"type\":[\n \"string\",\n | ||
| \ \"null\"\n ]\n },\n \"proj:projjson\": | ||
| {\n \"title\":\"Coordinate Reference System in PROJJSON format\",\n | ||
| \ \"oneOf\": [\n {\n \"$ref\": \"https://proj.org/schemas/v0.7/projjson.schema.json\"\n | ||
| \ },\n {\n \"type\": \"null\"\n }\n | ||
| \ ]\n },\n \"proj:geometry\":{\n \"$ref\": | ||
| \"https://geojson.org/schema/Geometry.json\"\n },\n \"proj:bbox\":{\n | ||
| \ \"title\":\"Extent\",\n \"type\":\"array\",\n \"oneOf\": | ||
| [\n {\n \"minItems\":4,\n \"maxItems\":4\n | ||
| \ },\n {\n \"minItems\":6,\n \"maxItems\":6\n | ||
| \ }\n ],\n \"items\":{\n \"type\":\"number\"\n | ||
| \ }\n },\n \"proj:centroid\":{\n \"title\":\"Centroid\",\n | ||
| \ \"type\":\"object\",\n \"required\": [\n \"lat\",\n | ||
| \ \"lon\"\n ],\n \"properties\": {\n \"lat\": | ||
| {\n \"type\": \"number\",\n \"minimum\": -90,\n | ||
| \ \"maximum\": 90\n },\n \"lon\": {\n \"type\": | ||
| \"number\",\n \"minimum\": -180,\n \"maximum\": | ||
| 180\n }\n }\n },\n \"proj:shape\":{\n \"title\":\"Shape\",\n | ||
| \ \"type\":\"array\",\n \"minItems\":2,\n \"maxItems\":2,\n | ||
| \ \"items\":{\n \"type\":\"integer\"\n }\n },\n | ||
| \ \"proj:transform\":{\n \"title\":\"Transform\",\n \"type\":\"array\",\n | ||
| \ \"oneOf\": [\n {\n \"minItems\":6,\n \"maxItems\":6\n | ||
| \ },\n {\n \"minItems\":9,\n \"maxItems\":9\n | ||
| \ }\n ],\n \"items\":{\n \"type\":\"number\"\n | ||
| \ }\n }\n },\n \"patternProperties\": {\n \"^(?!proj:)\": | ||
| {}\n },\n \"additionalProperties\": false\n }\n }\n}" | ||
| headers: {} | ||
| status: | ||
| code: 200 | ||
| message: OK | ||
| version: 1 |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up adding this because it seems like nice quality of life, but I am pretty +0 on it.