flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm <...@git.apache.org>
Subject [GitHub] flink pull request #2425: FLINK-3930 Added shared secret based authorization...
Date Wed, 19 Oct 2016 10:58:03 GMT
Github user mxm commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2425#discussion_r84028705
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobServerConnection.java
---
    @@ -463,6 +482,39 @@ private static String readKey(byte[] buf, InputStream inputStream)
throws IOExce
     		return new String(buf, 0, keyLength, BlobUtils.DEFAULT_CHARSET);
     	}
     
    +
    +	/**
    +	 * Reads secure cookie from the given input stream.
    +	 *
    +	 * @param inputStream
    +	 *        the input stream to read the secure cookie from
    +	 * @param keyLength
    +	 *        buffer length to read
    +	 * @return
    +	 * @throws IOException
    +	 *         thrown if an I/O error occurs while reading the secure cookie data from the
input stream
    +	 */
    +
    +	private void validateSecureCookie(InputStream inputStream, int keyLength) throws IOException
{
    +
    +		if (keyLength > MAX_LENGTH_SECURE_COOKIE) {
    +			throw new IOException("Unexpected secure cookie length " + keyLength);
    +		}
    +
    +		final byte[] buffer = new byte[BUFFER_SIZE];
    +
    +		readFully(inputStream, buffer, 0, keyLength, "SecureCookie");
    +
    +		final String cookie = new String(buffer, 0, keyLength, BlobUtils.DEFAULT_CHARSET);
    +
    +		if(blobServer.isSecurityEnabled()) {
    +			if(StringUtils.isBlank(cookie) || !cookie.equals(blobServer.getSecureCookie())) {
    +				LOG.error("Missing valid secure cookie");
    +				throw new IOException("Missing valid secure cookie");
    --- End diff --
    
    Exceptions will be logged anyways, you can remove the logging.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message