File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -200,12 +200,13 @@ def _on_config_changed(self, _: HookEvent) -> None:
200
200
201
201
def _on_saml_data_available (self , event : SamlDataAvailableEvent ) -> None :
202
202
"""Handle SAML data available."""
203
- fingerprint = hashlib .sha1 (base64 .b64decode (event .certificates [0 ])).hexdigest () # nosec
204
- relation = self .model .get_relation ("saml" )
205
- # Will ignore union-attr since asserting the relation type will make bandit complain.
206
- relation .data [self .app ].update ({"fingerprint" : fingerprint }) # type: ignore[union-attr]
207
- relation .data [self .app ].update ({"entity_id" : event .entity_id }) # type: ignore[union-attr]
208
- self ._on_config_changed (event )
203
+ if self .unit .is_leader ():
204
+ # Utilizing the SHA1 hash is safe in this case, so a nosec ignore will be put in place.
205
+ fingerprint = hashlib .sha1 (base64 .b64decode (event .certificates [0 ])).hexdigest () # nosec
206
+ relation = self .model .get_relation ("saml" )
207
+ # Will ignore union-attr since asserting the relation type will make bandit complain.
208
+ relation .data [self .app ].update ({"fingerprint" : fingerprint , }) # type: ignore[union-attr]
209
+ self ._on_config_changed (event )
209
210
210
211
def _on_rolling_restart (self , _ : ops .EventBase ) -> None :
211
212
"""Handle rolling restart event.
You can’t perform that action at this time.
0 commit comments