Code Monkey home page Code Monkey logo

crunchy_check_access's Introduction

crunchy_check_access

Functions and views to facilitate PostgreSQL object access inspection

Overview

Typically install this script as the database superuser.

Once installed, to find all user privileges in the database while ignoring the system catalog and information schema, do:

SELECT * FROM all_access() WHERE base_role != CURRENT_USER;

To find all user privileges in the database including the system catalog and information schema, do:

SELECT * FROM all_access(true) WHERE base_role != CURRENT_USER;

By default, execute has been revoked from PUBLIC on the installed functions except my_privs() and my_privs_sys() and their corresponding convenience views my_privs and my_privs_sys. These functions/views allow users to discover their own privileges.

Note that the privileges are discovered by recursing through all roles accessable via a GRANT, including non-inherited ones (need to specifically use SET ROLE to escalate and gain said privilege). The source path to a given privilege shown in the output is available in the role_path column. Each ancestor in the role_path is tagged with either (true) or (false) to indicate if privileges are inherited by that role.

base_role was the entry point (initially logged in user), while as_role shows the role with the actual privilege.

The all_access and check_access report grants that actually authorize actions against the referenced object. For example, a role may be granted SELECT privileges but will not be reported by the access functions unless it also has usage privilege on the schema. To allow for reporting of all grants the all_grants and check_grants function was added. These functions will report all grants and are useful for entitlement and audit reporting.

crunchy_check_access's People

Contributors

jconway avatar keithf4 avatar cbrianpace avatar davidfetter avatar roberto-mello avatar thomaspoty avatar

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.