dpgaspar commented on code in PR #40503:
URL: https://github.com/apache/superset/pull/40503#discussion_r3323936949
##########
AGENTS.md:
##########
@@ -52,6 +52,37 @@ Common pre-commit failures:
- **External API exposure** - Use UUIDs in public APIs instead of internal
integer IDs
- **Existing models** - Add UUID fields alongside integer IDs for gradual
migration
+## Security and Threat Model
+
+Before evaluating any code path for security issues, read
[`SECURITY.md`](SECURITY.md). It is the canonical, authoritative source for
Apache Superset's security model and is referenced by both human reporters and
automated scanners.
+
+In short, the test for whether a finding is in scope is one question:
+
+> *Does it let a principal perform an action the role and capability matrix in
`SECURITY.md` does not entitle them to?*
+
+If yes, it is in scope. If no, it is not.
+
+The three trust boundaries are:
+
+1. **The Admin role** is a fully trusted operational principal. Anything an
Admin can do through documented configuration, API, or UI is an intended
capability, not a vulnerability.
+2. **The operator** owns deployment-time decisions (secrets, network exposure,
feature-flag selection, connector and codec choices, notification destinations,
third-party plugins). Misconfiguration at this layer is a deployment defect,
not a Superset vulnerability.
+3. **The codebase** is responsible for enforcing the role and capability
matrix wherever it exposes functionality to a principal: API routes, command
and DAO layers, UI handlers, background jobs, and any other entry point. A
missing or incorrect enforcement check is in scope no matter where it lives.
+
+The security model assumes that operator-controlled infrastructure, including
the metadata database, cache backends, message brokers, secret stores, and
deployment environment, remains within the operator's trust boundary.
Vulnerabilities must demonstrate a security boundary violation by an attacker
who does not already control those systems.
+
+The canonical authorization pattern in this codebase is `@has_access_api`
(Flask-AppBuilder) at the route level plus
`security_manager.raise_for_access(...)` at the object level, with DAO
`base_filters` where listing is involved. Code following both gates is not a
finding **on authorization grounds** by itself; code that omits the per-object
gate on a route that returns or mutates a specific object is. Code following
both gates can still contain injection, SSRF, XSS, or other classes of finding
unrelated to authorization, which are evaluated separately.
Review Comment:
`@has_access_api` is the legacy decorator, let's reference:
- @protect() — REST API routes (ModelRestApi / BaseApi)
- @has_access_api — legacy view routes
- @has_access — legacy HTML view routes
##########
AGENTS.md:
##########
@@ -52,6 +52,37 @@ Common pre-commit failures:
- **External API exposure** - Use UUIDs in public APIs instead of internal
integer IDs
- **Existing models** - Add UUID fields alongside integer IDs for gradual
migration
+## Security and Threat Model
+
+Before evaluating any code path for security issues, read
[`SECURITY.md`](SECURITY.md). It is the canonical, authoritative source for
Apache Superset's security model and is referenced by both human reporters and
automated scanners.
+
+In short, the test for whether a finding is in scope is one question:
+
+> *Does it let a principal perform an action the role and capability matrix in
`SECURITY.md` does not entitle them to?*
+
+If yes, it is in scope. If no, it is not.
+
+The three trust boundaries are:
+
+1. **The Admin role** is a fully trusted operational principal. Anything an
Admin can do through documented configuration, API, or UI is an intended
capability, not a vulnerability.
+2. **The operator** owns deployment-time decisions (secrets, network exposure,
feature-flag selection, connector and codec choices, notification destinations,
third-party plugins). Misconfiguration at this layer is a deployment defect,
not a Superset vulnerability.
+3. **The codebase** is responsible for enforcing the role and capability
matrix wherever it exposes functionality to a principal: API routes, command
and DAO layers, UI handlers, background jobs, and any other entry point. A
missing or incorrect enforcement check is in scope no matter where it lives.
+
+The security model assumes that operator-controlled infrastructure, including
the metadata database, cache backends, message brokers, secret stores, and
deployment environment, remains within the operator's trust boundary.
Vulnerabilities must demonstrate a security boundary violation by an attacker
who does not already control those systems.
+
+The canonical authorization pattern in this codebase is `@has_access_api`
(Flask-AppBuilder) at the route level plus
`security_manager.raise_for_access(...)` at the object level, with DAO
`base_filters` where listing is involved. Code following both gates is not a
finding **on authorization grounds** by itself; code that omits the per-object
gate on a route that returns or mutates a specific object is. Code following
both gates can still contain injection, SSRF, XSS, or other classes of finding
unrelated to authorization, which are evaluated separately.
+
Review Comment:
text implies `raise_for_access` is expected on every route that "returns or
mutates a specific object", which would flag annotations, tags, saved queries,
etc. as missing it. That's a false positive factory.
```
Object-level authorization via security_manager.raise_for_access(...)
applies to data-bearing resources: dashboards, charts, datasets/datasources,
queries, database+table access, and query contexts.
Other resources (annotations, tags, CSS templates, reports, RLS rules,
etc.) rely on route-level @protect() / @has_access_api plus DAO base_filters
for ownership scoping; the absence of
raise_for_access on these resources is by design, not a finding.
```
WDYT?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]