-
Notifications
You must be signed in to change notification settings - Fork 54
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
Exporter APS Authentication #1001
Conversation
Chorus detected one or more security issues with this pull request. See the Checks tab for more details. As a reminder, please follow the secure code review process as part of the Secure Coding Non-Negotiable requirement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the following error upon attempt to open the APS panel.

Here is the log file:
2024-06-28 10:03:56,954 - synthesis.Toolbar.getNewPanel - DEBUG - Created Panel Synthesis_synthesis_tooltab in Toolbar ToolsTab
2024-06-28 10:03:56,972 - synthesis.HUI.HButton - INFO - Created Button SynthesisExporter_synthesis in Panel Synthesis_synthesis_tooltab
2024-06-28 10:03:56,989 - synthesis.HUI.HButton - INFO - Created Button APS_synthesis in Panel Synthesis_synthesis_tooltab
2024-06-28 10:04:19,260 - synthesis - ERROR - Command executed failed: Traceback (most recent call last):
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1037, in _send_output
self.send(msg)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 975, in send
self.connect()
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 941, in connect
self.sock = self._create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/brandon/Documents/Repos/synthesis/exporter/SynthesisFusionAddin/src/UI/ShowAPSAuthCommand.py", line 32, in notify
challenge = getCodeChallenge()
^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Documents/Repos/synthesis/exporter/SynthesisFusionAddin/src/APS/APS.py", line 64, in getCodeChallenge
res = urllib.request.urlopen(endpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 519, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 1377, in http_open
return self.do_open(http.client.HTTPConnection, req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 61] Connection refused>
2024-06-28 10:07:02,016 - synthesis - ERROR - Command executed failed: Traceback (most recent call last):
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 1037, in _send_output
self.send(msg)
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 975, in send
self.connect()
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/http/client.py", line 941, in connect
self.sock = self._create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/socket.py", line 851, in create_connection
raise exceptions[0]
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/socket.py", line 836, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/brandon/Documents/Repos/synthesis/exporter/SynthesisFusionAddin/src/UI/ShowAPSAuthCommand.py", line 32, in notify
challenge = getCodeChallenge()
^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Documents/Repos/synthesis/exporter/SynthesisFusionAddin/src/APS/APS.py", line 64, in getCodeChallenge
res = urllib.request.urlopen(endpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 519, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 1377, in http_open
return self.do_open(http.client.HTTPConnection, req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/brandon/Library/Application Support/Autodesk/webdeploy/production/6997599ab67b7e881f25c2311930a09bc5ac662f/Autodesk Fusion 360.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 61] Connection refused>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work...
The security workflow is getting real mad at us with this one, not sure if there is anything we can do to fix that though.
@PepperLola Something to note: I forgot to switch the server branch over so I ran into an issue. That being said, after getting the issue, there isn't any way for me to reset the aps login process without restarting the addin. Could we have to detect an error and then automatically reset? |
@PepperLola I get this page in the palette, and then nothing further: ![]() |
delete unnecessary logs with sensitive data only handle errors in the palette so it can delete/reset itself on error
…k/synthesis into jwrigh/1671/exporter-integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I'm super late to the party, but everything worked for me.
|
||
def convertAuthToken(code: str): | ||
global APS_AUTH | ||
authUrl = f'http://localhost:3003/api/aps/code/?code={code}&redirect_uri={urllib.parse.quote_plus("http://localhost:3003/api/aps/exporter/")}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will have to be changed to the actually URL eventually, right? A constant might be helpful for this.
Changes:
Testing:
Warning
I haven't yet tested refreshing the token once it's expired. The web request works though and gets a different access token than before.
Important
This branch must be tested while running the server through the Docker container, because some authorization logic happens on the server side.