Giter Site home page Giter Site logo

Comments (3)

valyala avatar valyala commented on August 15, 2024

Currently chproxy doesn't parse the incoming query at all - it just proxies it as-is to clickhouse. The requested feature would require adding non-trivial query parser into chproxy. There is a hacky solution - just scan the first word of the query and determine whether it is allowed. It is already used when determining whether to cache the response - see canCacheQuery. Such hacky solution may fail when the query starts with unexpected syntax, for instance with a -- comment or WITH statement. So the solution may break at any time.

As you already mentioned, clickhouse already provides readonly mechanism for disabling non-readonly queries, thus lowering the importance of the feature.

@alivelimeli , could your provide use cases for this feature?

from chproxy.

alivelimeli avatar alivelimeli commented on August 15, 2024

Yes its possible to make a hacky solution like that. I've thought that maybe chproxy can be behaves like a WAF (Web Application Firewall) to limit some kind of queries. Thanks

from chproxy.

valyala avatar valyala commented on August 15, 2024

From security POV it would be better to implement only allowed_query_prefixes, because disallowed_query_prefixes can be easily misconfigured.

But even the simplest allowed_query_prefixes: SELECT gives false sense of security, since:

  • SELECT query may be specially crafted the way that exhausts all the available RAM or CPU resources;
  • SELECT syntax may be extended in the future in unsafe ways allowing writing output files on the server side, creating new tables or doing other nasty things;
  • ClickHouse may contain security bugs that may be easily triggered via specially crafted SELECT queries.

It is bad practice from security POV to allow untrusted direct SELECT access to any DBMS, not only ClickHouse. So even allowed_query_prefixes has little sense :(

from chproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.