Skip to content
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

test: fiches MT en DSFR (ne pas merger) #1490

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

m-maillot
Copy link
Contributor

No description provided.

@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 14, 2024 15:06 Destroyed
Copy link

socket-security bot commented Oct 14, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

🚮 Removed packages: npm/@lerna/[email protected], npm/@lerna/[email protected]

View full report↗︎

@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 14, 2024 18:12 Destroyed
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 15, 2024 07:27 Destroyed

rs.pipe(unzipper.Parse())
.on("entry", function (entry) {
const filePath = entry.path.replace(

Check failure

Code scanning / CodeQL

Arbitrary file access during archive extraction ("Zip Slip") High

Unsanitized archive entry, which may contain '..', is used in a
file system operation
.

Copilot Autofix AI 17 days ago

To fix the problem, we need to ensure that the entry.path does not contain any directory traversal sequences like .. before using it to construct outputPath. This can be achieved by validating the filePath and ensuring it is within the intended directory.

  • We will add a check to ensure that filePath does not contain .. and is within the outputDir.
  • If the filePath is invalid, we will skip processing that entry and log a warning message.
  • This change will be made in the downloadZip function, specifically around the construction and usage of outputPath.
Suggested changeset 1
targets/ingester/src/cli.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/targets/ingester/src/cli.ts b/targets/ingester/src/cli.ts
--- a/targets/ingester/src/cli.ts
+++ b/targets/ingester/src/cli.ts
@@ -97,4 +97,17 @@
 
+          // Validate filePath to prevent directory traversal
+          if (filePath.includes("..")) {
+            console.log('skipping bad path', filePath);
+            entry.autodrain();
+            return;
+          }
+
           const outputPath = path.join(outputDir, filePath);
 
+          if (!outputPath.startsWith(outputDir)) {
+            console.log('skipping bad path', filePath);
+            entry.autodrain();
+            return;
+          }
+
           if (entry.type === "Directory") {
EOF
@@ -97,4 +97,17 @@

// Validate filePath to prevent directory traversal
if (filePath.includes("..")) {
console.log('skipping bad path', filePath);
entry.autodrain();
return;
}

const outputPath = path.join(outputDir, filePath);

if (!outputPath.startsWith(outputDir)) {
console.log('skipping bad path', filePath);
entry.autodrain();
return;
}

if (entry.type === "Directory") {
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 15, 2024 10:09 Destroyed
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 15, 2024 13:35 Destroyed
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 15, 2024 13:51 Destroyed
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 15, 2024 13:56 Destroyed
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 15, 2024 14:19 Destroyed
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 15, 2024 14:22 Destroyed
Copy link

sonarcloud bot commented Oct 15, 2024

Copy link

🎉 Deployment for commit 0924562 :

Ingresses
Docker images
  • 📦 docker pull harbor.fabrique.social.gouv.fr/cdtn/cdtn-admin/export:sha-0924562a775bfa413ec1f18cb36897a274b73f09
  • 📦 docker pull harbor.fabrique.social.gouv.fr/cdtn/cdtn-admin/frontend:sha-0924562a775bfa413ec1f18cb36897a274b73f09
  • 📦 docker pull harbor.fabrique.social.gouv.fr/cdtn/cdtn-admin/hasura:sha-0924562a775bfa413ec1f18cb36897a274b73f09
Debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants