-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Tag companies on LinkedIn #478
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 all commits
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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -156,7 +156,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async company(token: string, data: { url: string }) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { url } = data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const getCompanyVanity = url.match( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /^https?:\/\/?www\.?linkedin\.com\/company\/([^/]+)\/$/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /^https?:\/\/(?:www\.)?linkedin\.com\/company\/([^/]+)\/?$/ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!getCompanyVanity || !getCompanyVanity?.length) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| throw new Error('Invalid LinkedIn company URL'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -282,6 +282,32 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private fixText(text: string) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const pattern = /@\[.+?]\(urn:li:organization.+?\)/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const matches = text.match(pattern) || []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const splitAll = text.split(pattern); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const splitTextReformat = splitAll.map((p) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return p | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\*/g, '\\*') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\(/g, '\\(') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+290
to
+292
Check failureCode scanning / CodeQL Incomplete string escaping or encoding High
This does not escape backslash characters in the input.
Copilot AutofixAI about 1 year ago To fix the problem, we should use a regular expression with the
Suggested changeset
1
libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\)/g, '\\)') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+290
to
+293
Check failureCode scanning / CodeQL Incomplete string escaping or encoding High
This does not escape backslash characters in the input.
Copilot AutofixAI about 1 year ago To fix the problem, we should use a well-tested sanitization library to handle the escaping of special characters. This will ensure that all edge cases are covered and reduce the risk of injection attacks or other issues related to incomplete escaping. In this case, we can use the We will:
Suggested changeset
2
libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts
package.json
Outside changed files
This fix introduces these dependencies
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\{/g, '\\{') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+290
to
+294
Check failureCode scanning / CodeQL Incomplete string escaping or encoding High
This does not escape backslash characters in the input.
Copilot AutofixAI about 1 year ago To fix the problem, we should replace the custom escaping logic in the The
Suggested changeset
2
libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts
package.json
Outside changed files
This fix introduces these dependencies
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/}/g, '\\}') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+290
to
+295
Check failureCode scanning / CodeQL Incomplete string escaping or encoding High
This does not escape backslash characters in the input.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/@/g, '\\@'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+290
to
+296
Check failureCode scanning / CodeQL Incomplete string escaping or encoding High
This does not escape backslash characters in the input.
Copilot AutofixAI about 1 year ago To fix the problem, we need to ensure that all occurrences of the characters being escaped are replaced. This can be achieved by using regular expressions with the global flag ( We will modify the
Suggested changeset
1
libraries/nestjs-libraries/src/integrations/social/linkedin.provider.ts
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const connectAll = splitTextReformat.reduce((all, current) => { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const match = matches.shift(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| all.push(current); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (match) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| all.push(match); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return all; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, [] as string[]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return connectAll.join(''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async post( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: string, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| accessToken: string, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -340,12 +366,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type === 'personal' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? `urn:li:person:${id}` | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : `urn:li:organization:${id}`, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| commentary: firstPost.message | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\*/g, '\\*') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\(/g, '\\(') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\)/g, '\\)') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\{/g, '\\{') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/}/g, '\\}'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| commentary: this.fixText(firstPost.message), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| visibility: 'PUBLIC', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| distribution: { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| feedDistribution: 'MAIN_FEED', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -410,12 +431,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? `urn:li:person:${id}` | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : `urn:li:organization:${id}`, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| object: topPostId, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: post.message | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\*/g, '\\*') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\(/g, '\\(') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\)/g, '\\)') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/\{/g, '\\{') | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .replace(/}/g, '\\}'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: this.fixText(post.message), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failure
Code scanning / CodeQL
Incomplete string escaping or encoding High