Skip to content

sparql: SPARQL 1.1 (UNION/MINUS/BIND/VALUES/aggregation) + loud rejection (v0.4.5)#27

Open
mdheller wants to merge 2 commits into
mainfrom
feat/sparql-1.1
Open

sparql: SPARQL 1.1 (UNION/MINUS/BIND/VALUES/aggregation) + loud rejection (v0.4.5)#27
mdheller wants to merge 2 commits into
mainfrom
feat/sparql-1.1

Conversation

@mdheller

Copy link
Copy Markdown
Member

Adds UNION, MINUS, BIND (arith+CONCAT/STR), VALUES, COUNT/SUM/AVG/MIN/MAX + GROUP BY, 'a'→rdf:type. Unsupported forms throw instead of silently-wrong empties. 182 tests green. Re-vendored into prophet-platform#787.

mdheller added 2 commits July 4, 2026 12:06
…(2 high)

- sparql.ts (js/remote-property-injection x2): PREFIX names and SELECT variable
  names come straight from the query text and were written to plain objects
  (this.prefixes[prefix], row[v]) — prototype pollution via __proto__/constructor.
  Added an isSafeKey() guard on both writes.
- masking.ts (js/insufficient-password-hash): StaticKeyProvider.fromPassphrase
  derived the AES-256 key with a bare SHA-256; replaced with a memory-hard KDF
  (scryptSync, fixed domain salt so it stays deterministic for reversible masking).
  NOTE: changes the derived key vs the old scheme — data masked under SHA-256 must
  be re-masked.

The atomspace SHA-1 weak-crypto alert (#6) was dismissed separately as a false
positive: it's content-addressing (atom identity), not a security hash.

165 tests green; tsc clean; bundle rebuilt.
…d + loud rejection of unsupported forms (v0.4.5)

The evaluator silently mis-parsed UNION/MINUS/BIND/VALUES/SERVICE/GRAPH into empty results.
Adds real support for UNION, MINUS (antijoin), BIND (arith+CONCAT/STR), VALUES, and
COUNT/SUM/AVG/MIN/MAX with GROUP BY; 'a' now expands to rdf:type; and unsupported query
forms throw an explicit error instead of returning silently-wrong empties. 182 tests green.
Comment thread ts/src/sparql.ts
const bindings: Binding[] = []
for (const rows of groups.values()) {
const out: Binding = {}
for (const g of groupBy) out[g] = rows[0]?.[g] ?? null
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