Skip to content

Commit e21db62

Browse files
authored
Merge pull request #5 from topcoder-platform/develop
[v6 PROD RELEASE] - dev -> master
2 parents 552d2ab + e4bdf44 commit e21db62

File tree

6 files changed

+55
-3
lines changed

6 files changed

+55
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ workflows:
6464
branches:
6565
only:
6666
- develop
67+
- pm-2539
6768

6869
# Production builds are exectuted only on tagged commits to the
6970
# master branch.

.github/workflows/trivy.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Trivy Scanner
2+
3+
permissions:
4+
contents: read
5+
security-events: write
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- dev
11+
pull_request:
12+
jobs:
13+
trivy-scan:
14+
name: Use Trivy
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Run Trivy scanner in repo mode
21+
uses: aquasecurity/[email protected]
22+
with:
23+
scan-type: "fs"
24+
ignore-unfixed: true
25+
format: "sarif"
26+
output: "trivy-results.sarif"
27+
severity: "CRITICAL,HIGH,UNKNOWN"
28+
scanners: vuln,secret,misconfig,license
29+
github-pat: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Upload Trivy scan results to GitHub Security tab
32+
uses: github/codeql-action/upload-sarif@v3
33+
with:
34+
sarif_file: "trivy-results.sarif"

src/auth/guards/roles.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class RolesGuard implements CanActivate {
4848
.map((s: string) => s.trim())
4949
.filter(Boolean);
5050

51-
const scopeOk = fallbackScopes.every((s) => scopes.includes(s));
51+
const scopeOk = fallbackScopes.some((s) => scopes.includes(s));
5252
if (scopeOk) return true;
5353
}
5454

src/auth/guards/scopes.guard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class ScopesGuard implements CanActivate {
3232
.map((s: string) => s.trim())
3333
.filter(Boolean);
3434

35-
const ok = required.every((s) => scopes.includes(s));
35+
const ok = required.some((s) => scopes.includes(s));
3636
if (ok) return true;
3737

3838
const fallbackRoles = this.reflector.getAllAndOverride<string[]>(ROLES_KEY, [

src/common/members-lookup.service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ export class MembersLookupService {
2020
return;
2121
}
2222
// Create a dedicated Prisma client targeting the members DB
23-
this.client = new PrismaClient({ datasources: { db: { url } } });
23+
this.client = new PrismaClient({
24+
transactionOptions: {
25+
timeout: process.env.BA_SERVICE_PRISMA_TIMEOUT
26+
? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10)
27+
: 10000,
28+
},
29+
datasources: { db: { url } }
30+
});
2431
this.initialized = true;
2532
}
2633

src/common/prisma.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ import { PrismaClient } from "@prisma/client";
33

44
@Injectable()
55
export class PrismaService extends PrismaClient implements OnModuleInit {
6+
constructor() {
7+
super({
8+
transactionOptions: {
9+
timeout: process.env.BA_SERVICE_PRISMA_TIMEOUT
10+
? parseInt(process.env.BA_SERVICE_PRISMA_TIMEOUT, 10)
11+
: 10000,
12+
},
13+
});
14+
}
15+
616
async onModuleInit() {
717
await this.$connect();
818
}

0 commit comments

Comments
 (0)