-
Notifications
You must be signed in to change notification settings - Fork 0
[VW-216] use one-time-tokens for webhook responses instead of api keys #105
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
Changes from all commits
f53a077
1398372
610fd67
d438cc2
4270e32
1711b2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| Warnings: | ||
|
|
||
| - You are about to drop the column `apiKeyId` on the `integration` table. All the data in the column will be lost. | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drop it >:) |
||
| - Made the column `integrationUserId` on table `integration` required. This step will fail if there are existing NULL values in that column. | ||
|
|
||
| */ | ||
| -- DropForeignKey | ||
| ALTER TABLE "public"."integration" DROP CONSTRAINT "integration_apiKeyId_fkey"; | ||
|
|
||
| -- DropIndex | ||
| DROP INDEX "public"."integration_apiKeyId_key"; | ||
|
|
||
| -- AlterTable | ||
| ALTER TABLE "integration" DROP COLUMN "apiKeyId", | ||
| ALTER COLUMN "integrationUserId" SET NOT NULL; | ||
|
|
||
| -- CreateTable | ||
| CREATE TABLE "UserToken" ( | ||
| "id" TEXT NOT NULL, | ||
| "userId" TEXT NOT NULL, | ||
| "tokenHash" TEXT NOT NULL, | ||
| "permissions" TEXT, | ||
| "expiresAt" TIMESTAMP(3) NOT NULL, | ||
| "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
|
|
||
| CONSTRAINT "UserToken_pkey" PRIMARY KEY ("id") | ||
| ); | ||
|
|
||
| -- CreateIndex | ||
| CREATE UNIQUE INDEX "UserToken_tokenHash_key" ON "UserToken"("tokenHash"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "UserToken_userId_idx" ON "UserToken"("userId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "UserToken_expiresAt_idx" ON "UserToken"("expiresAt"); | ||
|
|
||
| -- AddForeignKey | ||
| ALTER TABLE "UserToken" ADD CONSTRAINT "UserToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove api key from integration, create UserToken model. UserToken stores a hash of a token, expiration time, user, and optional permissions. permissions are so that user tokens can be used more generally on VIPER if needed, and to make sure that token users "stay in their lanes". it's cheap RBAC. for integration uploads we currently set a permission on the user token for just that integration endpoint, and then when we use a token, we make sure it has the expected permission. if it doesn't the token is invalid. so Helm, which gives us vulnerabilities, can't use its token to give us assets instead. |
Uh oh!
There was an error while loading. Please reload this page.