Skip to content

Commit

Permalink
Merge pull request #5 from egnyte/release/1.0.6
Browse files Browse the repository at this point in the history
changes for 1.0.6
  • Loading branch information
kcieslak-eg authored Nov 29, 2023
2 parents 166f7b5 + 05599d9 commit 2f13902
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 82 deletions.
2 changes: 1 addition & 1 deletion TA-egnyte-connect/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": {
"group": null,
"name": "TA-egnyte-connect",
"version": "1.0.5"
"version": "1.0.6"
},
"author": [
{
Expand Down
103 changes: 52 additions & 51 deletions TA-egnyte-connect/bin/ta_egnyte_connect/aob_py3/httplib2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"Alex Yu",
]
__license__ = "MIT"
__version__ = "0.19.1"
__version__ = "0.20.4"

import base64
import calendar
Expand Down Expand Up @@ -78,7 +78,7 @@ def has_timeout(timeout):
debuglevel = 0

# A request will be tried 'RETRIES' times if it fails at the socket/connection level.
RETRIES = 2
RETRIES = 1


# Open Items:
Expand Down Expand Up @@ -151,15 +151,18 @@ def _build_ssl_context(
# source: https://docs.python.org/3/library/ssl.html#ssl.SSLContext.maximum_version
if maximum_version is not None:
if hasattr(context, "maximum_version"):
context.maximum_version = getattr(ssl.TLSVersion, maximum_version)
if isinstance(maximum_version, str):
maximum_version = getattr(ssl.TLSVersion, maximum_version)
context.maximum_version = maximum_version
else:
raise RuntimeError("setting tls_maximum_version requires Python 3.7 and OpenSSL 1.1 or newer")
if minimum_version is not None:
if hasattr(context, "minimum_version"):
context.minimum_version = getattr(ssl.TLSVersion, minimum_version)
if isinstance(minimum_version, str):
minimum_version = getattr(ssl.TLSVersion, minimum_version)
context.minimum_version = minimum_version
else:
raise RuntimeError("setting tls_minimum_version requires Python 3.7 and OpenSSL 1.1 or newer")

# check_hostname requires python 3.4+
# we will perform the equivalent in HTTPSConnectionWithTimeout.connect() by calling ssl.match_hostname
# if check_hostname is not supported.
Expand All @@ -180,6 +183,20 @@ def _get_end2end_headers(response):
return [header for header in list(response.keys()) if header not in hopbyhop]


def _errno_from_exception(e):
# socket.error and common wrap in .args
if len(e.args) > 0:
return e.args[0].errno if isinstance(e.args[0], socket.error) else e.errno

# pysocks.ProxyError wraps in .socket_err
# https://github.com/httplib2/httplib2/pull/202
if hasattr(e, "socket_err"):
e_int = e.socket_err
return e_int.args[0].errno if isinstance(e_int.args[0], socket.error) else e_int.errno

return None


URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?")


Expand Down Expand Up @@ -223,7 +240,7 @@ def safename(filename):
filename = filename.decode("utf-8")
else:
filename_bytes = filename.encode("utf-8")
filemd5 = _md5(filename_bytes).hexdigest()
filesha1 = _sha(filename_bytes).hexdigest()
filename = re_url_scheme.sub("", filename)
filename = re_unsafe.sub("", filename)

Expand All @@ -234,7 +251,7 @@ def safename(filename):
# Thus max safe filename x = 93 chars. Let it be 90 to make a round sum:
filename = filename[:90]

return ",".join((filename, filemd5))
return ",".join((filename, filesha1))


NORMALIZE_SPACE = re.compile(r"(?:\r\n)?[ \t]+")
Expand Down Expand Up @@ -834,10 +851,10 @@ def __init__(
proxy_headers: Additional or modified headers for the proxy connect
request.
"""
if isinstance(proxy_user, bytes):
proxy_user = proxy_user.decode()
if isinstance(proxy_pass, bytes):
proxy_pass = proxy_pass.decode()
if isinstance(proxy_user, str):
proxy_user = proxy_user.encode()
if isinstance(proxy_pass, str):
proxy_pass = proxy_pass.encode()
(
self.proxy_type,
self.proxy_host,
Expand Down Expand Up @@ -913,34 +930,14 @@ def proxy_info_from_url(url, method="http", noproxy=None):
"""Construct a ProxyInfo from a URL (such as http_proxy env var)
"""
url = urllib.parse.urlparse(url)
username = None
password = None
port = None
if "@" in url[1]:
ident, host_port = url[1].split("@", 1)
if ":" in ident:
username, password = ident.split(":", 1)
else:
password = ident
else:
host_port = url[1]
if ":" in host_port:
host, port = host_port.split(":", 1)
else:
host = host_port

if port:
port = int(port)
else:
port = dict(https=443, http=80)[method]

proxy_type = 3 # socks.PROXY_TYPE_HTTP
pi = ProxyInfo(
proxy_type=proxy_type,
proxy_host=host,
proxy_port=port,
proxy_user=username or None,
proxy_pass=password or None,
proxy_host=url.hostname,
proxy_port=url.port or dict(https=443, http=80)[method],
proxy_user=url.username or None,
proxy_pass=url.password or None,
proxy_headers=None,
)

Expand Down Expand Up @@ -1068,6 +1065,7 @@ def __init__(
tls_maximum_version=None,
tls_minimum_version=None,
key_password=None,
context=None
):

self.disable_ssl_certificate_validation = disable_ssl_certificate_validation
Expand All @@ -1077,15 +1075,16 @@ def __init__(
if proxy_info and not isinstance(proxy_info, ProxyInfo):
self.proxy_info = proxy_info("https")

context = _build_ssl_context(
self.disable_ssl_certificate_validation,
self.ca_certs,
cert_file,
key_file,
maximum_version=tls_maximum_version,
minimum_version=tls_minimum_version,
key_password=key_password,
)
if context is None:
context = _build_ssl_context(
self.disable_ssl_certificate_validation,
self.ca_certs,
cert_file,
key_file,
maximum_version=tls_maximum_version,
minimum_version=tls_minimum_version,
key_password=key_password,
)
super(HTTPSConnectionWithTimeout, self).__init__(
host, port=port, timeout=timeout, context=context,
)
Expand Down Expand Up @@ -1212,6 +1211,7 @@ def __init__(
disable_ssl_certificate_validation=False,
tls_maximum_version=None,
tls_minimum_version=None,
context=None,
):
"""If 'cache' is a string then it is used as a directory name for
a disk cache. Otherwise it must be an object that supports the
Expand All @@ -1238,12 +1238,13 @@ def __init__(
tls_maximum_version / tls_minimum_version require Python 3.7+ /
OpenSSL 1.1.0g+. A value of "TLSv1_3" requires OpenSSL 1.1.1+.
"""
"""
self.proxy_info = proxy_info
self.ca_certs = ca_certs
self.disable_ssl_certificate_validation = disable_ssl_certificate_validation
self.tls_maximum_version = tls_maximum_version
self.tls_minimum_version = tls_minimum_version
self.context = context
# Map domain name to an httplib connection
self.connections = {}
# The location of the cache, for now a directory
Expand Down Expand Up @@ -1352,7 +1353,7 @@ def _conn_request(self, conn, request_uri, method, body, headers):
conn.close()
raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
except socket.error as e:
errno_ = e.args[0].errno if isinstance(e.args[0], socket.error) else e.errno
errno_ = _errno_from_exception(e)
if errno_ in (errno.ENETUNREACH, errno.EADDRNOTAVAIL) and i < RETRIES:
continue # retry on potentially transient errors
raise
Expand Down Expand Up @@ -1471,6 +1472,8 @@ def _request(
old_response["content-location"] = absolute_uri
redirect_method = method
if response.status in [302, 303]:
if 'content-length' in headers:
del headers['content-length']
redirect_method = "GET"
body = None
(response, content) = self.request(
Expand Down Expand Up @@ -1556,6 +1559,7 @@ def request(
tls_maximum_version=self.tls_maximum_version,
tls_minimum_version=self.tls_minimum_version,
key_password=certs[0][2],
context=self.context,
)
else:
conn = self.connections[conn_key] = connection_type(
Expand All @@ -1566,6 +1570,7 @@ def request(
disable_ssl_certificate_validation=self.disable_ssl_certificate_validation,
tls_maximum_version=self.tls_maximum_version,
tls_minimum_version=self.tls_minimum_version,
context=self.context,
)
else:
conn = self.connections[conn_key] = connection_type(
Expand Down Expand Up @@ -1657,12 +1662,8 @@ def request(
entry_disposition = _entry_disposition(info, headers)

if entry_disposition == "FRESH":
if not cached_value:
info["status"] = "504"
content = b""
response = Response(info)
if cached_value:
response.fromcache = True
response.fromcache = True
return (response, content)

if entry_disposition == "STALE":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

from .error import *


try: # pyparsing>=3.0.0
downcaseTokens = pp.common.downcaseTokens
except AttributeError:
downcaseTokens = pp.downcaseTokens

UNQUOTE_PAIRS = re.compile(r"\\(.)")
unquote = lambda s, l, t: UNQUOTE_PAIRS.sub(r"\1", t[0][1:-1])

Expand All @@ -17,7 +23,7 @@
)

quoted_string = pp.dblQuotedString.copy().setName("quoted-string").setParseAction(unquote)
auth_param_name = token.copy().setName("auth-param-name").addParseAction(pp.downcaseTokens)
auth_param_name = token.copy().setName("auth-param-name").addParseAction(downcaseTokens)
auth_param = auth_param_name + pp.Suppress("=") + (quoted_string | token)
params = pp.Dict(pp.delimitedList(pp.Group(auth_param)))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2138,34 +2138,6 @@ hdVddLHRDiBYmxOlsGOm7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulr
so8uBtjRkcfGEvRM/TAXw8HaOFvjqermobp573PYtlNXLfbQ4ddI
-----END CERTIFICATE-----

# Issuer: O=Digital Signature Trust Co., CN=DST Root CA X3
# Subject: O=Digital Signature Trust Co., CN=DST Root CA X3
# Label: "IdenTrust DST Root CA X3"
# Serial: 44AFB080D6A327BA893039862EF8406B
# MD5 Fingerprint: 41:03:52:DC:0F:F7:50:1B:16:F0:02:8E:BA:6F:45:C5
# SHA1 Fingerprint: DA:C9:02:4F:54:D8:F6:DF:94:93:5F:B1:73:26:38:CA:6A:D7:7C:13
# SHA256 Fingerprint: 06:87:26:03:31:A7:24:03:D9:09:F1:05:E6:9B:CF:0D:32:E1:BD:24:93:FF:C6:D9:20:6D:11:BC:D6:77:07:39
-----BEGIN CERTIFICATE-----
MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/
MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT
DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow
PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD
Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O
rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq
OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b
xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw
7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD
aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG
SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69
ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr
AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz
R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5
JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo
Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
-----END CERTIFICATE-----

# Issuer: CN=DigiCert Global Root G2, OU=www.digicert.com, O=DigiCert Inc, C=US
# Subject: CN=DigiCert Global Root G2, OU=www.digicert.com, O=DigiCert Inc, C=US
# Serial: 33af1e6a711a9a0bb2864b11d09fae5
Expand Down Expand Up @@ -2195,3 +2167,59 @@ pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
MrY=
-----END CERTIFICATE-----

# Issuer: /C=US/O=Internet Security Research Group/CN=ISRG Root X1
# Subject: /C=US/O=Internet Security Research Group/CN=ISRG Root X1
# Serial: 8210CFB0D240E3594463E0BB63828B00
# SHA1 Fingerprint: CA:BD:2A:79:A1:07:6A:31:F2:1D:25:36:35:CB:03:9D:43:29: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7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
-----END CERTIFICATE-----

# Issuer: /C=US/O=Internet Security Research Group/CN=ISRG Root X2
# Subject: /C=US/O=Internet Security Research Group/CN=ISRG Root X2
# Serial: 41D29DD172EAEEA780C12C6CE92F8752
# SHA1 Fingerprint: BD:B1:B9:3C:D5:97:8D:45:C6:26:14:55:F8:DB:95:C7:5A:D1:53:AF
# SHA256 Fingerprint: 69:72:9B:8E:15:A8:6E:FC:17:7A:57:AF:B7:17:1D:FC:64:AD:D2:8C:2F:CA:8C:F1:50:7E:34:45:3C:CB:14:70
-----BEGIN CERTIFICATE-----
MIICGzCCAaGgAwIBAgIQQdKd0XLq7qeAwSxs6S+HUjAKBggqhkjOPQQDAzBPMQsw
CQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2gg
R3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBYMjAeFw0yMDA5MDQwMDAwMDBaFw00
MDA5MTcxNjAwMDBaME8xCzAJBgNVBAYTAlVTMSkwJwYDVQQKEyBJbnRlcm5ldCBT
ZWN1cml0eSBSZXNlYXJjaCBHcm91cDEVMBMGA1UEAxMMSVNSRyBSb290IFgyMHYw
EAYHKoZIzj0CAQYFK4EEACIDYgAEzZvVn4CDCuwJSvMWSj5cz3es3mcFDR0HttwW
+1qLFNvicWDEukWVEYmO6gbf9yoWHKS5xcUy4APgHoIYOIvXRdgKam7mAHf7AlF9
ItgKbppbd9/w+kHsOdx1ymgHDB/qo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0T
AQH/BAUwAwEB/zAdBgNVHQ4EFgQUfEKWrt5LSDv6kviejM9ti6lyN5UwCgYIKoZI
zj0EAwMDaAAwZQIwe3lORlCEwkSHRhtFcP9Ymd70/aTSVaYgLXTWNLxBo1BfASdW
tL4ndQavEi51mI38AjEAi/V3bNTIZargCyzuFJ0nN6T5U6VR5CmD1/iQMVtCnwr1
/q4AaOeMSQ+2b1tbFfLn
-----END CERTIFICATE-----
2 changes: 1 addition & 1 deletion TA-egnyte-connect/default/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ state = enabled
build = 1

[launcher]
version = 1.0.5
version = 1.0.6
author = Egnyte Inc
description = This TA provides interface to ingest events from Egnyte Collaborate into Splunk.

Expand Down

0 comments on commit 2f13902

Please sign in to comment.