You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2026/07/27 16:36:51 UTC
[PR] Add AGENTS.md so the threat model is discoverable by agents [calcite]
potiuk opened a new pull request, #5126:
URL: https://github.com/apache/calcite/pull/5126
## What
Adds an `AGENTS.md` at the repository root pointing at `SECURITY.md`, and adds it to `.ratignore` alongside `SECURITY.md`.
## Why
CALCITE-7605 landed the threat model at `site/_docs/security_threat_model.md` together with a `SECURITY.md` that links to it. That part is complete and reads well.
What is missing is the entry point. Automated agents — security scanners, code analyzers, coding assistants — locate a project's security model by following a fixed chain:
```
AGENTS.md -> SECURITY.md -> the threat model
```
`apache/calcite` has the second and third hops but not the first, so the chain cannot be walked mechanically and an agent starting from a clone has no way to find the model on its own.
This matters concretely for the ASF Security team's scanning programme: we refuse to run a scan against a project whose model is not mechanically discoverable, because without the model in context the false-positive rate is more than a PMC can reasonably triage. This PR closes that gap for Calcite.
## What is in the file
No new claims — everything restates the merged model:
- A pointer to `SECURITY.md` and onward to `site/_docs/security_threat_model.md`.
- The framing that Calcite is embedded, opens no socket, and has no authentication or authorization of its own.
- The two rules that carry most of the triage weight: the **surprising vs unsurprising class loading** gate (only SPI implementations are instantiated by name, via `Class.forName(name, false, loader)` plus `isAssignableFrom`, across the enumerated SPI positions), and the **pushed-down SQL** split (generated SQL reaching a configured backend is not a vulnerability; a pushdown bug reading beyond the configured schemas is P4 and is one).
- Signposts to the model's "Not a vulnerability" and "Downstream responsibilities" sections.
## Notes for reviewers
- **Docs only.** No production code is touched.
- **`.ratignore`:** `AGENTS.md` carries no license header, so it is excluded exactly as CALCITE-7605 excluded `SECURITY.md`. Happy to add a header and drop the `.ratignore` line instead if the PMC prefers that direction.
- **No JIRA reference in the title.** CALCITE-7605 is resolved, and I did not want to reopen it or file a ticket on the project's behalf unprompted. If Calcite would like a JIRA for this, say the word and I will file one and retitle the PR to match the `[CALCITE-NNNN]` convention.
- I deliberately did **not** link the rendered site URL for the threat model, since it does not resolve yet — the in-repo path is what an agent follows anyway.
Opened by the ASF Security team as part of the Frontier Model Preparation scan pre-flight for Calcite, following the request on the PMC's `[GLASSWING]` thread. Review, change, or close as the PMC sees fit — the document is the project's.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add AGENTS.md so the threat model is discoverable by agents [calcite]
Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on PR #5126:
URL: https://github.com/apache/calcite/pull/5126#issuecomment-5395711580
@potiuk , I assume you use some kind of skill to create draft AGENTS.md. I would like to suggest you the following template instead: https://github.com/apache/calcite/pull/5126
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add AGENTS.md so the threat model is discoverable by agents [calcite]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #5126:
URL: https://github.com/apache/calcite/pull/5126#issuecomment-5094174737
## [](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5126) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5126&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=5126&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=5126&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5126&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=5126&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=5126)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add AGENTS.md so the threat model is discoverable by agents [calcite]
Posted by "rubenada (via GitHub)" <gi...@apache.org>.
rubenada commented on PR #5126:
URL: https://github.com/apache/calcite/pull/5126#issuecomment-5114704152
Thanks @potiuk for the patch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add AGENTS.md so the threat model is discoverable by agents [calcite]
Posted by "rubenada (via GitHub)" <gi...@apache.org>.
rubenada merged PR #5126:
URL: https://github.com/apache/calcite/pull/5126
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add AGENTS.md so the threat model is discoverable by agents [calcite]
Posted by "vlsi (via GitHub)" <gi...@apache.org>.
vlsi commented on code in PR #5126:
URL: https://github.com/apache/calcite/pull/5126#discussion_r3843724279
##########
AGENTS.md:
##########
@@ -0,0 +1,43 @@
+# Agent guidance
+
+This file is read by automated agents (security scanners, code analyzers,
+AI assistants) operating on this repository. It points them at the
+human-authored references they should consult before producing output.
+
+## Security
+
+Security model: [SECURITY.md](./SECURITY.md), which links to the project's
+threat model at
+[site/_docs/security_threat_model.md](./site/_docs/security_threat_model.md).
+
+Calcite is an embedded SQL framework, not a server. It opens no socket and
+has no authentication or authorization of its own; the host application
+owns transport, identity, and schema scoping. Read the threat model before
+reporting anything — it is explicit about what it does and does not treat
+as a vulnerability.
+
+Two rules carry most of the triage weight:
+
+- **Surprising vs unsurprising class loading.** A class named through a
+ Calcite SPI position — `schemaFactory`, `parserFactory`, `typeSystem`,
+ `metaTableFactory`, `metaColumnFactory`, `tableFactory`, function
+ classes, `dataSource`, `jdbcDriver`, `model` — is loaded only through
+ that SPI, gated by `Class.forName(name, false, loader)` plus an
+ `isAssignableFrom` check. A class that does not implement the SPI for
+ its position is never instantiated by name. SQL may name SPI classes,
+ but only SPI implementations run, and only through their SPI.
+- **Pushed-down SQL.** The SQL Calcite generates and sends to a backend
+ the operator configured is *not* a vulnerability — the query author can
+ already reach that endpoint through the visible schemas. A pushdown bug
+ that reads *beyond* the configured schemas is P4 and *is* one.
+
+Explicitly not vulnerabilities (see the model's "Not a vulnerability"
+section): the os-adapter running OS commands, the file/CSV/JSON adapters
+reading paths they were configured with, anything requiring a changed
+system property or classpath, a third-party driver's behaviour past the
+connection boundary, and cross-tenant reads that follow from the embedder
+exposing several principals' schemas on one connection.
+
+The model also lists what belongs to the host rather than the library —
+transport and identity, schema scoping, adapter selection, the classpath,
+and whatever a `model` points at — under "Downstream responsibilities".
Review Comment:
This gets injected to every context of every agent. It bloats context with zero gain. There's no sense in providing excessive security-related stuff. It should be referenced instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add AGENTS.md so the threat model is discoverable by agents [calcite]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #5126:
URL: https://github.com/apache/calcite/pull/5126#discussion_r3862052416
##########
AGENTS.md:
##########
@@ -0,0 +1,43 @@
+# Agent guidance
+
+This file is read by automated agents (security scanners, code analyzers,
+AI assistants) operating on this repository. It points them at the
+human-authored references they should consult before producing output.
+
+## Security
+
+Security model: [SECURITY.md](./SECURITY.md), which links to the project's
+threat model at
+[site/_docs/security_threat_model.md](./site/_docs/security_threat_model.md).
+
+Calcite is an embedded SQL framework, not a server. It opens no socket and
+has no authentication or authorization of its own; the host application
+owns transport, identity, and schema scoping. Read the threat model before
+reporting anything — it is explicit about what it does and does not treat
+as a vulnerability.
+
+Two rules carry most of the triage weight:
+
+- **Surprising vs unsurprising class loading.** A class named through a
+ Calcite SPI position — `schemaFactory`, `parserFactory`, `typeSystem`,
+ `metaTableFactory`, `metaColumnFactory`, `tableFactory`, function
+ classes, `dataSource`, `jdbcDriver`, `model` — is loaded only through
+ that SPI, gated by `Class.forName(name, false, loader)` plus an
+ `isAssignableFrom` check. A class that does not implement the SPI for
+ its position is never instantiated by name. SQL may name SPI classes,
+ but only SPI implementations run, and only through their SPI.
+- **Pushed-down SQL.** The SQL Calcite generates and sends to a backend
+ the operator configured is *not* a vulnerability — the query author can
+ already reach that endpoint through the visible schemas. A pushdown bug
+ that reads *beyond* the configured schemas is P4 and *is* one.
+
+Explicitly not vulnerabilities (see the model's "Not a vulnerability"
+section): the os-adapter running OS commands, the file/CSV/JSON adapters
+reading paths they were configured with, anything requiring a changed
+system property or classpath, a third-party driver's behaviour past the
+connection boundary, and cross-tenant reads that follow from the embedder
+exposing several principals' schemas on one connection.
+
+The model also lists what belongs to the host rather than the library —
+transport and identity, schema scoping, adapter selection, the classpath,
+and whatever a `model` points at — under "Downstream responsibilities".
Review Comment:
Correct. I am not even sure why it ended up here eventually (long time ago and I had about 100 of similar PRs :( and most of them were bare minimum and linking to SECURITY.md for more details.
This is a bit of the problem with Agentically generated PRs that things like that can slip - especially when you do a lot of those in a short time (learning for me as well to pay more attention).
Thanks @vlsi for updating it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org