Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Impressum exec-safe-bin-semantics.test.ts

  Sprache: JAVA
 

Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

import { describe, expect, it } from "vitest";
import {
  listRiskyConfiguredSafeBins,
  validateSafeBinSemantics,
} from "./exec-safe-bin-semantics.js";

describe("exec safe-bin semantics", () => {
  it("rejects awk and sed variants even when configured via path-like entries", () => {
    expect(
      validateSafeBinSemantics({
        binName: "/opt/homebrew/bin/gawk",
        positional: ['BEGIN { system("id") }'],
      }),
    ).toBe(false);
    expect(
      validateSafeBinSemantics({
        binName: "C:\\Tools\\mawk.exe",
        positional: ['BEGIN { print ENVIRON["HOME"] }'],
      }),
    ).toBe(false);
    expect(
      validateSafeBinSemantics({
        binName: "nawk",
        positional: ['BEGIN { print "hi" > "/tmp/out" }'],
      }),
    ).toBe(false);
    expect(
      validateSafeBinSemantics({
        binName: "/usr/local/bin/gsed",
        positional: ["e"],
      }),
    ).toBe(false);
  });

  it("reports normalized risky configured safe bins once per executable family member", () => {
    expect(
      listRiskyConfiguredSafeBins([
        " Awk ",
        "/opt/homebrew/bin/gawk",
        "C:\\Tools\\mawk.exe",
        "nawk",
        "sed",
        "/usr/local/bin/gsed",
        "jq",
        "jq",
      ]),
    ).toEqual([
      {
        bin: "awk",
        warning:
          "awk-family interpreters can execute commands, access ENVIRON, and write files, so prefer explicit allowlist entries or approval-gated runs instead of safeBins.",
      },
      {
        bin: "gawk",
        warning:
          "awk-family interpreters can execute commands, access ENVIRON, and write files, so prefer explicit allowlist entries or approval-gated runs instead of safeBins.",
      },
      {
        bin: "gsed",
        warning:
          "sed scripts can execute commands and write files, so prefer explicit allowlist entries or approval-gated runs instead of safeBins.",
      },
      {
        bin: "jq",
        warning:
          "jq supports broad jq programs and builtins (for example `env`), so prefer explicit allowlist entries or approval-gated runs instead of safeBins.",
      },
      {
        bin: "mawk",
        warning:
          "awk-family interpreters can execute commands, access ENVIRON, and write files, so prefer explicit allowlist entries or approval-gated runs instead of safeBins.",
      },
      {
        bin: "nawk",
        warning:
          "awk-family interpreters can execute commands, access ENVIRON, and write files, so prefer explicit allowlist entries or approval-gated runs instead of safeBins.",
      },
      {
        bin: "sed",
        warning:
          "sed scripts can execute commands and write files, so prefer explicit allowlist entries or approval-gated runs instead of safeBins.",
      },
    ]);
  });
});

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge