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

feat: add configuration option to enable REST API authorizations #474

Merged

Conversation

Masterchen09
Copy link
Contributor

To make it a bit more transparent - I was not aware of it - that there are parts of the REST API which are not secured by default (of course you have to be authenticated, but each authenticated user is authorized by default to use these endpoints), this PR adds a new configuration option similar to the view authorization which allows to enable REST API authorizations. Technically this is already possible today using extra environment variables - the intention here is only to make it more transparent.

As the REST API authorizations were not enabled by default in the past (and are not enabled by default in the metadata-service image), the configuration option is also not enabled by default - however this might be a point which could be discussed (i.e. security first -> why should be the REST API authorization not be enabled by default?).

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable)

@@ -311,6 +311,10 @@ spec:
secretKeyRef:
name: {{ .Values.global.datahub.metadata_service_authentication.systemClientSecret.secretRef }}
key: {{ .Values.global.datahub.metadata_service_authentication.systemClientSecret.secretKey }}
{{- if .Values.global.datahub.metadata_service_authentication.restApi.authorization.enabled }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest:

- name: REST_API_AUTHORIZATION_ENABLED
  value: {{  .Values.global.datahub.metadata_service_authentication.restApi.authorization.enabled | quote }}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we really want to set the value of the environment variable to the value of the config or do we just want to add the environment variable with the value true in case the config is true? I think it's more or less exactly the same logic here as for the global.datahub.metadata_service_authentication.view.authorization.enabled config?

{{- if .Values.global.datahub.metadata_service_authentication.view.authorization.enabled }}
- name: VIEW_AUTHORIZATION_ENABLED
value: "true"
{{- if .Values.global.datahub.metadata_service_authentication.view.authorization.recommendations.peerGroupEnabled }}
- name: VIEW_AUTHORIZATION_RECOMMENDATIONS_PEER_GROUP_ENABLED
value: "true"
{{- end }}
{{- end }}

Copy link
Contributor

Choose a reason for hiding this comment

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

@Masterchen09 - in this case, yes because we're going to change the application default here and mark it as a breaking change. When that change hits a release, will update the helm chart like this PR, however will follow @darnaut suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@david-leifker This explanation makes sense (at least now after changing the default value 😉) - I have adjusted the PR accordingly and also set the default value to true to match the new default value (or should we wait with changing the default value in the chart, to be able to merge this PR directly before a new release is available?).

I have also checked the other (boolean) environment variables in all subcharts...there are more locations where the default value could currently not be overwritten because of the same reason - I have also adjusted these locations...maaaybe all boolean environment variables independent from the default value should be set using the same pattern, to be independent from changing default values in the future?

As I have nearly touched all subcharts, I have also fixed some formatting "issues" (some whitespaces...nothing special), adjusted the appVersion of each subchart to match the image tags resp. the version in the parent chart (would be great if the appVersion would always be matching the version in the parent chart or remove the appVersion from the subcharts...?) and removed an unused env.JMXPORT config from the value.yaml of the datahub-frontend, datahub-mae-consumer and datahub-mce-consumer subcharts (not sure why it was there). I hope it is fine to have this as part of this PR...somehow I just started to cleanup and could not stop it...😁

Copy link
Contributor

@david-leifker david-leifker Sep 30, 2024

Choose a reason for hiding this comment

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

@Masterchen09 - these look like good changes. Thank you once again for your contributions!

Copy link

github-actions bot commented Jul 9, 2024

This PR is stale. We will close it in 30 days if there is no comment or activity. If you want feedback but not able to get it on github please head to #contribute channel in slack at https://slack.datahubproject.io.

@github-actions github-actions bot added the stale label Jul 9, 2024
@Masterchen09 Masterchen09 force-pushed the feat-rest-api-authorizations branch from 1b9d6d3 to aa0b94e Compare July 18, 2024 19:23
@github-actions github-actions bot removed the stale label Jul 19, 2024
Copy link

This PR is stale. We will close it in 30 days if there is no comment or activity. If you want feedback but not able to get it on github please head to #contribute channel in slack at https://slack.datahubproject.io.

@github-actions github-actions bot added the stale label Aug 18, 2024
@Masterchen09
Copy link
Contributor Author

To make sure that this PR is not automatically closed - here’s a comment.

@github-actions github-actions bot removed the stale label Aug 27, 2024
@Masterchen09 Masterchen09 force-pushed the feat-rest-api-authorizations branch from aa0b94e to c57bec4 Compare September 16, 2024 09:10
@Masterchen09 Masterchen09 force-pushed the feat-rest-api-authorizations branch from c57bec4 to 16cb183 Compare September 30, 2024 15:14
@david-leifker david-leifker merged commit 58648eb into acryldata:master Sep 30, 2024
1 check passed
@Masterchen09 Masterchen09 deleted the feat-rest-api-authorizations branch October 24, 2024 14:20
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.

3 participants