Apache Druid: a high performance real-time analytics database.
Go to file
Jihoon Son 73ce5df22d
Add support for authorizing query context params (#12396)
The query context is a way that the user gives a hint to the Druid query engine, so that they enforce a certain behavior or at least let the query engine prefer a certain plan during query planning. Today, there are 3 types of query context params as below.

Default context params. They are set via druid.query.default.context in runtime properties. Any user context params can be default params.
User context params. They are set in the user query request. See https://druid.apache.org/docs/latest/querying/query-context.html for parameters.
System context params. They are set by the Druid query engine during query processing. These params override other context params.
Today, any context params are allowed to users. This can cause 
1) a bad UX if the context param is not matured yet or 
2) even query failure or system fault in the worst case if a sensitive param is abused, ex) maxSubqueryRows.

This PR adds an ability to limit context params per user role. That means, a query will fail if you have a context param set in the query that is not allowed to you. To do that, this PR adds a new built-in resource type, QUERY_CONTEXT. The resource to authorize has a name of the context param (such as maxSubqueryRows) and the type of QUERY_CONTEXT. To allow a certain context param for a user, the user should be granted WRITE permission on the context param resource. Here is an example of the permission.

{
  "resourceAction" : {
    "resource" : {
      "name" : "maxSubqueryRows",
      "type" : "QUERY_CONTEXT"
    },
    "action" : "WRITE"
  },
  "resourceNamePattern" : "maxSubqueryRows"
}
Each role can have multiple permissions for context params. Each permission should be set for different context params.

When a query is issued with a query context X, the query will fail if the user who issued the query does not have WRITE permission on the query context X. In this case,

HTTP endpoints will return 403 response code.
JDBC will throw ForbiddenException.
Note: there is a context param called brokerService that is used only by the router. This param is used to pin your query to run it in a specific broker. Because the authorization is done not in the router, but in the broker, if you have brokerService set in your query without a proper permission, your query will fail in the broker after routing is done. Technically, this is not right because the authorization is checked after the context param takes effect. However, this should not cause any user-facing issue and thus should be OK. The query will still fail if the user doesn’t have permission for brokerService.

The context param authorization can be enabled using druid.auth.authorizeQueryContextParams. This is disabled by default to avoid any hassle when someone upgrades his cluster blindly without reading release notes.
2022-04-21 14:21:16 +05:30
.github Lock hadoop dependencies to 2.8.5 (#11583) 2021-08-12 15:16:47 +05:30
.idea Use ExecutorService variables to assign ExecutorService Instances (#11373) 2021-06-25 16:56:34 -07:00
benchmarks Bump maven-site-plugin from 3.1 to 3.11.0 (#12310) 2022-03-17 15:17:29 +08:00
cloud Lazy instantiation for segmentKillers, segmentMovers, and segmentArchivers (#12207) 2022-02-08 13:02:06 -08:00
codestyle Replace use of PowerMock with Mockito (#12282) 2022-02-27 22:47:09 -08:00
core Fix GCS based ingestion if bucket name contains underscores (#12445) 2022-04-21 09:22:35 +05:30
dev Add git hooks that can run multiple scripts (#12300) 2022-03-09 07:16:47 +09:00
distribution Fix the other 2 python scripts that generates license. (#12340) 2022-04-08 16:43:17 +05:30
docs Document expression post-aggregators (#11896) 2022-04-19 10:36:19 +08:00
examples Fix zulu8 set-up Dockerfile for hadoop and hadoop3 in hadoop ingestion tutorial (#12248) 2022-04-11 20:28:09 +05:30
extendedset bump version to 0.23.0-SNAPSHOT (#11670) 2021-09-08 15:56:04 -07:00
extensions-contrib Add support for authorizing query context params (#12396) 2022-04-21 14:21:16 +05:30
extensions-core Add support for authorizing query context params (#12396) 2022-04-21 14:21:16 +05:30
helm/druid update Druid Chart README doc and removes unnecessary lock file (#11945) 2021-11-22 21:34:26 +08:00
hll bump version to 0.23.0-SNAPSHOT (#11670) 2021-09-08 15:56:04 -07:00
hooks Git hooks should fail on errors; pass args to git hooks (#12322) 2022-03-10 09:07:50 +09:00
indexing-hadoop Store null columns in the segments (#12279) 2022-03-23 16:54:04 -07:00
indexing-service Make tombstones ingestible by having them return an empty result set. (#12392) 2022-04-15 09:08:06 -07:00
integration-tests Add support for authorizing query context params (#12396) 2022-04-21 14:21:16 +05:30
licenses Blueprint 4 (#12391) 2022-04-04 10:34:22 -07:00
processing Add support for authorizing query context params (#12396) 2022-04-21 14:21:16 +05:30
publications De-incubation cleanup in code, docs, packaging (#9108) 2020-01-03 12:33:19 -05:00
server Add support for authorizing query context params (#12396) 2022-04-21 14:21:16 +05:30
services update airline dependency to 2.x (#12270) 2022-02-27 15:19:28 -08:00
sql Add support for authorizing query context params (#12396) 2022-04-21 14:21:16 +05:30
web-console good stuff (#12435) 2022-04-14 00:23:06 -07:00
website Bump minimist from 1.2.5 to 1.2.6 in /website (#12400) 2022-04-07 03:08:39 -07:00
.asf.yaml Add .asf.yaml. (#9083) 2019-12-20 16:45:38 -08:00
.backportrc.json Add 0.18.0 to .backportrc.json to facilitate backport. (#9661) 2020-04-11 13:49:04 -07:00
.codecov.yml Use Codecov (#8388) 2019-08-28 08:49:30 -07:00
.dockerignore Add docker container for druid (#6896) 2019-02-08 12:12:28 +00:00
.gitignore Refactor ResponseContext (#11828) 2021-12-06 17:03:12 -08:00
.lgtm.yml Suppress LGTM warnings about stack trace exposure (#9631) 2020-04-09 17:31:03 -07:00
.travis.yml upgrade surefire 3.0.0-M6 (#12395) 2022-04-04 23:56:15 -07:00
CONTRIBUTING.md Fix numbered list formatting in markdown. (#9664) 2020-04-21 20:18:12 -07:00
LABELS Add plain text README.txt, use relative link from README.md to build.md (#7611) 2019-05-09 21:29:26 -07:00
LICENSE support Aliyun OSS service as deep storage (#9898) 2020-07-01 22:20:53 -07:00
NOTICE license.yaml fixes for code introduced related to AWS RDS token based password provider in PR #9518 (#10885) 2021-03-10 12:59:25 -08:00
README.md Add JDK 11 (#12333) 2022-03-16 15:03:04 -07:00
README.template De-incubation cleanup in code, docs, packaging (#9108) 2020-01-03 12:33:19 -05:00
check_test_suite.py suppress false positive cve (#11699) 2021-09-13 20:45:38 -07:00
check_test_suite_test.py suppress false positive cve (#11699) 2021-09-13 20:45:38 -07:00
licenses.yaml issue-12426 upgrade k8s client due to cve (#12427) 2022-04-21 10:11:55 +08:00
owasp-dependency-check-suppressions.xml Suppress CVE-2021-43138 (#12437) 2022-04-18 20:00:06 -07:00
pom.xml update httpclient due to cve (#12422) 2022-04-21 10:12:19 +08:00
upload.sh Adding licenses and enable apache-rat-plugin. (#6215) 2018-09-18 08:39:26 -07:00

README.md

Slack Build Status Language grade: Java Coverage Status Docker Helm


Website | Documentation | Developer Mailing List | User Mailing List | Slack | Twitter | Download


Apache Druid

Druid is a high performance real-time analytics database. Druid's main value add is to reduce time to insight and action.

Druid is designed for workflows where fast queries and ingest really matter. Druid excels at powering UIs, running operational (ad-hoc) queries, or handling high concurrency. Consider Druid as an open source alternative to data warehouses for a variety of use cases. The design documentation explains the key concepts.

Getting started

You can get started with Druid with our local or Docker quickstart.

Druid provides a rich set of APIs (via HTTP and JDBC) for loading, managing, and querying your data. You can also interact with Druid via the built-in console (shown below).

Load data

data loader Kafka

Load streaming and batch data using a point-and-click wizard to guide you through ingestion setup. Monitor one off tasks and ingestion supervisors.

Manage the cluster

management

Manage your cluster with ease. Get a view of your datasources, segments, ingestion tasks, and services from one convenient location. All powered by SQL systems tables, allowing you to see the underlying query for each view.

Issue queries

query view combo

Use the built-in query workbench to prototype DruidSQL and native queries or connect one of the many tools that help you make the most out of Druid.

Documentation

You can find the documentation for the latest Druid release on the project website.

If you would like to contribute documentation, please do so under /docs in this repository and submit a pull request.

Community

Community support is available on the druid-user mailing list, which is hosted at Google Groups.

Development discussions occur on dev@druid.apache.org, which you can subscribe to by emailing dev-subscribe@druid.apache.org.

Chat with Druid committers and users in real-time on the Apache Druid Slack channel. Please use this invitation link to join and invite others.

Building from source

Please note that JDK 8 or JDK 11 is required to build Druid.

For instructions on building Druid from source, see docs/development/build.md

Contributing

Please follow the community guidelines for contributing.

For instructions on setting up IntelliJ dev/intellij-setup.md

License

Apache License, Version 2.0