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

chore: syncing the fork #2

Merged
merged 15 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/auto-assign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = context.payload.comment;
const issue = context.issue;
const issue = context.payload.issue;
const owner = 'keyshade-xyz';
const repo = 'keyshade';
const userMaxConcurrentIssueCount = process.env.USER_MAX_CONCURRENT_ISSUE_COUNT || 5;

async function listIssueEvents(issue) {
const allEvents = [];
async function listIssueEvents(issueNumber) {
const events = [];
let page = 1;
let hasNextPage = true;

while (hasNextPage) {
const issuesResponse = await github.rest.issues.listEventsForTimeline({
const eventsResponse = await github.rest.issues.listEventsForTimeline({
owner,
repo,
issue_number: issue.number,
issue_number: issueNumber,
per_page: 100,
page
});

allEvents.push(...issuesResponse.data);
events.push(...eventsResponse.data);

hasNextPage = issuesResponse.headers.link && issuesResponse.headers.link.includes('rel="next"');
hasNextPage = eventsResponse.headers.link && eventsResponse.headers.link.includes('rel="next"');
page++;
}

return allEvents;
return events;
}

async function listUserOpenIssuesWithoutActivePullRequest(user) {
Expand All @@ -55,7 +55,7 @@ jobs:
});

for (const issue of userOpenIssues) {
const events = await listIssueEvents(issue);
const events = await listIssueEvents(issue.number);
const userPullRequestIssues = events
.filter(event => event.event === 'cross-referenced')
.map(event => event.source.issue)
Expand Down
115 changes: 0 additions & 115 deletions .github/workflows/pr-close.yaml

This file was deleted.

46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
## [2.12.0-stage.19](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.18...v2.12.0-stage.19) (2025-02-26)

### 🐛 Bug Fixes

* **api:** Added back missing endpoints ([#798](https://github.com/keyshade-xyz/keyshade/issues/798)) ([c6a0df9](https://github.com/keyshade-xyz/keyshade/commit/c6a0df9679eb4f0c1ec53ec436adc2b5f5bd84d8))

## [2.12.0-stage.18](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.17...v2.12.0-stage.18) (2025-02-26)

### 🚀 Features

* **cli:** Error message formatted ([#797](https://github.com/keyshade-xyz/keyshade/issues/797)) ([0322944](https://github.com/keyshade-xyz/keyshade/commit/03229446207dc7bc55d0aed5a049255fcc86ede3))

## [2.12.0-stage.17](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.16...v2.12.0-stage.17) (2025-02-26)

### 🐛 Bug Fixes

* **api:** Issue with authorities and expiry field update in API Key ([#800](https://github.com/keyshade-xyz/keyshade/issues/800)) ([8e30f15](https://github.com/keyshade-xyz/keyshade/commit/8e30f15449fcf3333c7eaa26f4d8c6bd02f8b0a6))

## [2.12.0-stage.16](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.15...v2.12.0-stage.16) (2025-02-23)

### 🐛 Bug Fixes

* **web:** Misalignment of toast message after joining the waitlist ([#791](https://github.com/keyshade-xyz/keyshade/issues/791)) ([688e11c](https://github.com/keyshade-xyz/keyshade/commit/688e11c201f1cbdc77b8906805f384aad85f90ab))

### 🔧 Miscellaneous Chores

* **ci:** Remove PR unassign script ([f174101](https://github.com/keyshade-xyz/keyshade/commit/f17410100d845a28affc25d369733facd3809ab5))

## [2.12.0-stage.15](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.14...v2.12.0-stage.15) (2025-02-23)

### 🐛 Bug Fixes

* **api:** Added import statement for crypto module ([#789](https://github.com/keyshade-xyz/keyshade/issues/789)) ([f6ddf0f](https://github.com/keyshade-xyz/keyshade/commit/f6ddf0fc54280c9844143ac42840fcbde1438b23))

## [2.12.0-stage.14](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.13...v2.12.0-stage.14) (2025-02-23)

### 🐛 Bug Fixes

* **api:** Issue fetched via API ([#788](https://github.com/keyshade-xyz/keyshade/issues/788)) ([b373eeb](https://github.com/keyshade-xyz/keyshade/commit/b373eeb5974ee61bd07ce586da4b56dbd0d10fab))

## [2.12.0-stage.13](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.12...v2.12.0-stage.13) (2025-02-23)

### 🐛 Bug Fixes

* **platform:** Add graceful fallback in error parsing ([a59de60](https://github.com/keyshade-xyz/keyshade/commit/a59de60e40b6f3617a4278837e0c63fcb5752d16))

## [2.12.0-stage.12](https://github.com/keyshade-xyz/keyshade/compare/v2.12.0-stage.11...v2.12.0-stage.12) (2025-02-22)

### 🚀 Features
Expand Down
15 changes: 2 additions & 13 deletions api-collection/Api Key Controller/Update API key.bru
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ put {
}

params:path {
api_key_slug: my-key-2
api_key_slug: test-key-0
}

auth:bearer {
Expand All @@ -20,18 +20,7 @@ auth:bearer {

body:json {
{
"authorities": [
"READ_API_KEY",
"READ_WORKSPACE",
"READ_PROJECT",
"READ_ENVIRONMENT",
"READ_VARIABLE",
"READ_SECRET",
"CREATE_WORKSPACE",
"UPDATE_WORKSPACE",
"DELETE_WORKSPACE",
"WORKSPACE_ADMIN"
]
"expiresAfter": "never"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
meta {
name: Fetch all by project and environment
type: http
seq: 5
}

get {
url: {{BASE_URL}}/api/secret/:project_slug/:environment_slug
body: none
auth: bearer
}

params:path {
project_slug:
environment_slug:
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Fetches all the secrets for a particular pair of project and environment. Used by the CLI to prefetch the existing secrets.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
meta {
name: Fetch all by project and environment
type: http
seq: 5
}

get {
url: {{BASE_URL}}/api/variable/:project_slug/:environment_slug
body: none
auth: bearer
}

params:path {
project_slug: project-1-uzukc
environment_slug: alpha-l7xvp
}

auth:bearer {
token: {{JWT}}
}

docs {
## Description

Fetches all the variables for a particular pair of project and environment. Used by the CLI to prefetch the existing variables.
}
2 changes: 1 addition & 1 deletion apps/api/src/api-key/dto/create.api-key/create.api-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export class CreateApiKey {

@IsArray()
@IsOptional()
authorities?: Authority[] = []
authorities?: Authority[]
}
4 changes: 1 addition & 3 deletions apps/api/src/api-key/service/api-key.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ export class ApiKeyService {
slug: dto.name
? await generateEntitySlug(dto.name, 'API_KEY', this.prisma)
: apiKey.slug,
authorities: {
set: dto.authorities ? dto.authorities : apiKey.authorities
},
authorities: dto.authorities ? dto.authorities : undefined,
expiresAt: dto.expiresAfter
? addHoursToDate(dto.expiresAfter)
: undefined
Expand Down
5 changes: 3 additions & 2 deletions apps/api/src/common/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { UserAuthenticatedResponse } from '@/auth/auth.types'
import { UserWithWorkspace } from '@/user/user.types'
import { Otp, PrismaClient, User } from '@prisma/client'
import { Response } from 'express'
import * as crypto from 'crypto'

/**
* Limits the given limit to a maximum number of items per page.
Expand Down Expand Up @@ -97,8 +98,8 @@ export const excludeFields = <T, K extends keyof T>(
* @param hours The number of hours to add to the current date
* @returns The new date with the given number of hours added, or undefined if the hours is 'never'
*/
export const addHoursToDate = (hours?: string | number): Date | undefined => {
if (!hours || hours === 'never') return undefined
export const addHoursToDate = (hours?: string | number): Date | null => {
if (!hours || hours === 'never') return null

const date = new Date()
date.setHours(date.getHours() + +hours)
Expand Down
6 changes: 4 additions & 2 deletions apps/api/src/project/project.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ describe('Project Controller Tests', () => {
})

afterEach(async () => {
await prisma.user.deleteMany()
await prisma.workspace.deleteMany()
await prisma.$transaction([
prisma.user.deleteMany(),
prisma.workspace.deleteMany()
])
})

it('should be defined', async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/project/service/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ export class ProjectService {
accessLevel: project.accessLevel,
isForked: true,
forkedFromId: project.id,
workspaceId: workspaceId,
workspaceId,
lastUpdatedById: userId
}
})
Expand Down
14 changes: 14 additions & 0 deletions apps/api/src/secret/controller/secret.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,18 @@ export class SecretController {
order
)
}

@Get('/:projectSlug/:environmentSlug')
@RequiredApiKeyAuthorities(Authority.READ_SECRET)
async getAllSecretsOfEnvironment(
@CurrentUser() user: AuthenticatedUser,
@Param('projectSlug') projectSlug: string,
@Param('environmentSlug') environmentSlug: string
) {
return await this.secretService.getAllSecretsOfProjectAndEnvironment(
user,
projectSlug,
environmentSlug
)
}
}
Loading