-
Notifications
You must be signed in to change notification settings - Fork 5
[v6 PROD RELEASE] - dev -> master #13
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 5 commits
16c085e
3c01538
bfeae65
f78c99e
d3c2038
e1a4f4a
c558b5e
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 | ||
|
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. [ |
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Trivy scanner in repo mode | ||
| uses: aquasecurity/trivy-action@0.33.1 | ||
|
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. [ |
||
| 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 }} | ||
|
|
||
| - name: Upload Trivy scan results to GitHub Security tab | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
|
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. [ |
||
| with: | ||
| sarif_file: "trivy-results.sarif" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -390,13 +390,16 @@ describe('RoleService', () => { | |
| ).rejects.toThrow(NotFoundException); | ||
| }); | ||
|
|
||
| it('should throw ConflictException if assignment already exists', async () => { | ||
| it('should ignore duplicate assignment if already exists', async () => { | ||
| mockPrisma.role.count.mockResolvedValue(1); | ||
| mockPrisma.roleAssignment.create.mockRejectedValue({ code: 'P2002' }); | ||
|
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. [❗❗ |
||
|
|
||
| await expect( | ||
| service.assignRoleToSubject(roleId, subjectId, operatorId), | ||
| ).rejects.toThrow(ConflictException); | ||
| ).resolves.toBeUndefined(); | ||
| expect(mockLogger.warn).toHaveBeenCalledWith( | ||
|
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. [💡 |
||
| `Attempt to assign role ${roleId} to subject ${subjectId} which already exists. Ignoring duplicate.`, | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,18 +376,15 @@ export class RoleService { | |
| } catch (error) { | ||
| if (error.code === Constants.prismaUniqueConflictcode) { | ||
| this.logger.warn( | ||
| `Attempt to assign role ${roleId} to subject ${subjectId} which already exists.`, | ||
| `Attempt to assign role ${roleId} to subject ${subjectId} which already exists. Ignoring duplicate.`, | ||
|
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. [ |
||
| ); | ||
| throw new ConflictException( | ||
| `Role ${roleId} is already assigned to subject ${subjectId}.`, | ||
| ); | ||
| } else { | ||
| this.logger.error( | ||
| `Failed to assign role ${roleId} to subject ${subjectId}: ${error.message}`, | ||
| error.stack, | ||
| ); | ||
| throw error; | ||
| return; | ||
| } | ||
| this.logger.error( | ||
| `Failed to assign role ${roleId} to subject ${subjectId}: ${error.message}`, | ||
| error.stack, | ||
| ); | ||
| throw error; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,16 @@ export class MemberPrismaService | |
| extends MemberPrismaClient | ||
| implements OnModuleInit, OnModuleDestroy | ||
| { | ||
| constructor() { | ||
| super({ | ||
| transactionOptions: { | ||
| timeout: process.env.IDENTITY_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. [❗❗ |
||
| ? parseInt(process.env.IDENTITY_SERVICE_PRISMA_TIMEOUT, 10) | ||
| : 10000, | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| async onModuleInit() { | ||
| await this.$connect(); | ||
| } | ||
|
|
||
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.
[💡
style]Consider adding a newline at the end of the file to adhere to POSIX standards, which can help prevent issues with certain tools and version control systems.