Skip to main content

A DSL for generating rules.json files for Trino

Project description

osc-trino-acl-dsl

A declarative format for configuring Trino access control

To operationalize this code you need Trino adminstrator privileges

examples:

Converting Trino ACL DSL to a rules.json

# install package using pipenv, pip or similar tools
$ pipenv install osc-trino-acl-dsl

# the package command `trino-dsl-to-rules` will load the given yaml or json file
# and write the resulting 'rules.json' file to standard output
# dsl-example-1.yaml is in the 'examples' directory of this repository
$ pipenv run trino-dsl-to-rules dsl-example-1.yaml > rules.json

# rules.json is trino file-based access control rules file
$ head rules.json
{
    "catalogs": [
        {
            "group": "admins",
            "allow": "all"
        },
        {
            "group": ".*",
            "catalog": "dev",
            "allow": "all"

Using pre-commit checks

For more information on pre-commit checks, see here

Here is an example entry for .pre-commit-config.yaml For more info see here

repos:
  - repo: https://github.com/os-climate/osc-trino-acl-dsl
    rev: v0.2.5
    hooks:
      # a pre-commit check to verify that an ACL DSL yaml file is in sync with rules.json file
      - id: trino-acl-dsl-check

building and testing

iterative dev/test for pre-commit checks

  1. check out this repository
  2. make some change to precommit checks you want to test
  3. in a test repository, make an edit you expect your precommit check to operate on, then git add this edit (i.e. stage it for commit) but do NOT commit it, so the precommit check sees it and properly provides staged files to the argument list.
  4. run pre-commit try-repo /path/to/osc-trino-acl-dsl --verbose (see here)
  5. examine the output of your precommit check to see if it did what you want

publish new version to pypi

  • update all occurrences of __version__ (try git grep version)
  • python3 setup.py clean or git clean -fdx
  • python3 setup.py sdist
  • twine check dist/*
  • twine upload dist/*
  • push latest to repo
  • create new release tag on github

upload test or release candidate:

python packaging resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osc-trino-acl-dsl-0.2.5.tar.gz (12.6 kB view details)

Uploaded Source

File details

Details for the file osc-trino-acl-dsl-0.2.5.tar.gz.

File metadata

  • Download URL: osc-trino-acl-dsl-0.2.5.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for osc-trino-acl-dsl-0.2.5.tar.gz
Algorithm Hash digest
SHA256 aae9cfb5dc0fe60017f32f8570518153510c1fd71414ccc2ca0b75c8975bb967
MD5 67a4a2cfc381145ceaba5fee45b184af
BLAKE2b-256 53066b4ab8102ddf3cf87d714e2739589fae59fde3a53a797e47420390690246

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page