-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix nested relations #7158
Fix nested relations #7158
Conversation
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.
PR Summary
This pull request addresses an issue with nested relations processing in the GraphQL query runner. The change focuses on using the correct object metadata name when handling nested relations.
- Modified
process-nested-relations.helper.ts
to usereferenceObjectMetadata.nameSingular
instead ofreferenceObjectMetadataName
when getting the repository - This change ensures proper object metadata retrieval for nested relations, improving data integrity and relationship handling
- The fix is crucial for maintaining consistency between object metadata and relation processing in the GraphQL query runner
- Potential impact on query performance and accuracy should be monitored after implementation
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
key: string, | ||
value: any, | ||
): WhereConditionParts { | ||
const uuid = Math.random().toString(36).slice(2, 7); |
Check failure
Code scanning / CodeQL
Insecure randomness High
Math.random()
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 8 hours ago
To fix the problem, we need to replace the use of Math.random()
with a cryptographically secure random number generator. In Node.js, we can use the crypto
module's randomBytes
function to generate secure random values. We will convert these bytes to a base-36 string to maintain the existing functionality.
- Replace the line using
Math.random()
with a line that usescrypto.randomBytes
to generate a secure random value. - Import the
crypto
module at the top of the file.
-
Copy modified line R2 -
Copy modified line R74
@@ -1,2 +1,3 @@ | ||
import { ObjectLiteral, WhereExpressionBuilder } from 'typeorm'; | ||
import { randomBytes } from 'crypto'; | ||
|
||
@@ -72,3 +73,3 @@ | ||
): WhereConditionParts { | ||
const uuid = Math.random().toString(36).slice(2, 7); | ||
const uuid = randomBytes(3).toString('base64').slice(0, 5).replace(/\+/g, '0').replace(/\//g, '0'); | ||
|
No description provided.