Skip to content

Feature/persistent api keys#1342

Merged
andreybavt merged 15 commits intomainfrom
feature/persistent-api-keys
Aug 30, 2023
Merged

Feature/persistent api keys#1342
andreybavt merged 15 commits intomainfrom
feature/persistent-api-keys

Conversation

@andreybavt
Copy link
Contributor

Save API keys in DB so that they don't expire

263748828-3927a381-b016-4c74-a3bc-8ed8f7cc7aab
263748930-1fcc5b39-09f3-47c0-a510-939c4353bbc8

I also extracted ml-worker-connect from /api/v2 into /public-api to start distinguishing API authenticated requests from regular internal api requests. In case we add some entry points specifically for public API access it should be under /public-api to enforce API Key authentication

@andreybavt andreybavt mentioned this pull request Aug 28, 2023
@andreybavt andreybavt changed the base branch from main to bug/fix-h2-db-lob August 28, 2023 18:13
wait=False,
headers={
"jwt": self.client.session.auth.token,
"api-key": self.client.session.auth.token,
Copy link
Member

@Inokinoki Inokinoki Aug 30, 2023

Choose a reason for hiding this comment

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

Will we change auth for internal worker later or also here?

Copy link
Contributor Author

@andreybavt andreybavt Aug 30, 2023

Choose a reason for hiding this comment

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

yes, internal worker will use persistent API key too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should generate a "system" api key upon first Giskard boot or take it from env variable and use it by internal worker. The benefits compared to current jwt mechanism:

  • system api key will remain the same between restarts
  • depending on how we generate it it can be known by backend and ml worker at boot time (in case it's set in the env variable). This makes the auth mechanism easier as there's no need to wait for backend to boot to generate a jwt token

Copy link
Member

Choose a reason for hiding this comment

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

No problem, it will be an internal change.
I created GSK-1663 and we can do it later, apart from this PR.

@Inokinoki
Copy link
Member

Inokinoki commented Aug 30, 2023

LGTM, the tests also passed.

I'll update #1277 after merge accordingly, if any

Copy link
Contributor

@Googleton Googleton left a comment

Choose a reason for hiding this comment

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

Great feature!!

@andreybavt andreybavt changed the base branch from bug/fix-h2-db-lob to main August 30, 2023 14:55
# Conflicts:
#	backend/src/main/java/ai/giskard/config/SecurityConfiguration.java
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

17.9% 17.9% Coverage
0.0% 0.0% Duplication

@andreybavt andreybavt merged commit b04d6ec into main Aug 30, 2023
@Hartorn Hartorn deleted the feature/persistent-api-keys branch September 22, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants