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) #1483

Closed
wants to merge 3 commits into from

Conversation

m-maillot
Copy link
Contributor

No description provided.

Copy link

socket-security bot commented Oct 2, 2024

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

Package New capabilities Transitives Size Publisher
npm/@lerna/add@5.6.2 None 0 14 kB jameshenry
npm/@lerna/bootstrap@5.6.2 environment 0 35.5 kB jameshenry
npm/@lerna/changed@5.6.2 None 0 7.12 kB jameshenry
npm/@lerna/child-process@5.6.2 None 0 6.81 kB jameshenry
npm/@lerna/clean@5.6.2 None 0 4.97 kB jameshenry
npm/@lerna/cli@5.6.2 None 0 3.7 kB jameshenry
npm/@lerna/collect-updates@5.6.2 None 0 13.5 kB jameshenry
npm/@lerna/command@5.6.2 None 0 13.9 kB jameshenry
npm/@lerna/create@5.6.2 filesystem 0 27.5 kB jameshenry
npm/@lerna/diff@5.6.2 None 0 6.14 kB jameshenry
npm/@lerna/exec@5.6.2 environment 0 13.2 kB jameshenry
npm/@lerna/filter-options@5.6.2 None 0 11.4 kB jameshenry
npm/@lerna/global-options@5.6.2 None 0 5.32 kB jameshenry
npm/@lerna/has-npm-version@5.6.2 None 0 2.79 kB jameshenry
npm/@lerna/import@5.6.2 filesystem 0 14.6 kB jameshenry
npm/@lerna/info@5.6.2 None 0 3.52 kB jameshenry
npm/@lerna/init@5.6.2 filesystem 0 9.09 kB jameshenry
npm/@lerna/link@5.6.2 None 0 6.8 kB jameshenry
npm/@lerna/list@5.6.2 None 0 7.05 kB jameshenry
npm/@lerna/listable@5.6.2 None 0 9.75 kB jameshenry
npm/@lerna/npm-conf@5.6.2 environment, filesystem 0 24.1 kB jameshenry
npm/@lerna/npm-install@5.6.2 filesystem 0 6.86 kB jameshenry
npm/@lerna/output@5.6.2 None 0 2.26 kB jameshenry
npm/@lerna/package-graph@5.6.2 None 0 19.2 kB jameshenry
npm/@lerna/prompt@5.6.2 None 0 3.92 kB jameshenry
npm/@lerna/publish@5.6.2 environment, filesystem, network 0 69.1 kB jameshenry
npm/@lerna/pulse-till-done@5.6.2 None 0 2.95 kB jameshenry
npm/@lerna/rimraf-dir@5.6.2 None 0 3.51 kB jameshenry
npm/@lerna/run-lifecycle@5.6.2 None 0 7.41 kB jameshenry
npm/@lerna/run-topologically@5.6.2 None 0 3.56 kB jameshenry
npm/@lerna/run@5.6.2 environment, filesystem, unsafe 0 19.7 kB jameshenry
npm/@lerna/symlink-binary@5.6.2 filesystem 0 3.75 kB jameshenry
npm/@lerna/symlink-dependencies@5.6.2 filesystem 0 5.74 kB jameshenry
npm/@lerna/validation-error@5.6.2 None 0 2.43 kB jameshenry
npm/@lerna/version@5.6.2 environment, filesystem 0 70.4 kB jameshenry
npm/@npmcli/arborist@5.3.0 environment, filesystem, network 0 417 kB gar
npm/@nrwl/devkit@15.9.4 environment, filesystem, shell, unsafe 0 227 kB nrwl-jason
npm/dedent@0.7.0 None 0 4.85 kB dmnd
npm/get-port@5.1.1 network 0 8.74 kB sindresorhus
npm/husky@7.0.4 filesystem, shell 0 6.06 kB typicode
npm/import-local@3.1.0 None 0 4.66 kB sindresorhus
npm/inquirer@8.2.5 None 0 87.6 kB sboudrias
npm/lerna@5.6.2 None 0 76.3 kB jameshenry
npm/multimatch@5.0.0 None 0 6.03 kB sindresorhus
npm/npm-package-arg@8.1.1 None 0 16.3 kB nlf
npm/npmlog@6.0.2 None 0 17.1 kB lukekarrys
npm/nx@15.9.4 environment, filesystem, network, shell, unsafe 0 3.09 MB nrwl-jason
npm/p-map-series@2.1.0 None 0 5.63 kB sindresorhus
npm/p-map@4.0.0 None 0 8.69 kB sindresorhus
npm/p-waterfall@2.1.1 None 0 10.4 kB sindresorhus
npm/pacote@13.6.2 environment, filesystem, network 0 69.9 kB gar
npm/semver@7.5.3 None 0 93.4 kB npm-cli-ops
npm/typescript@4.9.5 None 0 66.8 MB typescript-bot
npm/yargs@17.7.2 environment, filesystem 0 292 kB oss-bot

🚮 Removed packages: npm/@nodelib/fs.scandir@2.1.5, npm/@nodelib/fs.stat@2.0.5, npm/@nodelib/fs.walk@1.2.8, npm/array-union@2.1.0, npm/balanced-match@1.0.2, npm/callsites@3.1.0, npm/cross-spawn@7.0.3, npm/dir-glob@3.0.1, npm/escape-string-regexp@1.0.5, npm/fs.realpath@1.0.0, npm/glob-parent@5.1.2, npm/globby@11.1.0, npm/import-fresh@3.3.0, npm/imurmurhash@0.1.4, npm/inflight@1.0.6, npm/inherits@2.0.4, npm/is-extglob@2.1.1, npm/is-glob@4.0.3, npm/is-number@7.0.0, npm/isexe@2.0.0, npm/js-tokens@4.0.0, npm/lodash@4.17.21, npm/merge2@1.4.1, npm/once@1.4.0, npm/parent-module@1.0.1, npm/path-exists@4.0.0, npm/path-is-absolute@1.0.1, npm/path-key@3.1.1, npm/path-type@4.0.0, npm/picomatch@2.3.1, npm/queue-microtask@1.2.3, npm/reusify@1.0.4, npm/rimraf@3.0.2, npm/run-parallel@1.2.0, npm/shebang-command@2.0.0, npm/shebang-regex@3.0.0, npm/slash@3.0.0, npm/to-regex-range@5.0.1, npm/which@2.0.2, npm/wrappy@1.0.2

View full report↗︎


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 about 1 month 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
Copy link

sonarcloud bot commented Oct 3, 2024

Copy link

github-actions bot commented Oct 3, 2024

🎉 Deployment for commit f318231 :

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

@m-maillot m-maillot closed this Oct 14, 2024
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 14, 2024 15:06 Destroyed
@SocialGroovyBot SocialGroovyBot temporarily deployed to review-linked-feat-fiches-mt-dsfr-5647pj October 14, 2024 18:12 Destroyed
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