[ 
https://issues.apache.org/jira/browse/HADOOP-18972?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Charles Connell updated HADOOP-18972:
-------------------------------------
    Description: 
{color:#1d1c1d}When {{SaslDataTransferServer}} or {{SaslDataTranferClient}} 
want to get a SASL properties map to do a handshake, they call 
{{SaslPropertiesResolver#getServerProperties()}} or 
{{SaslPropertiesResolver}}{color}{{{}#getClientProperties(){}}}, and they get 
back a {{{}Map<String, String>{}}}. Every call gets the same {{Map}} object 
back, and then the callers sometimes [call {{put()}}|#L385] on it. This means 
that future users of {color:#1d1c1d}{{SaslPropertiesResolver}}{color} get back 
the wrong information.

I propose that {color:#1d1c1d}{{SaslPropertiesResolver}}{color} should pass a 
copy of its internal map, so that users can safety modify them{{{}.{}}}

PR incoming.

  was:
{color:#1d1c1d}When {{SaslDataTransferServer}} or {{SaslDataTranferClient}} 
want to get a SASL properties map to do a handshake, they call 
{{SaslPropertiesResolver#getServerProperties()}} or 
{{SaslPropertiesResolver}}{color}{{{}#getClientProperties(){}}}, and they get 
back a {{{}Map<String, String>{}}}. Every call gets the same {{Map}} object 
back, and then the callers sometimes [call 
{{{}put(){}}}https://github.com/apache/hadoop/blob/rel/release-3.3.6/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferServer.java#L385|#L385]
 on it. This means that future users of 
{color:#1d1c1d}{{SaslPropertiesResolver}}{color} get back the wrong information.

I propose that {color:#1d1c1d}{{SaslPropertiesResolver}}{color} should pass a 
copy of its internal map, so that users can safety modify them{{{}.{}}}

PR incoming.


> Bug in SaslPropertiesResolver allows mutation of internal state
> ---------------------------------------------------------------
>
>                 Key: HADOOP-18972
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18972
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Charles Connell
>            Priority: Minor
>
> {color:#1d1c1d}When {{SaslDataTransferServer}} or {{SaslDataTranferClient}} 
> want to get a SASL properties map to do a handshake, they call 
> {{SaslPropertiesResolver#getServerProperties()}} or 
> {{SaslPropertiesResolver}}{color}{{{}#getClientProperties(){}}}, and they get 
> back a {{{}Map<String, String>{}}}. Every call gets the same {{Map}} object 
> back, and then the callers sometimes [call {{put()}}|#L385] on it. This means 
> that future users of {color:#1d1c1d}{{SaslPropertiesResolver}}{color} get 
> back the wrong information.
> I propose that {color:#1d1c1d}{{SaslPropertiesResolver}}{color} should pass a 
> copy of its internal map, so that users can safety modify them{{{}.{}}}
> PR incoming.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to