-
Notifications
You must be signed in to change notification settings - Fork 6
[v6 PROD RELEASE] - dev -> master #28
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 18 commits
9279a19
2449c2e
d269ee5
aa77c21
a215324
80170e9
3f96faa
c003e03
41b0ca8
362af3f
21e760d
6bd3690
ec0656f
76506ca
fd82edf
4a20ab7
d34e20b
6486a94
1c69c38
0b8dc13
9fe2350
c80586d
0e0aa70
73a547b
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,34 @@ | ||
| name: Trivy Scanner | ||
|
|
||
| permissions: | ||
| contents: read | ||
| security-events: write | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - dev | ||
| pull_request: | ||
| jobs: | ||
| trivy-scan: | ||
| name: Use Trivy | ||
| runs-on: ubuntu-24.04 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Trivy scanner in repo mode | ||
| uses: aquasecurity/trivy-action@0.33.1 | ||
| with: | ||
| scan-type: "fs" | ||
| ignore-unfixed: true | ||
| format: "sarif" | ||
| output: "trivy-results.sarif" | ||
| severity: "CRITICAL,HIGH,UNKNOWN" | ||
| scanners: vuln,secret,misconfig,license | ||
| github-pat: ${{ secrets.GITHUB_TOKEN }} | ||
|
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. [ |
||
|
|
||
| - name: Upload Trivy scan results to GitHub Security tab | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| with: | ||
| sarif_file: "trivy-results.sarif" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,4 +129,5 @@ module.exports = { | |
| // Database schemas for direct counts (shared DB) | ||
| RESOURCES_DB_SCHEMA: process.env.RESOURCES_DB_SCHEMA || "resources", | ||
| REVIEW_DB_SCHEMA: process.env.REVIEW_DB_SCHEMA || "reviews", | ||
| CHALLENGE_SERVICE_PRISMA_TIMEOUT: process.env.CHALLENGE_SERVICE_PRISMA_TIMEOUT ? parseInt(process.env.CHALLENGE_SERVICE_PRISMA_TIMEOUT, 10) : 10000, | ||
|
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. [ |
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| -- CreateIndex | ||
| CREATE INDEX "Challenge_status_startDate_idx" ON "Challenge"("status", "startDate"); | ||
|
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. [ |
||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "Challenge_trackId_typeId_status_idx" ON "Challenge"("trackId", "typeId", "status"); | ||
|
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. [ |
||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "Challenge_legacyId_idx" ON "Challenge"("legacyId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "Challenge_projectId_status_idx" ON "Challenge"("projectId", "status"); | ||
|
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. [ |
||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ChallengePhase_challengeId_isOpen_idx" ON "ChallengePhase"("challengeId", "isOpen"); | ||
|
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. [ |
||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ChallengePhase_challengeId_name_idx" ON "ChallengePhase"("challengeId", "name"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ChallengePrizeSet_challengeId_type_idx" ON "ChallengePrizeSet"("challengeId", "type"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ChallengeReviewer_challengeId_phaseId_idx" ON "ChallengeReviewer"("challengeId", "phaseId"); | ||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "ChallengeWinner_challengeId_type_placement_idx" ON "ChallengeWinner"("challengeId", "type", "placement"); | ||
|
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. [ |
||
|
|
||
| -- CreateIndex | ||
| CREATE INDEX "TimelineTemplatePhase_timelineTemplateId_phaseId_idx" ON "TimelineTemplatePhase"("timelineTemplateId", "phaseId"); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ const { | |
| ReviewOpportunityTypeEnum, | ||
| } = require("@prisma/client"); | ||
| const logger = require("./logger"); | ||
| const config = require("config"); | ||
|
|
||
| const prismaClient = new PrismaClient({ | ||
| log: [ | ||
|
|
@@ -21,7 +22,7 @@ const prismaClient = new PrismaClient({ | |
| // Allow overriding via environment variables if needed. | ||
| transactionOptions: { | ||
| maxWait: Number(process.env.PRISMA_TRANSACTION_MAX_WAIT_MS || 10000), // wait up to 10s to start | ||
| timeout: Number(process.env.PRISMA_TRANSACTION_TIMEOUT_MS || 10000), // allow up to 30s per transaction | ||
| timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT, // allow up to 30s per transaction | ||
|
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. [ |
||
| }, | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ const createClient = () => | |
| ], | ||
| transactionOptions: { | ||
| maxWait: Number(process.env.PRISMA_TRANSACTION_MAX_WAIT_MS || 10000), | ||
| timeout: Number(process.env.PRISMA_TRANSACTION_TIMEOUT_MS || 10000), | ||
| timeout: config.CHALLENGE_SERVICE_PRISMA_TIMEOUT, | ||
|
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. [❗❗ |
||
| }, | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| /** | ||
| * Controller for default challenge reviewer endpoints. | ||
| */ | ||
| const HttpStatus = require("http-status-codes"); | ||
| const service = require("../services/DefaultChallengeReviewerService"); | ||
| const helper = require("../common/helper"); | ||
|
|
||
| /** | ||
| * Search default challenge reviewers. | ||
| * | ||
| * @param {Object} req the request | ||
| * @param {Object} res the response | ||
| */ | ||
| async function searchDefaultChallengeReviewers(req, res) { | ||
| const result = await service.searchDefaultChallengeReviewers(req.query); | ||
|
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. [❗❗ |
||
| helper.setResHeaders(req, res, result); | ||
| res.send(result.result); | ||
| } | ||
|
|
||
| /** | ||
| * Create default challenge reviewer. | ||
| * | ||
| * @param {Object} req the request | ||
| * @param {Object} res the response | ||
| */ | ||
| async function createDefaultChallengeReviewer(req, res) { | ||
| const result = await service.createDefaultChallengeReviewer(req.authUser, req.body); | ||
|
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. [❗❗ |
||
| res.status(HttpStatus.CREATED).send(result); | ||
| } | ||
|
|
||
| /** | ||
| * Get default challenge reviewer. | ||
| * | ||
| * @param {Object} req the request | ||
| * @param {Object} res the response | ||
| */ | ||
| async function getDefaultChallengeReviewer(req, res) { | ||
| const result = await service.getDefaultChallengeReviewer( | ||
|
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. [❗❗ |
||
| req.params.defaultChallengeReviewerId | ||
| ); | ||
| res.send(result); | ||
| } | ||
|
|
||
| /** | ||
| * Fully update default challenge reviewer. | ||
| * | ||
| * @param {Object} req the request | ||
| * @param {Object} res the response | ||
| */ | ||
| async function fullyUpdateDefaultChallengeReviewer(req, res) { | ||
| const result = await service.fullyUpdateDefaultChallengeReviewer( | ||
|
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. [❗❗ |
||
| req.authUser, | ||
| req.params.defaultChallengeReviewerId, | ||
| req.body | ||
| ); | ||
| res.send(result); | ||
| } | ||
|
|
||
| /** | ||
| * Partially update default challenge reviewer. | ||
| * | ||
| * @param {Object} req the request | ||
| * @param {Object} res the response | ||
| */ | ||
| async function partiallyUpdateDefaultChallengeReviewer(req, res) { | ||
| const result = await service.partiallyUpdateDefaultChallengeReviewer( | ||
|
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. [❗❗ |
||
| req.authUser, | ||
| req.params.defaultChallengeReviewerId, | ||
| req.body | ||
| ); | ||
| res.send(result); | ||
| } | ||
|
|
||
| /** | ||
| * Delete default challenge reviewer. | ||
| * | ||
| * @param {Object} req the request | ||
| * @param {Object} res the response | ||
| */ | ||
| async function deleteDefaultChallengeReviewer(req, res) { | ||
| const result = await service.deleteDefaultChallengeReviewer( | ||
|
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. [❗❗ |
||
| req.params.defaultChallengeReviewerId | ||
| ); | ||
| res.send(result); | ||
| } | ||
|
|
||
| module.exports = { | ||
| searchDefaultChallengeReviewers, | ||
| createDefaultChallengeReviewer, | ||
| getDefaultChallengeReviewer, | ||
| fullyUpdateDefaultChallengeReviewer, | ||
| partiallyUpdateDefaultChallengeReviewer, | ||
| deleteDefaultChallengeReviewer, | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -316,6 +316,52 @@ module.exports = { | |
| scopes: [DELETE, ALL], | ||
| }, | ||
| }, | ||
| "/default-challenge-reviewers": { | ||
| get: { | ||
| controller: "DefaultChallengeReviewerController", | ||
| method: "searchDefaultChallengeReviewers", | ||
| auth: "jwt", | ||
| access: [constants.UserRoles.Admin], | ||
|
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. [ |
||
| scopes: [READ, ALL], | ||
| }, | ||
| post: { | ||
| controller: "DefaultChallengeReviewerController", | ||
| method: "createDefaultChallengeReviewer", | ||
| auth: "jwt", | ||
| access: [constants.UserRoles.Admin], | ||
| scopes: [CREATE, ALL], | ||
| }, | ||
| }, | ||
| "/default-challenge-reviewers/:defaultChallengeReviewerId": { | ||
| get: { | ||
| controller: "DefaultChallengeReviewerController", | ||
| method: "getDefaultChallengeReviewer", | ||
| auth: "jwt", | ||
| access: [constants.UserRoles.Admin], | ||
|
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. [ |
||
| scopes: [READ, ALL], | ||
| }, | ||
| put: { | ||
| controller: "DefaultChallengeReviewerController", | ||
| method: "fullyUpdateDefaultChallengeReviewer", | ||
| auth: "jwt", | ||
| access: [constants.UserRoles.Admin], | ||
| scopes: [UPDATE, ALL], | ||
| }, | ||
| patch: { | ||
| controller: "DefaultChallengeReviewerController", | ||
| method: "partiallyUpdateDefaultChallengeReviewer", | ||
| auth: "jwt", | ||
| access: [constants.UserRoles.Admin], | ||
| scopes: [UPDATE, ALL], | ||
| }, | ||
| delete: { | ||
| controller: "DefaultChallengeReviewerController", | ||
| method: "deleteDefaultChallengeReviewer", | ||
| auth: "jwt", | ||
| access: [constants.UserRoles.Admin], | ||
| scopes: [DELETE, ALL], | ||
| }, | ||
| }, | ||
| "/timeline-templates": { | ||
| get: { | ||
| controller: "TimelineTemplateController", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[⚠️
maintainability]Consider using
ubuntu-latestinstead of a specific version likeubuntu-24.04to ensure the workflow uses the most up-to-date and supported version of the runner. This can help avoid issues with deprecated or unsupported versions in the future.