-
Notifications
You must be signed in to change notification settings - Fork 112
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
Enhance Airbyte Integration with Connection Checks and Conditional Features #626
Conversation
iandjx
commented
Nov 1, 2024
•
edited
Loading
edited
- Added a function to check Airbyte connection status and integrated it into various components.
- Enhanced DatasourceTable and Datasources pages to conditionally enable features based on Airbyte availability.
- Implemented a new route and controller method to handle Airbyte connection checks.
- Updated Airbyte setup to include status checks and initialization logic.
Minimum allowed coverage is Generated by 🐒 cobertura-action against 6728867 |
@@ -37,6 +40,12 @@ | |||
const [deletingMap, setDeletingMap] = useState({}); | |||
const [confirmClose, setConfirmClose] = useState(false); | |||
|
|||
const goToDatasourcePage = (id: string) => { | |||
if (isAirbyteEnabled) { | |||
router.push(`/${resourceSlug}/datasource/${id}`); |
Check warning
Code scanning / CodeQL
Client-side URL redirect Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 9 days ago
To fix the problem, we should avoid using user input directly in constructing the redirect URL. Instead, we can maintain a list of authorized redirects and choose from that list based on the user input. This ensures that only valid and safe URLs are used for redirection.
- Create a list of authorized
resourceSlug
values. - Check if the
resourceSlug
fromrouter.query
is in the list of authorized values. - Only perform the redirection if the
resourceSlug
is authorized.
-
Copy modified line R43 -
Copy modified line R45 -
Copy modified lines R47-R48
@@ -42,5 +42,8 @@ | ||
|
||
const authorizedResourceSlugs = ['validSlug1', 'validSlug2']; // Add all authorized slugs here | ||
const goToDatasourcePage = (id: string) => { | ||
if (isAirbyteEnabled) { | ||
if (isAirbyteEnabled && authorizedResourceSlugs.includes(resourceSlug)) { | ||
router.push(`/${resourceSlug}/datasource/${id}`); | ||
} else { | ||
toast.error('Unauthorized resource slug'); | ||
} |
This approach looks to test the "/api/v1/health" endpoint. There might be a situation where the health check returns 200 but the bearer token stored in the webapp is invalid (since the health check endpoint doesn't require auth). Might be a good idea to add a second endpoint check to ensure that both airbyte is up and that the webapp has a valid bearer token |
…t request, adding ENV variable to env example to ensure that lack of the variable doesn't break the app
Addressed these issues in latest commits. |