Repository navigation
fix(solid): refuse terms Turtle cannot write, so an import adds no statements - #326
Merged
Merged
Conversation
…atements A JSON-LD file keeps an IRI with `>` or a space in its fragment, a blank node label with any characters, and a datatype or predicate IRI of either kind. The Turtle writers every save goes through (the Solid client library's, patchBody, turtleOf) write these as they are, so a `>` ends the IRI and the pod reads the rest as statements of their own. An imported card picture could so add a statement to the new cards document that no shape or ownership check saw, and the ownership rules rely on what those documents say. Turtle can't escape such a character in an IRI, so these terms are refused instead. writableTerms.ts names what Turtle can write as it is: IRIs (isWritableIri), blank node labels and language tags by Turtle's grammar, no rdf:langString without a language, no base direction, no quoted triple. Every write refuses the rest with unwritableTerm before anything is sent: PATCHes and PUTs in saveDataset, insert-only PATCHes, a release's Turtle and an export. A deck import leaves such triples out, and a release read from a file is refused, since a draft keeps its triples as they are. A WebID must be writable, and a picture's address typed in the Studio has those characters percent-encoded. Refs: GHSA-x937-hx25-qfp4
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.
What and why
A JSON-LD file can hold IRIs that Turtle can't write: an IRI with
>or a space in its fragment, a predicate or datatype IRI of either kind, or a blank node label with any characters. The Turtle writers every save goes through write these as they are: the Solid client library's,patchBodyandturtleOf. A>then ends the IRI, and the pod reads the rest as statements of their own. A deck file import could so add a statement to the new cards document that no shape or ownership check saw (GHSA-x937-hx25-qfp4).Turtle has no legal escape for such a character in an IRI, so these terms are refused instead of escaped:
packages/solid/src/writableTerms.tsnames what Turtle can write as it is: IRIs (isWritableIriindomain/webId.ts), blank node labels and language tags by Turtle's grammar, nordf:langStringwithout a language, no base direction, no quoted triple.unwritableTermbefore anything is sent: a save's PATCH or PUT (saveDataset), an insert-only PATCH (appendAllToDocument), a release's Turtle (turtleOf) and an export.Mona Lisa.jpgis saved asMona%20Lisa.jpg).turtleWriter.test.tshad asserted that<https://other.example/a b>was written as it is; it now uses%20.docs/data-model.mdsays it under Write discipline and in the import list.Refs: GHSA-x937-hx25-qfp4
Checklist
Refs:, notCloses:. Leave this unchecked otherwise.npm run checkpasses (lint, Markdown and spelling included),npm run lint:reusetoo if a file was added, andnpm run crosschecktoo ifns/ordecks/changed.docs/is listed in docs/docs.ttl.packages/ui/src/i18n/).ns/was agreed in an issue first; no publishedns/shapes/*/vN.ttlordecks/*/vN.ttlwas edited; generated files were regenerated, not edited. (n/a: no change tons/ordecks/)!and aBREAKING CHANGE:footer).npm run check:breakingsees a line ofapi/that goes, but not a feature removed, nor a reader that reads less than before.writableTerms.ts)npm run lint:reuse), or a new deck its line inREUSE.toml; third-party content is credited.npm run dev) and tried the change, and considered the user journeys.type(scope): subject,!and aBREAKING CHANGE:footer if it breaks something), with an imperative subject and a body that explains why (CONTRIBUTING.md).