Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Metastore ACL support for wildcard prefix match #1423

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions querybook/server/lib/metastore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def _is_table_in_list(
for schema_table in self._tables_by_schema[schema]:
if schema_table == table or schema_table == "*":
return True
elif schema_table.endswith("*") and table.startswith(schema_table[:-1]):
return True
return False

def is_table_valid(
Expand Down
17 changes: 16 additions & 1 deletion querybook/webapp/components/AppAdmin/AdminMetastore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import history from 'lib/router-history';
import { generateFormattedDate } from 'lib/utils/datetime';
import { AdminMetastoreResource } from 'resource/admin/metastore';
import { TextButton } from 'ui/Button/Button';
import { InfoButton } from 'ui/Button/InfoButton';
import { Card } from 'ui/Card/Card';
import { SimpleField } from 'ui/FormikField/SimpleField';
import { GenericCRUD } from 'ui/GenericCRUD/GenericCRUD';
import { Icon } from 'ui/Icon/Icon';
import { Level } from 'ui/Level/Level';
import { Loading } from 'ui/Loading/Loading';
import { Markdown } from 'ui/Markdown/Markdown';
import {
getDefaultFormValue,
SmartForm,
Expand Down Expand Up @@ -302,10 +304,23 @@ export const AdminMetastore: React.FunctionComponent<IProps> = ({
</div>
)}
<div className="AdminForm-section">
<div className="AdminForm-section-top flex-row">
<div className="AdminForm-section-top flex-row horizontal-space-between">
<div className="AdminForm-section-title">
ACL Control
</div>
<InfoButton layout={['bottom', 'right']}>
<Markdown>{`Access Control Lists (ACL)
are used to limit access to tables in the metastore. If no ACL rules are specified,
all schemas/tables are allowed. Either an allowlist or a denylist can be configured.

Each value in the list should be in one of the following formats:

- \`schema.*\`: Allow or deny all tables in a schema
- \`schema.table*\`: Allow or deny all tables in a schema matching a prefix
- \`schema.table\`: Allow or deny a specific table

This feature affects both the metastore sync and the query engine.`}</Markdown>
</InfoButton>
</div>
<div className="AdminForm-section-content">
{getMetastoreACLControlDOM(
Expand Down
Loading