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

[Notifications] Check if secret key is internal before deleting it #5886

Merged
merged 3 commits into from
Jul 9, 2024

Conversation

Yacouby
Copy link
Member

@Yacouby Yacouby commented Jul 2, 2024

resolves:
https://iguazio.atlassian.net/browse/ML-6936

when deleting notifications, only internal project secrets should be deleted.

also, this PR introduces a change to skip the validation of notification parameters when the "secret" key is present in the secret parameters.

@Yacouby Yacouby force-pushed the ML-6936 branch 3 times, most recently from 4cf7f99 to 5c40c5c Compare July 3, 2024 16:12
@Yacouby Yacouby marked this pull request as ready for review July 4, 2024 08:58
@@ -429,7 +430,11 @@ def validate_and_mask_notification_list(
# validate notification schema
mlrun.common.schemas.Notification(**notification_object.to_dict())

notification_object.validate_notification_params()
# skip the params validation if the key is "secret"
Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand why. Also why not check this in the validation function?

Copy link
Member Author

Choose a reason for hiding this comment

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

after a conversation with @quaark we decided that we should skip the validation when "secret" is present because it implies that the parameters are securely handled and should not be validated.

mlrun/model.py Outdated
Comment on lines 743 to 744
# skip the secret_params validation if it contains the key "secret" since the parameters are securely handled
# and should not be validated in this case
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# skip the secret_params validation if it contains the key "secret" since the parameters are securely handled
# and should not be validated in this case
# if the secret_params are already masked - no need to validate

mlrun/model.py Outdated
Comment on lines 745 to 750
params_secret = secret_params.get("secret", "")
if params_secret:
return
Copy link
Member

Choose a reason for hiding this comment

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

I think the heuristic can be improved. We should also verify that this is the only param in the dict because if there are others than they will be ignored. I think we should be explicit about it. (That is IIUC the behavior @quaark )

Copy link
Member

Choose a reason for hiding this comment

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

Yes I agree that's a good idea.
The error message should also be indicative and explain this mutual exclusion

@alonmr alonmr merged commit 29c8561 into mlrun:development Jul 9, 2024
11 checks passed
@Yacouby Yacouby deleted the ML-6936 branch July 9, 2024 10:03
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