Skip to content

Access Control Options 🔒 #29

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

Merged
merged 4 commits into from
Oct 19, 2024
Merged

Access Control Options 🔒 #29

merged 4 commits into from
Oct 19, 2024

Conversation

koenbollen
Copy link
Collaborator

Adding access control options, making the converter error if a disallowed column/field is queried.

Previously this library has been insecure by default, users could easily make the mistake of opening up their entire database. This change makes it required to supply at least one access control option.

New options:

  • filter.WithAllowAllColumns()
    Allow filtering of all columns, same as the previous behaviour
  • filter.WithAllowColumns(...)
    Allow only selected columns
  • filter.WithDisallowColumns(...)
    Disallow certain columns, used in combination with WithAllowAllColumns() and WithNestedJSONB().

Note: This change is not backwards compatible! ⚠️

Previously this library has been insecure by default, this change will make one of the new access control options required.
Copy link
Member

@erikdubbelboer erikdubbelboer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot this one causing the integration test to panic (because the converter is nil):

c, _ := filter.NewConverter()

erikdubbelboer
erikdubbelboer previously approved these changes Oct 18, 2024
@koenbollen koenbollen merged commit f92516c into main Oct 19, 2024
7 checks passed
@koenbollen koenbollen deleted the access-control-options branch October 19, 2024 09:08
@koenbollen koenbollen mentioned this pull request Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants