Skip to content
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

[SENTINEL-INTEL] fix: add explicit error when authentication fails #3396

Conversation

flavienSindou
Copy link
Contributor

Proposed changes

  • explicitly handle error when Authentication fails and logs server response details

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

Notion investigation page https://www.notion.so/filigran/Sentinel-Intel-Connector-Not-Sending-Data-18b8fce17f2a80369730d92656219234

@flavienSindou flavienSindou linked an issue Feb 6, 2025 that may be closed by this pull request
@flavienSindou flavienSindou self-assigned this Feb 6, 2025
@flavienSindou flavienSindou added bug use for describing something not working as expected filigran team use to identify PR from the Filigran team labels Feb 6, 2025
@flavienSindou flavienSindou requested review from Megafredo, Powlinett and helene-nguyen and removed request for Megafredo February 6, 2025 11:43
@@ -38,6 +38,7 @@ def _get_authorization_header(self):
"""
Get an OAuth access token and set it as Authorization header in headers.
"""
response_json = {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Init to be able to try to get content for error log

@@ -48,16 +49,23 @@ def _get_authorization_header(self):
}
response = requests.post(url, data=body)
response_json = response.json()
response.raise_for_status()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core of the PR


except Exception as e:
raise ValueError("[ERROR] Failed generating oauth token {" + str(e) + "}")
except (requests.exceptions.HTTPError, KeyError) as e:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core of the PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you @flavienSindou for adding this
Everything looks good to me :)

@helene-nguyen helene-nguyen removed the bug use for describing something not working as expected label Feb 6, 2025
@flavienSindou flavienSindou merged commit f2c05c8 into master Feb 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sentinel-Intel Connector Stopped Ingesting Data
2 participants