From cc911f052ebb7de0f1c07618411d2dce9c536f44 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Wed, 23 Sep 2026 10:08:51 +0200 Subject: [PATCH] feat(ci): JavaScript/TypeScript and Python fixtures for the nightly (#310) Twelve package-manager variants, each uploaded as a source archive with a vulnerable pinned dependency, a SAST sink, committed (fake) credentials, OAuth and PII patterns, and ruff violations for Python: npm lockfile v3, yarn classic and berry, pnpm, Bun's text and binary lockfiles, npm with no lockfile, requirements.txt, poetry, pipenv, uv, and a bare pyproject.toml. Fixes the fixtures turned up: - A manifest with no lockfile gave a silently empty SBOM: Syft reads lockfiles, not manifests. The SBOM stage now records a skipped `sbom_dependencies` stage naming the manifest and what to commit, checked after lockfile generation so a generated lockfile counts. - Bun projects got npm's versions. Neither Bun lockfile counted as a lockfile, so npm re-resolved the project and the SBOM reported its fresh resolution as the shipped versions. Bun lockfiles (and npm-shrinkwrap.json) now count; a project locked only by the binary bun.lockb, which Syft cannot read, says so and names the text bun.lock. - The code graph was never asserted. The harness now reads its node count, and targets can set a `min_graph_nodes` floor. The npm no-lockfile fixture pins only dependency-free packages, so npm's resolution is the same every night. That resolution follows registry configuration from the scanned repository, which is #330. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p --- compliance-agent/src/fixtures.rs | 18 ++ compliance-agent/src/pipeline/orchestrator.rs | 16 ++ compliance-agent/src/pipeline/sbom/mod.rs | 162 ++++++++++++++- compliance-agent/tests/nightly.rs | 2 + .../nightly/baselines/fw-cargo-embedded.json | 4 +- fixtures/nightly/baselines/js-bun-binary.json | 17 ++ fixtures/nightly/baselines/js-bun.json | 54 +++++ .../nightly/baselines/js-no-lockfile.json | 27 +++ .../nightly/baselines/js-npm-lock-v3.json | 55 +++++ fixtures/nightly/baselines/js-pnpm.json | 54 +++++ fixtures/nightly/baselines/js-yarn-berry.json | 55 +++++ .../nightly/baselines/js-yarn-classic.json | 54 +++++ .../nightly/baselines/py-bare-pyproject.json | 24 +++ fixtures/nightly/baselines/py-pipenv.json | 78 ++++++++ fixtures/nightly/baselines/py-poetry.json | 80 ++++++++ .../nightly/baselines/py-requirements.json | 80 ++++++++ fixtures/nightly/baselines/py-uv.json | 80 ++++++++ fixtures/nightly/eco/README.md | 64 ++++++ fixtures/nightly/eco/js-bun-binary/.env.local | 3 + fixtures/nightly/eco/js-bun-binary/bun.lockb | Bin 0 -> 1585 bytes .../nightly/eco/js-bun-binary/package.json | 1 + fixtures/nightly/eco/js-bun-binary/src/cli.js | 14 ++ .../nightly/eco/js-bun-binary/src/session.ts | 12 ++ fixtures/nightly/eco/js-bun/.env.local | 3 + fixtures/nightly/eco/js-bun/bun.lock | 20 ++ fixtures/nightly/eco/js-bun/package.json | 10 + fixtures/nightly/eco/js-bun/src/server.js | 18 ++ fixtures/nightly/eco/js-bun/src/session.ts | 12 ++ .../nightly/eco/js-no-lockfile/.env.local | 3 + .../nightly/eco/js-no-lockfile/package.json | 10 + .../nightly/eco/js-no-lockfile/src/cli.js | 14 ++ .../nightly/eco/js-no-lockfile/src/session.ts | 12 ++ .../nightly/eco/js-npm-lock-v3/.env.local | 3 + .../eco/js-npm-lock-v3/package-lock.json | 32 +++ .../nightly/eco/js-npm-lock-v3/package.json | 10 + .../nightly/eco/js-npm-lock-v3/src/server.js | 18 ++ .../nightly/eco/js-npm-lock-v3/src/session.ts | 12 ++ fixtures/nightly/eco/js-pnpm/.env.local | 3 + fixtures/nightly/eco/js-pnpm/package.json | 10 + fixtures/nightly/eco/js-pnpm/pnpm-lock.yaml | 27 +++ fixtures/nightly/eco/js-pnpm/src/server.js | 18 ++ fixtures/nightly/eco/js-pnpm/src/session.ts | 12 ++ fixtures/nightly/eco/js-yarn-berry/.env.local | 3 + .../nightly/eco/js-yarn-berry/.yarnrc.yml | 1 + .../nightly/eco/js-yarn-berry/package.json | 10 + .../nightly/eco/js-yarn-berry/src/server.js | 18 ++ .../nightly/eco/js-yarn-berry/src/session.ts | 12 ++ fixtures/nightly/eco/js-yarn-berry/yarn.lock | 27 +++ .../nightly/eco/js-yarn-classic/.env.local | 3 + .../nightly/eco/js-yarn-classic/package.json | 10 + .../nightly/eco/js-yarn-classic/src/server.js | 18 ++ .../eco/js-yarn-classic/src/session.ts | 12 ++ .../nightly/eco/js-yarn-classic/yarn.lock | 18 ++ fixtures/nightly/eco/py-bare-pyproject/app.py | 46 +++++ .../nightly/eco/py-bare-pyproject/auth.py | 21 ++ .../eco/py-bare-pyproject/deploy/service.env | 4 + .../eco/py-bare-pyproject/pyproject.toml | 10 + fixtures/nightly/eco/py-pipenv/Pipfile | 13 ++ fixtures/nightly/eco/py-pipenv/Pipfile.lock | 37 ++++ fixtures/nightly/eco/py-pipenv/app.py | 46 +++++ fixtures/nightly/eco/py-pipenv/auth.py | 21 ++ .../nightly/eco/py-pipenv/deploy/service.env | 4 + fixtures/nightly/eco/py-poetry/app.py | 46 +++++ fixtures/nightly/eco/py-poetry/auth.py | 21 ++ .../nightly/eco/py-poetry/deploy/service.env | 4 + fixtures/nightly/eco/py-poetry/poetry.lock | 36 ++++ fixtures/nightly/eco/py-poetry/pyproject.toml | 16 ++ fixtures/nightly/eco/py-requirements/app.py | 46 +++++ fixtures/nightly/eco/py-requirements/auth.py | 21 ++ .../eco/py-requirements/deploy/service.env | 4 + .../eco/py-requirements/requirements.txt | 5 + fixtures/nightly/eco/py-uv/app.py | 46 +++++ fixtures/nightly/eco/py-uv/auth.py | 21 ++ fixtures/nightly/eco/py-uv/deploy/service.env | 4 + fixtures/nightly/eco/py-uv/pyproject.toml | 10 + fixtures/nightly/eco/py-uv/uv.lock | 22 ++ fixtures/nightly/targets.json | 189 ++++++++++++++++++ 77 files changed, 2022 insertions(+), 4 deletions(-) create mode 100644 fixtures/nightly/baselines/js-bun-binary.json create mode 100644 fixtures/nightly/baselines/js-bun.json create mode 100644 fixtures/nightly/baselines/js-no-lockfile.json create mode 100644 fixtures/nightly/baselines/js-npm-lock-v3.json create mode 100644 fixtures/nightly/baselines/js-pnpm.json create mode 100644 fixtures/nightly/baselines/js-yarn-berry.json create mode 100644 fixtures/nightly/baselines/js-yarn-classic.json create mode 100644 fixtures/nightly/baselines/py-bare-pyproject.json create mode 100644 fixtures/nightly/baselines/py-pipenv.json create mode 100644 fixtures/nightly/baselines/py-poetry.json create mode 100644 fixtures/nightly/baselines/py-requirements.json create mode 100644 fixtures/nightly/baselines/py-uv.json create mode 100644 fixtures/nightly/eco/README.md create mode 100644 fixtures/nightly/eco/js-bun-binary/.env.local create mode 100755 fixtures/nightly/eco/js-bun-binary/bun.lockb create mode 100644 fixtures/nightly/eco/js-bun-binary/package.json create mode 100644 fixtures/nightly/eco/js-bun-binary/src/cli.js create mode 100644 fixtures/nightly/eco/js-bun-binary/src/session.ts create mode 100644 fixtures/nightly/eco/js-bun/.env.local create mode 100644 fixtures/nightly/eco/js-bun/bun.lock create mode 100644 fixtures/nightly/eco/js-bun/package.json create mode 100644 fixtures/nightly/eco/js-bun/src/server.js create mode 100644 fixtures/nightly/eco/js-bun/src/session.ts create mode 100644 fixtures/nightly/eco/js-no-lockfile/.env.local create mode 100644 fixtures/nightly/eco/js-no-lockfile/package.json create mode 100644 fixtures/nightly/eco/js-no-lockfile/src/cli.js create mode 100644 fixtures/nightly/eco/js-no-lockfile/src/session.ts create mode 100644 fixtures/nightly/eco/js-npm-lock-v3/.env.local create mode 100644 fixtures/nightly/eco/js-npm-lock-v3/package-lock.json create mode 100644 fixtures/nightly/eco/js-npm-lock-v3/package.json create mode 100644 fixtures/nightly/eco/js-npm-lock-v3/src/server.js create mode 100644 fixtures/nightly/eco/js-npm-lock-v3/src/session.ts create mode 100644 fixtures/nightly/eco/js-pnpm/.env.local create mode 100644 fixtures/nightly/eco/js-pnpm/package.json create mode 100644 fixtures/nightly/eco/js-pnpm/pnpm-lock.yaml create mode 100644 fixtures/nightly/eco/js-pnpm/src/server.js create mode 100644 fixtures/nightly/eco/js-pnpm/src/session.ts create mode 100644 fixtures/nightly/eco/js-yarn-berry/.env.local create mode 100644 fixtures/nightly/eco/js-yarn-berry/.yarnrc.yml create mode 100644 fixtures/nightly/eco/js-yarn-berry/package.json create mode 100644 fixtures/nightly/eco/js-yarn-berry/src/server.js create mode 100644 fixtures/nightly/eco/js-yarn-berry/src/session.ts create mode 100644 fixtures/nightly/eco/js-yarn-berry/yarn.lock create mode 100644 fixtures/nightly/eco/js-yarn-classic/.env.local create mode 100644 fixtures/nightly/eco/js-yarn-classic/package.json create mode 100644 fixtures/nightly/eco/js-yarn-classic/src/server.js create mode 100644 fixtures/nightly/eco/js-yarn-classic/src/session.ts create mode 100644 fixtures/nightly/eco/js-yarn-classic/yarn.lock create mode 100644 fixtures/nightly/eco/py-bare-pyproject/app.py create mode 100644 fixtures/nightly/eco/py-bare-pyproject/auth.py create mode 100644 fixtures/nightly/eco/py-bare-pyproject/deploy/service.env create mode 100644 fixtures/nightly/eco/py-bare-pyproject/pyproject.toml create mode 100644 fixtures/nightly/eco/py-pipenv/Pipfile create mode 100644 fixtures/nightly/eco/py-pipenv/Pipfile.lock create mode 100644 fixtures/nightly/eco/py-pipenv/app.py create mode 100644 fixtures/nightly/eco/py-pipenv/auth.py create mode 100644 fixtures/nightly/eco/py-pipenv/deploy/service.env create mode 100644 fixtures/nightly/eco/py-poetry/app.py create mode 100644 fixtures/nightly/eco/py-poetry/auth.py create mode 100644 fixtures/nightly/eco/py-poetry/deploy/service.env create mode 100644 fixtures/nightly/eco/py-poetry/poetry.lock create mode 100644 fixtures/nightly/eco/py-poetry/pyproject.toml create mode 100644 fixtures/nightly/eco/py-requirements/app.py create mode 100644 fixtures/nightly/eco/py-requirements/auth.py create mode 100644 fixtures/nightly/eco/py-requirements/deploy/service.env create mode 100644 fixtures/nightly/eco/py-requirements/requirements.txt create mode 100644 fixtures/nightly/eco/py-uv/app.py create mode 100644 fixtures/nightly/eco/py-uv/auth.py create mode 100644 fixtures/nightly/eco/py-uv/deploy/service.env create mode 100644 fixtures/nightly/eco/py-uv/pyproject.toml create mode 100644 fixtures/nightly/eco/py-uv/uv.lock diff --git a/compliance-agent/src/fixtures.rs b/compliance-agent/src/fixtures.rs index cb171a4..61a7fee 100644 --- a/compliance-agent/src/fixtures.rs +++ b/compliance-agent/src/fixtures.rs @@ -282,6 +282,11 @@ pub struct Expect { /// Lower bound on SBOM components. #[serde(default)] pub min_sbom_components: Option, + /// Lower bound on code-graph nodes, so a language the graph builder stops + /// understanding is caught. Node counts move with the parsers, so this is a + /// floor, never an exact count. + #[serde(default)] + pub min_graph_nodes: Option, /// Scans `applicable-scans` must offer for this target. #[serde(default)] pub scans_offered: Vec, @@ -303,6 +308,8 @@ pub struct Observed { /// Whether any finding carries a control ref. pub any_control_ref: bool, pub sbom_components: usize, + /// Nodes in the code graph built for this target. + pub graph_nodes: u64, pub scans_offered: BTreeSet, pub pentest_supported: Option, pub detected_facts: BTreeMap, @@ -333,6 +340,14 @@ impl Expect { )); } } + if let Some(min) = self.min_graph_nodes { + if observed.graph_nodes < min { + out.push(format!( + "{} code-graph nodes, expected at least {min}", + observed.graph_nodes + )); + } + } let missing = |what: &str, wanted: &[String], got: &BTreeSet| { wanted .iter() @@ -688,6 +703,7 @@ mod tests { control_refs: vec!["cra-ai-8".into()], control_refs_any: true, min_sbom_components: Some(1), + min_graph_nodes: Some(2), scans_offered: vec!["sast".into()], pentest_supported: Some(false), detected_facts: BTreeMap::from([("build_system".into(), "zephyr".into())]), @@ -699,6 +715,7 @@ mod tests { control_refs: BTreeSet::from(["cra-ai-8".into()]), any_control_ref: true, sbom_components: 1, + graph_nodes: 2, scans_offered: BTreeSet::from(["sast".into()]), pentest_supported: Some(false), detected_facts: BTreeMap::from([("build_system".into(), "zephyr".into())]), @@ -711,6 +728,7 @@ mod tests { for needle in [ "0 findings", "0 SBOM components", + "0 code-graph nodes", "missing rule plc-safety-bypass", "missing CWE CWE-798", "missing offered scan sast", diff --git a/compliance-agent/src/pipeline/orchestrator.rs b/compliance-agent/src/pipeline/orchestrator.rs index e20bf2a..8143541 100644 --- a/compliance-agent/src/pipeline/orchestrator.rs +++ b/compliance-agent/src/pipeline/orchestrator.rs @@ -139,6 +139,22 @@ impl PipelineOrchestrator { } }; + // A manifest with no lockfile pins no versions, and generating one runs + // the project's own code, which this deployment may not. Syft reports + // nothing for it, so say so rather than leaving the gap in an SBOM that + // looks complete. + for eco in crate::pipeline::sbom::unlocked_ecosystems(&repo_path) { + self.skip_stage( + scan_run_id, + "sbom_dependencies", + &format!( + "{} {}; {}, so the dependencies' versions (and their CVEs) are known", + eco.manifest, eco.problem, eco.remedy + ), + ) + .await; + } + // Stage 3: CVE Scanning tracing::info!("[{repo_id}] Stage 3: CVE Scanning"); self.update_phase(scan_run_id, ScanPhase::CveScanning).await; diff --git a/compliance-agent/src/pipeline/sbom/mod.rs b/compliance-agent/src/pipeline/sbom/mod.rs index 39b24e7..6704c35 100644 --- a/compliance-agent/src/pipeline/sbom/mod.rs +++ b/compliance-agent/src/pipeline/sbom/mod.rs @@ -57,6 +57,84 @@ impl Scanner for SbomScanner { } } +/// An ecosystem whose manifest is present while the lockfile that pins its +/// versions is not, even after [`generate_lockfiles`] had its chance (it may +/// not run here, or it may have failed). Syft reports nothing for it, so the +/// SBOM would be silently short of those dependencies. +pub(crate) struct UnlockedEcosystem { + /// What the tree declares (`package.json`, `pyproject.toml`). + pub manifest: &'static str, + /// Why its versions were not read. + pub problem: &'static str, + /// What to commit so they are. + pub remedy: &'static str, +} + +/// Lockfiles that pin an npm-registry project. Bun's count: npm must never +/// re-resolve a project another package manager already locked, or the SBOM +/// reports npm's fresh resolution instead of the versions the project ships. +const NPM_LOCKFILES: &[&str] = &[ + "package-lock.json", + "npm-shrinkwrap.json", + "yarn.lock", + "pnpm-lock.yaml", + "bun.lock", + "bun.lockb", +]; + +/// The ecosystems in `repo_path` that declare dependencies but pin none. Call it +/// after [`generate_lockfiles`]: it reads the tree as Syft will see it, so a +/// lockfile that was generated counts and one that could not be does not. An +/// empty result means every manifest present is backed by a lockfile. +pub(crate) fn unlocked_ecosystems(repo_path: &Path) -> Vec { + let has = |name: &str| repo_path.join(name).exists(); + let mut out = Vec::new(); + if has("package.json") { + let readable = NPM_LOCKFILES + .iter() + .filter(|f| **f != "bun.lockb") + .any(|f| has(f)); + if has("bun.lockb") && !readable { + // Bun's binary lockfile is opaque to the SBOM tooling; its text + // successor (the default since Bun 1.2) is read. + out.push(UnlockedEcosystem { + manifest: "package.json", + problem: "is locked only by bun.lockb, Bun's binary lockfile, which is not read", + remedy: "commit the text bun.lock (`bun install --save-text-lockfile`)", + }); + } else if !readable { + out.push(UnlockedEcosystem { + manifest: "package.json", + problem: "declares dependencies but no lockfile pins them", + remedy: "commit package-lock.json, yarn.lock, pnpm-lock.yaml or bun.lock", + }); + } + } + let python_manifest = ["pyproject.toml", "setup.py", "setup.cfg"] + .into_iter() + .find(|f| has(f)); + if let Some(manifest) = python_manifest { + if !["requirements.txt", "poetry.lock", "Pipfile.lock", "uv.lock"] + .iter() + .any(|f| has(f)) + { + out.push(UnlockedEcosystem { + manifest, + problem: "declares dependencies but no lockfile pins them", + remedy: "commit requirements.txt, poetry.lock, Pipfile.lock or uv.lock", + }); + } + } + if has("Cargo.toml") && !has("Cargo.lock") { + out.push(UnlockedEcosystem { + manifest: "Cargo.toml", + problem: "declares dependencies but no lockfile pins them", + remedy: "commit Cargo.lock", + }); + } + out +} + /// Generate missing lock files so Syft can resolve the full dependency tree. /// This handles repos that gitignore their lock files (common for Rust libraries). #[tracing::instrument(skip_all)] @@ -121,9 +199,7 @@ async fn generate_lockfiles(repo_path: &Path, exec: ExecPolicy) { } // npm: generate package-lock.json if package.json exists without it - let has_npm_lock = repo_path.join("package-lock.json").exists() - || repo_path.join("yarn.lock").exists() - || repo_path.join("pnpm-lock.yaml").exists(); + let has_npm_lock = NPM_LOCKFILES.iter().any(|f| repo_path.join(f).exists()); if repo_path.join("package.json").exists() && !has_npm_lock { tracing::info!("generating package-lock.json for SBOM scan"); // `--package-lock-only --ignore-scripts`: resolve versions, write the @@ -238,3 +314,83 @@ struct CargoPackage { version: String, license: Option, } + +#[cfg(test)] +#[allow(clippy::expect_used, clippy::unwrap_used)] +mod unlocked_tests { + use super::*; + + /// A scratch tree holding `files`, removed on drop. + struct Tree(std::path::PathBuf); + impl Tree { + fn new(files: &[&str]) -> Self { + let dir = std::env::temp_dir().join(format!("cs-unlocked-{}", uuid::Uuid::new_v4())); + std::fs::create_dir_all(&dir).expect("mkdir"); + for f in files { + std::fs::write(dir.join(f), "").expect("write"); + } + Tree(dir) + } + } + impl Drop for Tree { + fn drop(&mut self) { + let _ = std::fs::remove_dir_all(&self.0); + } + } + + fn names(tree: &Tree) -> Vec<&'static str> { + unlocked_ecosystems(&tree.0) + .into_iter() + .map(|e| e.manifest) + .collect() + } + + #[test] + fn a_manifest_without_its_lockfile_is_reported() { + assert_eq!(names(&Tree::new(&["package.json"])), ["package.json"]); + assert_eq!(names(&Tree::new(&["pyproject.toml"])), ["pyproject.toml"]); + assert_eq!(names(&Tree::new(&["Cargo.toml"])), ["Cargo.toml"]); + } + + #[test] + fn any_lockfile_of_the_ecosystem_counts() { + for lock in [ + "package-lock.json", + "yarn.lock", + "pnpm-lock.yaml", + "bun.lock", + ] { + assert!( + names(&Tree::new(&["package.json", lock])).is_empty(), + "{lock}" + ); + } + for lock in ["requirements.txt", "poetry.lock", "Pipfile.lock", "uv.lock"] { + assert!( + names(&Tree::new(&["pyproject.toml", lock])).is_empty(), + "{lock}" + ); + } + } + + #[test] + fn a_binary_bun_lockfile_is_named_as_unread() { + let tree = Tree::new(&["package.json", "bun.lockb"]); + let found = unlocked_ecosystems(&tree.0); + assert_eq!(found.len(), 1); + assert!( + found[0].problem.contains("bun.lockb"), + "{}", + found[0].problem + ); + assert!(found[0].remedy.contains("bun.lock"), "{}", found[0].remedy); + // With the text lockfile beside it, the binary one does not matter. + let both = Tree::new(&["package.json", "bun.lockb", "bun.lock"]); + assert!(names(&both).is_empty()); + } + + #[test] + fn a_tree_without_manifests_reports_nothing() { + assert!(names(&Tree::new(&["README.md"])).is_empty()); + } +} diff --git a/compliance-agent/tests/nightly.rs b/compliance-agent/tests/nightly.rs index ea869b3..c5abfd8 100644 --- a/compliance-agent/tests/nightly.rs +++ b/compliance-agent/tests/nightly.rs @@ -378,6 +378,7 @@ async fn collect(agent: &Agent, target_id: &str, run: &Value) -> Collected { .get(&format!("/api/v1/targets/{target_id}/applicable-scans")) .await["data"] .clone(); + let graph = agent.get(&format!("/api/v1/graph/{target_id}")).await["data"].clone(); let mut snapshot = Snapshot { scan_status: text(run, "status"), @@ -469,6 +470,7 @@ async fn collect(agent: &Agent, target_id: &str, run: &Value) -> Collected { .map(|s| text(s, "scan")) .collect(); observed.pentest_supported = scans["pentest_supported"].as_bool(); + observed.graph_nodes = graph["total_nodes"].as_u64().unwrap_or(0); Collected { snapshot, observed } } diff --git a/fixtures/nightly/baselines/fw-cargo-embedded.json b/fixtures/nightly/baselines/fw-cargo-embedded.json index 4900dd9..b00fb12 100644 --- a/fixtures/nightly/baselines/fw-cargo-embedded.json +++ b/fixtures/nightly/baselines/fw-cargo-embedded.json @@ -1,6 +1,8 @@ { "scan_status": "completed", - "skipped_stages": [], + "skipped_stages": [ + "sbom_dependencies" + ], "sbom": [ "toolchain:rustc@1.82.0" ], diff --git a/fixtures/nightly/baselines/js-bun-binary.json b/fixtures/nightly/baselines/js-bun-binary.json new file mode 100644 index 0000000..3e52135 --- /dev/null +++ b/fixtures/nightly/baselines/js-bun-binary.json @@ -0,0 +1,17 @@ +{ + "scan_status": "completed", + "skipped_stages": [ + "sbom_dependencies" + ], + "sbom": [], + "findings": [ + "gitleaks:generic-api-key session.ts:8", + "gitleaks:npm-access-token .env.local:3", + "gitleaks:stripe-access-token .env.local:2" + ], + "cves": [], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key" + ] +} diff --git a/fixtures/nightly/baselines/js-bun.json b/fixtures/nightly/baselines/js-bun.json new file mode 100644 index 0000000..48afffc --- /dev/null +++ b/fixtures/nightly/baselines/js-bun.json @@ -0,0 +1,54 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "npm:axios@0.21.1", + "npm:express@4.17.1", + "npm:lodash@4.17.20" + ], + "findings": [ + "gitleaks:generic-api-key session.ts:8", + "gitleaks:npm-access-token .env.local:3", + "gitleaks:stripe-access-token .env.local:2" + ], + "cves": [ + "GHSA-29mw-wpgm-hmr9", + "GHSA-35jh-r3h4-6jhm", + "GHSA-3g43-6gmg-66jw", + "GHSA-3p68-rc4w-qgx5", + "GHSA-43fc-jf86-j433", + "GHSA-5c9x-8gcm-mpgx", + "GHSA-62hf-57xw-28j9", + "GHSA-6chq-wfr3-2hj9", + "GHSA-7q8q-rj6j-mhjq", + "GHSA-898c-q2cr-xwhg", + "GHSA-cph5-m8f7-6c5x", + "GHSA-f23m-r3pf-42rh", + "GHSA-fvcv-3m26-pcqx", + "GHSA-hfxv-24rg-xrqf", + "GHSA-j5f8-grm9-p9fc", + "GHSA-jr5f-v2jv-69x6", + "GHSA-m7pr-hjqh-92cm", + "GHSA-mmx7-hfxf-jppx", + "GHSA-p92q-9vqr-4j8v", + "GHSA-pf86-5x62-jrwf", + "GHSA-pjwm-pj3p-43mv", + "GHSA-pmwg-cvhr-8vh7", + "GHSA-qw6h-vgh9-j6wx", + "GHSA-r5fr-rjxr-66jc", + "GHSA-rv95-896h-c2vc", + "GHSA-vf2m-468p-8v99", + "GHSA-w9j2-pvgh-6h63", + "GHSA-wf5p-g6vw-rhxx", + "GHSA-xhjh-pmcv-23jw", + "GHSA-xx6v-rp6x-q39c", + "GHSA-xxjr-mmjv-4gpg" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key", + "javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf-middleware-usage", + "javascript.express.security.audit.xss.direct-response-write.direct-response-write", + "javascript.express.security.injection.raw-html-format.raw-html-format" + ] +} diff --git a/fixtures/nightly/baselines/js-no-lockfile.json b/fixtures/nightly/baselines/js-no-lockfile.json new file mode 100644 index 0000000..1248b57 --- /dev/null +++ b/fixtures/nightly/baselines/js-no-lockfile.json @@ -0,0 +1,27 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "npm:checkout-no-lockfile@2.1.0", + "npm:lodash@4.17.20", + "npm:minimist@1.2.0" + ], + "findings": [ + "gitleaks:generic-api-key session.ts:8", + "gitleaks:npm-access-token .env.local:3", + "gitleaks:stripe-access-token .env.local:2" + ], + "cves": [ + "GHSA-29mw-wpgm-hmr9", + "GHSA-35jh-r3h4-6jhm", + "GHSA-f23m-r3pf-42rh", + "GHSA-r5fr-rjxr-66jc", + "GHSA-vh95-rmgr-6w4m", + "GHSA-xvch-5gv4-984h", + "GHSA-xxjr-mmjv-4gpg" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key" + ] +} diff --git a/fixtures/nightly/baselines/js-npm-lock-v3.json b/fixtures/nightly/baselines/js-npm-lock-v3.json new file mode 100644 index 0000000..4b51abc --- /dev/null +++ b/fixtures/nightly/baselines/js-npm-lock-v3.json @@ -0,0 +1,55 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "npm:axios@0.21.1", + "npm:checkout-npm-lock-v3@2.1.0", + "npm:express@4.17.1", + "npm:lodash@4.17.20" + ], + "findings": [ + "gitleaks:generic-api-key session.ts:8", + "gitleaks:npm-access-token .env.local:3", + "gitleaks:stripe-access-token .env.local:2" + ], + "cves": [ + "GHSA-29mw-wpgm-hmr9", + "GHSA-35jh-r3h4-6jhm", + "GHSA-3g43-6gmg-66jw", + "GHSA-3p68-rc4w-qgx5", + "GHSA-43fc-jf86-j433", + "GHSA-5c9x-8gcm-mpgx", + "GHSA-62hf-57xw-28j9", + "GHSA-6chq-wfr3-2hj9", + "GHSA-7q8q-rj6j-mhjq", + "GHSA-898c-q2cr-xwhg", + "GHSA-cph5-m8f7-6c5x", + "GHSA-f23m-r3pf-42rh", + "GHSA-fvcv-3m26-pcqx", + "GHSA-hfxv-24rg-xrqf", + "GHSA-j5f8-grm9-p9fc", + "GHSA-jr5f-v2jv-69x6", + "GHSA-m7pr-hjqh-92cm", + "GHSA-mmx7-hfxf-jppx", + "GHSA-p92q-9vqr-4j8v", + "GHSA-pf86-5x62-jrwf", + "GHSA-pjwm-pj3p-43mv", + "GHSA-pmwg-cvhr-8vh7", + "GHSA-qw6h-vgh9-j6wx", + "GHSA-r5fr-rjxr-66jc", + "GHSA-rv95-896h-c2vc", + "GHSA-vf2m-468p-8v99", + "GHSA-w9j2-pvgh-6h63", + "GHSA-wf5p-g6vw-rhxx", + "GHSA-xhjh-pmcv-23jw", + "GHSA-xx6v-rp6x-q39c", + "GHSA-xxjr-mmjv-4gpg" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key", + "javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf-middleware-usage", + "javascript.express.security.audit.xss.direct-response-write.direct-response-write", + "javascript.express.security.injection.raw-html-format.raw-html-format" + ] +} diff --git a/fixtures/nightly/baselines/js-pnpm.json b/fixtures/nightly/baselines/js-pnpm.json new file mode 100644 index 0000000..48afffc --- /dev/null +++ b/fixtures/nightly/baselines/js-pnpm.json @@ -0,0 +1,54 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "npm:axios@0.21.1", + "npm:express@4.17.1", + "npm:lodash@4.17.20" + ], + "findings": [ + "gitleaks:generic-api-key session.ts:8", + "gitleaks:npm-access-token .env.local:3", + "gitleaks:stripe-access-token .env.local:2" + ], + "cves": [ + "GHSA-29mw-wpgm-hmr9", + "GHSA-35jh-r3h4-6jhm", + "GHSA-3g43-6gmg-66jw", + "GHSA-3p68-rc4w-qgx5", + "GHSA-43fc-jf86-j433", + "GHSA-5c9x-8gcm-mpgx", + "GHSA-62hf-57xw-28j9", + "GHSA-6chq-wfr3-2hj9", + "GHSA-7q8q-rj6j-mhjq", + "GHSA-898c-q2cr-xwhg", + "GHSA-cph5-m8f7-6c5x", + "GHSA-f23m-r3pf-42rh", + "GHSA-fvcv-3m26-pcqx", + "GHSA-hfxv-24rg-xrqf", + "GHSA-j5f8-grm9-p9fc", + "GHSA-jr5f-v2jv-69x6", + "GHSA-m7pr-hjqh-92cm", + "GHSA-mmx7-hfxf-jppx", + "GHSA-p92q-9vqr-4j8v", + "GHSA-pf86-5x62-jrwf", + "GHSA-pjwm-pj3p-43mv", + "GHSA-pmwg-cvhr-8vh7", + "GHSA-qw6h-vgh9-j6wx", + "GHSA-r5fr-rjxr-66jc", + "GHSA-rv95-896h-c2vc", + "GHSA-vf2m-468p-8v99", + "GHSA-w9j2-pvgh-6h63", + "GHSA-wf5p-g6vw-rhxx", + "GHSA-xhjh-pmcv-23jw", + "GHSA-xx6v-rp6x-q39c", + "GHSA-xxjr-mmjv-4gpg" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key", + "javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf-middleware-usage", + "javascript.express.security.audit.xss.direct-response-write.direct-response-write", + "javascript.express.security.injection.raw-html-format.raw-html-format" + ] +} diff --git a/fixtures/nightly/baselines/js-yarn-berry.json b/fixtures/nightly/baselines/js-yarn-berry.json new file mode 100644 index 0000000..619626c --- /dev/null +++ b/fixtures/nightly/baselines/js-yarn-berry.json @@ -0,0 +1,55 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "npm:axios@0.21.1", + "npm:express@4.17.1", + "npm:lodash@4.17.20" + ], + "findings": [ + "gitleaks:generic-api-key session.ts:8", + "gitleaks:npm-access-token .env.local:3", + "gitleaks:stripe-access-token .env.local:2" + ], + "cves": [ + "GHSA-29mw-wpgm-hmr9", + "GHSA-35jh-r3h4-6jhm", + "GHSA-3g43-6gmg-66jw", + "GHSA-3p68-rc4w-qgx5", + "GHSA-43fc-jf86-j433", + "GHSA-5c9x-8gcm-mpgx", + "GHSA-62hf-57xw-28j9", + "GHSA-6chq-wfr3-2hj9", + "GHSA-7q8q-rj6j-mhjq", + "GHSA-898c-q2cr-xwhg", + "GHSA-cph5-m8f7-6c5x", + "GHSA-f23m-r3pf-42rh", + "GHSA-fvcv-3m26-pcqx", + "GHSA-hfxv-24rg-xrqf", + "GHSA-j5f8-grm9-p9fc", + "GHSA-jr5f-v2jv-69x6", + "GHSA-m7pr-hjqh-92cm", + "GHSA-mmx7-hfxf-jppx", + "GHSA-p92q-9vqr-4j8v", + "GHSA-pf86-5x62-jrwf", + "GHSA-pjwm-pj3p-43mv", + "GHSA-pmwg-cvhr-8vh7", + "GHSA-qw6h-vgh9-j6wx", + "GHSA-r5fr-rjxr-66jc", + "GHSA-rv95-896h-c2vc", + "GHSA-vf2m-468p-8v99", + "GHSA-w9j2-pvgh-6h63", + "GHSA-wf5p-g6vw-rhxx", + "GHSA-xhjh-pmcv-23jw", + "GHSA-xx6v-rp6x-q39c", + "GHSA-xxjr-mmjv-4gpg" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key", + "javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf-middleware-usage", + "javascript.express.security.audit.xss.direct-response-write.direct-response-write", + "javascript.express.security.injection.raw-html-format.raw-html-format", + "package_managers.yarn.yarn-missing-minimal-age-gate.yarn-missing-minimal-age-gate" + ] +} diff --git a/fixtures/nightly/baselines/js-yarn-classic.json b/fixtures/nightly/baselines/js-yarn-classic.json new file mode 100644 index 0000000..48afffc --- /dev/null +++ b/fixtures/nightly/baselines/js-yarn-classic.json @@ -0,0 +1,54 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "npm:axios@0.21.1", + "npm:express@4.17.1", + "npm:lodash@4.17.20" + ], + "findings": [ + "gitleaks:generic-api-key session.ts:8", + "gitleaks:npm-access-token .env.local:3", + "gitleaks:stripe-access-token .env.local:2" + ], + "cves": [ + "GHSA-29mw-wpgm-hmr9", + "GHSA-35jh-r3h4-6jhm", + "GHSA-3g43-6gmg-66jw", + "GHSA-3p68-rc4w-qgx5", + "GHSA-43fc-jf86-j433", + "GHSA-5c9x-8gcm-mpgx", + "GHSA-62hf-57xw-28j9", + "GHSA-6chq-wfr3-2hj9", + "GHSA-7q8q-rj6j-mhjq", + "GHSA-898c-q2cr-xwhg", + "GHSA-cph5-m8f7-6c5x", + "GHSA-f23m-r3pf-42rh", + "GHSA-fvcv-3m26-pcqx", + "GHSA-hfxv-24rg-xrqf", + "GHSA-j5f8-grm9-p9fc", + "GHSA-jr5f-v2jv-69x6", + "GHSA-m7pr-hjqh-92cm", + "GHSA-mmx7-hfxf-jppx", + "GHSA-p92q-9vqr-4j8v", + "GHSA-pf86-5x62-jrwf", + "GHSA-pjwm-pj3p-43mv", + "GHSA-pmwg-cvhr-8vh7", + "GHSA-qw6h-vgh9-j6wx", + "GHSA-r5fr-rjxr-66jc", + "GHSA-rv95-896h-c2vc", + "GHSA-vf2m-468p-8v99", + "GHSA-w9j2-pvgh-6h63", + "GHSA-wf5p-g6vw-rhxx", + "GHSA-xhjh-pmcv-23jw", + "GHSA-xx6v-rp6x-q39c", + "GHSA-xxjr-mmjv-4gpg" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "generic.secrets.security.detected-stripe-api-key.detected-stripe-api-key", + "javascript.express.security.audit.express-check-csurf-middleware-usage.express-check-csurf-middleware-usage", + "javascript.express.security.audit.xss.direct-response-write.direct-response-write", + "javascript.express.security.injection.raw-html-format.raw-html-format" + ] +} diff --git a/fixtures/nightly/baselines/py-bare-pyproject.json b/fixtures/nightly/baselines/py-bare-pyproject.json new file mode 100644 index 0000000..188fd29 --- /dev/null +++ b/fixtures/nightly/baselines/py-bare-pyproject.json @@ -0,0 +1,24 @@ +{ + "scan_status": "completed", + "skipped_stages": [ + "sbom_dependencies" + ], + "sbom": [], + "findings": [ + "gitleaks:generic-api-key auth.py:7", + "gitleaks:gitlab-pat service.env:4", + "ruff:E722 app.py:45", + "ruff:F401 app.py:4", + "semgrep:cra-ai-1-tls-verify-disabled auth.py:12" + ], + "cves": [], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "python.flask.security.injection.subprocess-injection.subprocess-injection", + "python.flask.security.insecure-deserialization.insecure-deserialization", + "python.lang.security.audit.subprocess-shell-true.subprocess-shell-true", + "python.lang.security.dangerous-subprocess-use.dangerous-subprocess-use", + "python.lang.security.deserialization.avoid-pyyaml-load.avoid-pyyaml-load", + "python.requests.security.disabled-cert-validation.disabled-cert-validation" + ] +} diff --git a/fixtures/nightly/baselines/py-pipenv.json b/fixtures/nightly/baselines/py-pipenv.json new file mode 100644 index 0000000..286b0ee --- /dev/null +++ b/fixtures/nightly/baselines/py-pipenv.json @@ -0,0 +1,78 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "pip:jinja2@2.10", + "pip:pyyaml@5.1", + "pip:requests@2.19.1", + "pip:urllib3@1.24.1" + ], + "findings": [ + "gitleaks:generic-api-key auth.py:7", + "gitleaks:gitlab-pat service.env:4", + "semgrep:cra-ai-1-tls-verify-disabled auth.py:12" + ], + "cves": [ + "GHSA-2xpw-w6gg-jr37", + "GHSA-34jh-p97f-mpxf", + "GHSA-38jv-5279-wg99", + "GHSA-3pqx-4fqf-j49f", + "GHSA-462w-v97r-4m45", + "GHSA-6757-jp84-gxfx", + "GHSA-8q59-q68h-6hv4", + "GHSA-9hjg-9r4m-mvj7", + "GHSA-9wx4-h78v-vm56", + "GHSA-cpwx-vrp4-4pq7", + "GHSA-g3rq-g295-4j3m", + "GHSA-g4mx-q9vg-27p4", + "GHSA-gc5v-m9x4-r6x2", + "GHSA-gm62-xv2j-4w53", + "GHSA-gwvm-45gx-3cf8", + "GHSA-h5c8-rqwp-cp95", + "GHSA-h75v-3vvj-5mfj", + "GHSA-j8r2-6x86-q33q", + "GHSA-mh33-7rrq-662w", + "GHSA-pq67-6m6q-mj2v", + "GHSA-q2x7-8rv6-6q7h", + "GHSA-qccp-gfcp-xxvc", + "GHSA-r64q-w8jr-g9qp", + "GHSA-v845-jxx5-vc9f", + "GHSA-wqvq-5m8c-6g24", + "GHSA-x84v-xcm2-53pg", + "PYSEC-2018-28", + "PYSEC-2019-132", + "PYSEC-2019-133", + "PYSEC-2019-217", + "PYSEC-2020-148", + "PYSEC-2020-176", + "PYSEC-2020-96", + "PYSEC-2021-142", + "PYSEC-2021-66", + "PYSEC-2023-192", + "PYSEC-2023-207", + "PYSEC-2023-212", + "PYSEC-2023-74", + "PYSEC-2026-141", + "PYSEC-2026-1471", + "PYSEC-2026-1473", + "PYSEC-2026-1474", + "PYSEC-2026-1475", + "PYSEC-2026-1872", + "PYSEC-2026-1873", + "PYSEC-2026-1994", + "PYSEC-2026-1995", + "PYSEC-2026-1996", + "PYSEC-2026-1998", + "PYSEC-2026-1999", + "PYSEC-2026-2275" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "python.flask.security.injection.subprocess-injection.subprocess-injection", + "python.flask.security.insecure-deserialization.insecure-deserialization", + "python.lang.security.audit.subprocess-shell-true.subprocess-shell-true", + "python.lang.security.dangerous-subprocess-use.dangerous-subprocess-use", + "python.lang.security.deserialization.avoid-pyyaml-load.avoid-pyyaml-load", + "python.requests.security.disabled-cert-validation.disabled-cert-validation" + ] +} diff --git a/fixtures/nightly/baselines/py-poetry.json b/fixtures/nightly/baselines/py-poetry.json new file mode 100644 index 0000000..7fd27b3 --- /dev/null +++ b/fixtures/nightly/baselines/py-poetry.json @@ -0,0 +1,80 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "pip:jinja2@2.10", + "pip:pyyaml@5.1", + "pip:requests@2.19.1", + "pip:urllib3@1.24.1" + ], + "findings": [ + "gitleaks:generic-api-key auth.py:7", + "gitleaks:gitlab-pat service.env:4", + "ruff:E722 app.py:45", + "ruff:F401 app.py:4", + "semgrep:cra-ai-1-tls-verify-disabled auth.py:12" + ], + "cves": [ + "GHSA-2xpw-w6gg-jr37", + "GHSA-34jh-p97f-mpxf", + "GHSA-38jv-5279-wg99", + "GHSA-3pqx-4fqf-j49f", + "GHSA-462w-v97r-4m45", + "GHSA-6757-jp84-gxfx", + "GHSA-8q59-q68h-6hv4", + "GHSA-9hjg-9r4m-mvj7", + "GHSA-9wx4-h78v-vm56", + "GHSA-cpwx-vrp4-4pq7", + "GHSA-g3rq-g295-4j3m", + "GHSA-g4mx-q9vg-27p4", + "GHSA-gc5v-m9x4-r6x2", + "GHSA-gm62-xv2j-4w53", + "GHSA-gwvm-45gx-3cf8", + "GHSA-h5c8-rqwp-cp95", + "GHSA-h75v-3vvj-5mfj", + "GHSA-j8r2-6x86-q33q", + "GHSA-mh33-7rrq-662w", + "GHSA-pq67-6m6q-mj2v", + "GHSA-q2x7-8rv6-6q7h", + "GHSA-qccp-gfcp-xxvc", + "GHSA-r64q-w8jr-g9qp", + "GHSA-v845-jxx5-vc9f", + "GHSA-wqvq-5m8c-6g24", + "GHSA-x84v-xcm2-53pg", + "PYSEC-2018-28", + "PYSEC-2019-132", + "PYSEC-2019-133", + "PYSEC-2019-217", + "PYSEC-2020-148", + "PYSEC-2020-176", + "PYSEC-2020-96", + "PYSEC-2021-142", + "PYSEC-2021-66", + "PYSEC-2023-192", + "PYSEC-2023-207", + "PYSEC-2023-212", + "PYSEC-2023-74", + "PYSEC-2026-141", + "PYSEC-2026-1471", + "PYSEC-2026-1473", + "PYSEC-2026-1474", + "PYSEC-2026-1475", + "PYSEC-2026-1872", + "PYSEC-2026-1873", + "PYSEC-2026-1994", + "PYSEC-2026-1995", + "PYSEC-2026-1996", + "PYSEC-2026-1998", + "PYSEC-2026-1999", + "PYSEC-2026-2275" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "python.flask.security.injection.subprocess-injection.subprocess-injection", + "python.flask.security.insecure-deserialization.insecure-deserialization", + "python.lang.security.audit.subprocess-shell-true.subprocess-shell-true", + "python.lang.security.dangerous-subprocess-use.dangerous-subprocess-use", + "python.lang.security.deserialization.avoid-pyyaml-load.avoid-pyyaml-load", + "python.requests.security.disabled-cert-validation.disabled-cert-validation" + ] +} diff --git a/fixtures/nightly/baselines/py-requirements.json b/fixtures/nightly/baselines/py-requirements.json new file mode 100644 index 0000000..7fd27b3 --- /dev/null +++ b/fixtures/nightly/baselines/py-requirements.json @@ -0,0 +1,80 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "pip:jinja2@2.10", + "pip:pyyaml@5.1", + "pip:requests@2.19.1", + "pip:urllib3@1.24.1" + ], + "findings": [ + "gitleaks:generic-api-key auth.py:7", + "gitleaks:gitlab-pat service.env:4", + "ruff:E722 app.py:45", + "ruff:F401 app.py:4", + "semgrep:cra-ai-1-tls-verify-disabled auth.py:12" + ], + "cves": [ + "GHSA-2xpw-w6gg-jr37", + "GHSA-34jh-p97f-mpxf", + "GHSA-38jv-5279-wg99", + "GHSA-3pqx-4fqf-j49f", + "GHSA-462w-v97r-4m45", + "GHSA-6757-jp84-gxfx", + "GHSA-8q59-q68h-6hv4", + "GHSA-9hjg-9r4m-mvj7", + "GHSA-9wx4-h78v-vm56", + "GHSA-cpwx-vrp4-4pq7", + "GHSA-g3rq-g295-4j3m", + "GHSA-g4mx-q9vg-27p4", + "GHSA-gc5v-m9x4-r6x2", + "GHSA-gm62-xv2j-4w53", + "GHSA-gwvm-45gx-3cf8", + "GHSA-h5c8-rqwp-cp95", + "GHSA-h75v-3vvj-5mfj", + "GHSA-j8r2-6x86-q33q", + "GHSA-mh33-7rrq-662w", + "GHSA-pq67-6m6q-mj2v", + "GHSA-q2x7-8rv6-6q7h", + "GHSA-qccp-gfcp-xxvc", + "GHSA-r64q-w8jr-g9qp", + "GHSA-v845-jxx5-vc9f", + "GHSA-wqvq-5m8c-6g24", + "GHSA-x84v-xcm2-53pg", + "PYSEC-2018-28", + "PYSEC-2019-132", + "PYSEC-2019-133", + "PYSEC-2019-217", + "PYSEC-2020-148", + "PYSEC-2020-176", + "PYSEC-2020-96", + "PYSEC-2021-142", + "PYSEC-2021-66", + "PYSEC-2023-192", + "PYSEC-2023-207", + "PYSEC-2023-212", + "PYSEC-2023-74", + "PYSEC-2026-141", + "PYSEC-2026-1471", + "PYSEC-2026-1473", + "PYSEC-2026-1474", + "PYSEC-2026-1475", + "PYSEC-2026-1872", + "PYSEC-2026-1873", + "PYSEC-2026-1994", + "PYSEC-2026-1995", + "PYSEC-2026-1996", + "PYSEC-2026-1998", + "PYSEC-2026-1999", + "PYSEC-2026-2275" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "python.flask.security.injection.subprocess-injection.subprocess-injection", + "python.flask.security.insecure-deserialization.insecure-deserialization", + "python.lang.security.audit.subprocess-shell-true.subprocess-shell-true", + "python.lang.security.dangerous-subprocess-use.dangerous-subprocess-use", + "python.lang.security.deserialization.avoid-pyyaml-load.avoid-pyyaml-load", + "python.requests.security.disabled-cert-validation.disabled-cert-validation" + ] +} diff --git a/fixtures/nightly/baselines/py-uv.json b/fixtures/nightly/baselines/py-uv.json new file mode 100644 index 0000000..7fd27b3 --- /dev/null +++ b/fixtures/nightly/baselines/py-uv.json @@ -0,0 +1,80 @@ +{ + "scan_status": "completed", + "skipped_stages": [], + "sbom": [ + "pip:jinja2@2.10", + "pip:pyyaml@5.1", + "pip:requests@2.19.1", + "pip:urllib3@1.24.1" + ], + "findings": [ + "gitleaks:generic-api-key auth.py:7", + "gitleaks:gitlab-pat service.env:4", + "ruff:E722 app.py:45", + "ruff:F401 app.py:4", + "semgrep:cra-ai-1-tls-verify-disabled auth.py:12" + ], + "cves": [ + "GHSA-2xpw-w6gg-jr37", + "GHSA-34jh-p97f-mpxf", + "GHSA-38jv-5279-wg99", + "GHSA-3pqx-4fqf-j49f", + "GHSA-462w-v97r-4m45", + "GHSA-6757-jp84-gxfx", + "GHSA-8q59-q68h-6hv4", + "GHSA-9hjg-9r4m-mvj7", + "GHSA-9wx4-h78v-vm56", + "GHSA-cpwx-vrp4-4pq7", + "GHSA-g3rq-g295-4j3m", + "GHSA-g4mx-q9vg-27p4", + "GHSA-gc5v-m9x4-r6x2", + "GHSA-gm62-xv2j-4w53", + "GHSA-gwvm-45gx-3cf8", + "GHSA-h5c8-rqwp-cp95", + "GHSA-h75v-3vvj-5mfj", + "GHSA-j8r2-6x86-q33q", + "GHSA-mh33-7rrq-662w", + "GHSA-pq67-6m6q-mj2v", + "GHSA-q2x7-8rv6-6q7h", + "GHSA-qccp-gfcp-xxvc", + "GHSA-r64q-w8jr-g9qp", + "GHSA-v845-jxx5-vc9f", + "GHSA-wqvq-5m8c-6g24", + "GHSA-x84v-xcm2-53pg", + "PYSEC-2018-28", + "PYSEC-2019-132", + "PYSEC-2019-133", + "PYSEC-2019-217", + "PYSEC-2020-148", + "PYSEC-2020-176", + "PYSEC-2020-96", + "PYSEC-2021-142", + "PYSEC-2021-66", + "PYSEC-2023-192", + "PYSEC-2023-207", + "PYSEC-2023-212", + "PYSEC-2023-74", + "PYSEC-2026-141", + "PYSEC-2026-1471", + "PYSEC-2026-1473", + "PYSEC-2026-1474", + "PYSEC-2026-1475", + "PYSEC-2026-1872", + "PYSEC-2026-1873", + "PYSEC-2026-1994", + "PYSEC-2026-1995", + "PYSEC-2026-1996", + "PYSEC-2026-1998", + "PYSEC-2026-1999", + "PYSEC-2026-2275" + ], + "registry_rules": [ + "generic.secrets.security.detected-generic-secret.detected-generic-secret", + "python.flask.security.injection.subprocess-injection.subprocess-injection", + "python.flask.security.insecure-deserialization.insecure-deserialization", + "python.lang.security.audit.subprocess-shell-true.subprocess-shell-true", + "python.lang.security.dangerous-subprocess-use.dangerous-subprocess-use", + "python.lang.security.deserialization.avoid-pyyaml-load.avoid-pyyaml-load", + "python.requests.security.disabled-cert-validation.disabled-cert-validation" + ] +} diff --git a/fixtures/nightly/eco/README.md b/fixtures/nightly/eco/README.md new file mode 100644 index 0000000..4b6effc --- /dev/null +++ b/fixtures/nightly/eco/README.md @@ -0,0 +1,64 @@ +# Package-manager fixtures (#310) + +One directory per lockfile variant, uploaded as a source archive. They exist to +prove that the SBOM keeps reading each format: a cataloguer that stops +understanding `yarn.lock` or `uv.lock` turns the nightly red instead of quietly +shipping an SBOM that is missing dependencies. + +| Directory | Pins versions through | SBOM | +|---|---|---| +| `js-npm-lock-v3` | `package-lock.json` v3 | 4 npm components | +| `js-yarn-classic` | `yarn.lock` v1 | 3 npm components | +| `js-yarn-berry` | `yarn.lock` with `__metadata` + `npm:` resolutions | 3 npm components | +| `js-pnpm` | `pnpm-lock.yaml` v9 | 3 npm components | +| `js-no-lockfile` | nothing — npm resolves one for the SBOM | 3 npm components | +| `js-bun` | `bun.lock` (Bun's text lockfile, default since 1.2) | 3 npm components | +| `js-bun-binary` | `bun.lockb` only — Bun's binary lockfile, unreadable | none; a recorded `sbom_dependencies` skip | +| `py-requirements` | `requirements.txt` exact pins | 4 pip components | +| `py-poetry` | `poetry.lock` | 4 pip components | +| `py-pipenv` | `Pipfile.lock` | 4 pip components | +| `py-uv` | `uv.lock` | 4 pip components | +| `py-bare-pyproject` | nothing — records a skipped `sbom_dependencies` stage | none | + +`package-lock.json` v2 is covered by `fixtures/nightly/archive` (#325). + +## What each one plants + +Every fixture carries the same shapes, so a variant's baseline differs only in +its SBOM: + +- a **vulnerable pinned dependency** (axios 0.21.1, lodash 4.17.20, express + 4.17.1; requests 2.19.1, PyYAML 5.1, Jinja2 2.10, urllib3 1.24.1), so CVEs + must appear for it; +- a **SAST sink**: request input reaching a shell command and an HTML response + (JS), unsafe YAML deserialisation, `shell=True` and a disabled certificate + check (Python); +- **committed credentials**, all expired and made up, so the secret scanner has + something to find; +- **OAuth client credentials in source** and, in the Python fixtures, **personal + data written to a log**; +- **ruff** violations in the Python fixtures (an unused import and a bare + `except`), which report without executing anything. + +## Bun's binary lockfile + +`bun.lockb` is opaque to the SBOM tooling: Syft reads nothing from it. It used to +be worse than a gap — the scanner did not count it as a lockfile, so it ran +`npm install --package-lock-only` over the Bun project and reported **npm's +fresh resolution** as the project's versions. Bun lockfiles now count as locked, +so npm never re-resolves a project another manager pinned, and a project locked +only by `bun.lockb` records why its dependencies were not read and that the text +`bun.lock` fixes it. The fixture's `bun.lockb` was produced by Bun 1.2.12. + +## The two without a lockfile + +They are not the same case, and the difference is the point: + +- **npm** resolves a lockfile itself, so `js-no-lockfile` still gets an SBOM. Its + dependencies are dependency-free and exactly pinned, so that resolution is the + same every night. (That resolution reads registry configuration out of the + scanned repository — see #330.) +- **Python** resolution would run the project's own build backend, which this + deployment does not do, so `py-bare-pyproject` records a skipped + `sbom_dependencies` stage naming the lockfiles to commit instead of returning + an empty SBOM that looks complete. diff --git a/fixtures/nightly/eco/js-bun-binary/.env.local b/fixtures/nightly/eco/js-bun-binary/.env.local new file mode 100644 index 0000000..6dc90f4 --- /dev/null +++ b/fixtures/nightly/eco/js-bun-binary/.env.local @@ -0,0 +1,3 @@ +# Planted, expired test credentials — not live secrets. +STRIPE_KEY=sk_live_51H8nQeF9bXcVaS2mK4pL7tR3wY6uI0oP9aZxCvBnM1qW2eR3tY4uI5oP6aS7dF8gH9jK0lZ +NPM_TOKEN=npm_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8 diff --git a/fixtures/nightly/eco/js-bun-binary/bun.lockb b/fixtures/nightly/eco/js-bun-binary/bun.lockb new file mode 100755 index 0000000000000000000000000000000000000000..629594b48213625ed66ef0c9db761ea06f837c56 GIT binary patch literal 1585 zcmY#Z)GsYA(of3F(@)JSQ%EY!;{sycoc!eMw9K4T-L(9o+{6;yG6OCq1_lQCg8S2U z9N|{nkl~^GW8zHV@?Dbb+xLDcp1CzWvv2+ZT$Ra&x1|B;b|#f_5}9P$=km78q(G;ZEJk?(R& z+_V2Tc5VLqkyn>Vm@)NH$?Z^mXWx7zbCLbUViyrBdSdC6N4&L9tIhOQh=&{yT(c=f zO7i1&omRtFmQ4}Uc5QZ9mzc#B)#S5tapQe%o4Z#{Qer-{u3pYH`PQ)+$c{w!3k~>m zuxXF>C1qsp99wyZDbZ(Y5{by z8QeZYgo|PM8kUcl7)|sH&Gn277+^UcmeZLS4fTxl41jjLgqjVbxonD4bIVeT^js@S zQj78ubAn5XGV{{WxONJL2p3quT_6E1nr1?2VBi29YlzLQK&u&&Gg6bY^Gi!~L8T$E zbWAL&%qS@-D7MnqFG@`Z7F0!*dU*x8S;cz!Md|u5Kj`binYv(K=#`{b;n4>P6`(E% PLl+t*AYC9w3`PI|(dh{J literal 0 HcmV?d00001 diff --git a/fixtures/nightly/eco/js-bun-binary/package.json b/fixtures/nightly/eco/js-bun-binary/package.json new file mode 100644 index 0000000..14f089e --- /dev/null +++ b/fixtures/nightly/eco/js-bun-binary/package.json @@ -0,0 +1 @@ +{"name":"checkout-bun-binary","version":"2.1.0","private":true,"dependencies":{"lodash":"4.17.20","minimist":"1.2.0"}} diff --git a/fixtures/nightly/eco/js-bun-binary/src/cli.js b/fixtures/nightly/eco/js-bun-binary/src/cli.js new file mode 100644 index 0000000..3a9b108 --- /dev/null +++ b/fixtures/nightly/eco/js-bun-binary/src/cli.js @@ -0,0 +1,14 @@ +// Order export CLI. Planted for the scan regression. +const { exec } = require("child_process"); +const minimist = require("minimist"); +const _ = require("lodash"); + +const argv = minimist(process.argv.slice(2)); + +// Command injection: the customer argument goes into a shell command. +exec("export-orders --customer " + argv.customer, (err, stdout) => { + if (err) { + process.exit(1); + } + console.log(_.truncate(stdout, { length: 500 })); +}); diff --git a/fixtures/nightly/eco/js-bun-binary/src/session.ts b/fixtures/nightly/eco/js-bun-binary/src/session.ts new file mode 100644 index 0000000..094e3df --- /dev/null +++ b/fixtures/nightly/eco/js-bun-binary/src/session.ts @@ -0,0 +1,12 @@ +// Token handling, TypeScript, so the code graph sees a .ts file. +export interface Session { + user: string; + token: string; +} + +// OAuth pattern: a client secret in source. +const OAUTH_CLIENT_SECRET = "9c1e0b7a4f2d4c8e9a0b1c2d3e4f5061"; + +export function authorize(session: Session): string { + return `https://auth.example.com/authorize?client_id=checkout&client_secret=${OAUTH_CLIENT_SECRET}&token=${session.token}`; +} diff --git a/fixtures/nightly/eco/js-bun/.env.local b/fixtures/nightly/eco/js-bun/.env.local new file mode 100644 index 0000000..6dc90f4 --- /dev/null +++ b/fixtures/nightly/eco/js-bun/.env.local @@ -0,0 +1,3 @@ +# Planted, expired test credentials — not live secrets. +STRIPE_KEY=sk_live_51H8nQeF9bXcVaS2mK4pL7tR3wY6uI0oP9aZxCvBnM1qW2eR3tY4uI5oP6aS7dF8gH9jK0lZ +NPM_TOKEN=npm_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8 diff --git a/fixtures/nightly/eco/js-bun/bun.lock b/fixtures/nightly/eco/js-bun/bun.lock new file mode 100644 index 0000000..ec5bb31 --- /dev/null +++ b/fixtures/nightly/eco/js-bun/bun.lock @@ -0,0 +1,20 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "checkout-bun", + "dependencies": { + "axios": "0.21.1", + "express": "4.17.1", + "lodash": "4.17.20", + }, + }, + }, + "packages": { + "axios": ["axios@0.21.1", "", {}, "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA=="], + + "express": ["express@4.17.1", "", {}, "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g=="], + + "lodash": ["lodash@4.17.20", "", {}, "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="], + } +} diff --git a/fixtures/nightly/eco/js-bun/package.json b/fixtures/nightly/eco/js-bun/package.json new file mode 100644 index 0000000..e108946 --- /dev/null +++ b/fixtures/nightly/eco/js-bun/package.json @@ -0,0 +1,10 @@ +{ + "name": "checkout-bun", + "version": "2.1.0", + "private": true, + "dependencies": { + "axios": "0.21.1", + "express": "4.17.1", + "lodash": "4.17.20" + } +} diff --git a/fixtures/nightly/eco/js-bun/src/server.js b/fixtures/nightly/eco/js-bun/src/server.js new file mode 100644 index 0000000..2c83178 --- /dev/null +++ b/fixtures/nightly/eco/js-bun/src/server.js @@ -0,0 +1,18 @@ +// Checkout service. Planted for the scan regression. +const express = require("express"); +const axios = require("axios"); + +const app = express(); + +app.get("/profile", (req, res) => { + // Reflected cross-site scripting: request input echoed into HTML. + res.send("

" + req.query.name + "

"); +}); + +app.get("/fetch", async (req, res) => { + // Server-side request forgery: the URL comes from the request. + const upstream = await axios.get(req.query.url); + res.json(upstream.data); +}); + +app.listen(3000); diff --git a/fixtures/nightly/eco/js-bun/src/session.ts b/fixtures/nightly/eco/js-bun/src/session.ts new file mode 100644 index 0000000..094e3df --- /dev/null +++ b/fixtures/nightly/eco/js-bun/src/session.ts @@ -0,0 +1,12 @@ +// Token handling, TypeScript, so the code graph sees a .ts file. +export interface Session { + user: string; + token: string; +} + +// OAuth pattern: a client secret in source. +const OAUTH_CLIENT_SECRET = "9c1e0b7a4f2d4c8e9a0b1c2d3e4f5061"; + +export function authorize(session: Session): string { + return `https://auth.example.com/authorize?client_id=checkout&client_secret=${OAUTH_CLIENT_SECRET}&token=${session.token}`; +} diff --git a/fixtures/nightly/eco/js-no-lockfile/.env.local b/fixtures/nightly/eco/js-no-lockfile/.env.local new file mode 100644 index 0000000..6dc90f4 --- /dev/null +++ b/fixtures/nightly/eco/js-no-lockfile/.env.local @@ -0,0 +1,3 @@ +# Planted, expired test credentials — not live secrets. +STRIPE_KEY=sk_live_51H8nQeF9bXcVaS2mK4pL7tR3wY6uI0oP9aZxCvBnM1qW2eR3tY4uI5oP6aS7dF8gH9jK0lZ +NPM_TOKEN=npm_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8 diff --git a/fixtures/nightly/eco/js-no-lockfile/package.json b/fixtures/nightly/eco/js-no-lockfile/package.json new file mode 100644 index 0000000..eb8ca37 --- /dev/null +++ b/fixtures/nightly/eco/js-no-lockfile/package.json @@ -0,0 +1,10 @@ +{ + "name": "checkout-no-lockfile", + "version": "2.1.0", + "private": true, + "description": "No lockfile committed: npm resolves one for the SBOM. Dependency-free pins keep that resolution deterministic.", + "dependencies": { + "lodash": "4.17.20", + "minimist": "1.2.0" + } +} diff --git a/fixtures/nightly/eco/js-no-lockfile/src/cli.js b/fixtures/nightly/eco/js-no-lockfile/src/cli.js new file mode 100644 index 0000000..3a9b108 --- /dev/null +++ b/fixtures/nightly/eco/js-no-lockfile/src/cli.js @@ -0,0 +1,14 @@ +// Order export CLI. Planted for the scan regression. +const { exec } = require("child_process"); +const minimist = require("minimist"); +const _ = require("lodash"); + +const argv = minimist(process.argv.slice(2)); + +// Command injection: the customer argument goes into a shell command. +exec("export-orders --customer " + argv.customer, (err, stdout) => { + if (err) { + process.exit(1); + } + console.log(_.truncate(stdout, { length: 500 })); +}); diff --git a/fixtures/nightly/eco/js-no-lockfile/src/session.ts b/fixtures/nightly/eco/js-no-lockfile/src/session.ts new file mode 100644 index 0000000..094e3df --- /dev/null +++ b/fixtures/nightly/eco/js-no-lockfile/src/session.ts @@ -0,0 +1,12 @@ +// Token handling, TypeScript, so the code graph sees a .ts file. +export interface Session { + user: string; + token: string; +} + +// OAuth pattern: a client secret in source. +const OAUTH_CLIENT_SECRET = "9c1e0b7a4f2d4c8e9a0b1c2d3e4f5061"; + +export function authorize(session: Session): string { + return `https://auth.example.com/authorize?client_id=checkout&client_secret=${OAUTH_CLIENT_SECRET}&token=${session.token}`; +} diff --git a/fixtures/nightly/eco/js-npm-lock-v3/.env.local b/fixtures/nightly/eco/js-npm-lock-v3/.env.local new file mode 100644 index 0000000..6dc90f4 --- /dev/null +++ b/fixtures/nightly/eco/js-npm-lock-v3/.env.local @@ -0,0 +1,3 @@ +# Planted, expired test credentials — not live secrets. +STRIPE_KEY=sk_live_51H8nQeF9bXcVaS2mK4pL7tR3wY6uI0oP9aZxCvBnM1qW2eR3tY4uI5oP6aS7dF8gH9jK0lZ +NPM_TOKEN=npm_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8 diff --git a/fixtures/nightly/eco/js-npm-lock-v3/package-lock.json b/fixtures/nightly/eco/js-npm-lock-v3/package-lock.json new file mode 100644 index 0000000..dfdd6ac --- /dev/null +++ b/fixtures/nightly/eco/js-npm-lock-v3/package-lock.json @@ -0,0 +1,32 @@ +{ + "name": "checkout-npm-lock-v3", + "version": "2.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "checkout-npm-lock-v3", + "version": "2.1.0", + "dependencies": { + "axios": "0.21.1", + "express": "4.17.1", + "lodash": "4.17.20" + } + }, + "node_modules/axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==" + }, + "node_modules/express": { + "version": "4.17.1", + "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", + "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==" + }, + "node_modules/lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" + } + } +} diff --git a/fixtures/nightly/eco/js-npm-lock-v3/package.json b/fixtures/nightly/eco/js-npm-lock-v3/package.json new file mode 100644 index 0000000..2bd21b8 --- /dev/null +++ b/fixtures/nightly/eco/js-npm-lock-v3/package.json @@ -0,0 +1,10 @@ +{ + "name": "checkout-npm-lock-v3", + "version": "2.1.0", + "private": true, + "dependencies": { + "axios": "0.21.1", + "express": "4.17.1", + "lodash": "4.17.20" + } +} diff --git a/fixtures/nightly/eco/js-npm-lock-v3/src/server.js b/fixtures/nightly/eco/js-npm-lock-v3/src/server.js new file mode 100644 index 0000000..2c83178 --- /dev/null +++ b/fixtures/nightly/eco/js-npm-lock-v3/src/server.js @@ -0,0 +1,18 @@ +// Checkout service. Planted for the scan regression. +const express = require("express"); +const axios = require("axios"); + +const app = express(); + +app.get("/profile", (req, res) => { + // Reflected cross-site scripting: request input echoed into HTML. + res.send("

" + req.query.name + "

"); +}); + +app.get("/fetch", async (req, res) => { + // Server-side request forgery: the URL comes from the request. + const upstream = await axios.get(req.query.url); + res.json(upstream.data); +}); + +app.listen(3000); diff --git a/fixtures/nightly/eco/js-npm-lock-v3/src/session.ts b/fixtures/nightly/eco/js-npm-lock-v3/src/session.ts new file mode 100644 index 0000000..094e3df --- /dev/null +++ b/fixtures/nightly/eco/js-npm-lock-v3/src/session.ts @@ -0,0 +1,12 @@ +// Token handling, TypeScript, so the code graph sees a .ts file. +export interface Session { + user: string; + token: string; +} + +// OAuth pattern: a client secret in source. +const OAUTH_CLIENT_SECRET = "9c1e0b7a4f2d4c8e9a0b1c2d3e4f5061"; + +export function authorize(session: Session): string { + return `https://auth.example.com/authorize?client_id=checkout&client_secret=${OAUTH_CLIENT_SECRET}&token=${session.token}`; +} diff --git a/fixtures/nightly/eco/js-pnpm/.env.local b/fixtures/nightly/eco/js-pnpm/.env.local new file mode 100644 index 0000000..6dc90f4 --- /dev/null +++ b/fixtures/nightly/eco/js-pnpm/.env.local @@ -0,0 +1,3 @@ +# Planted, expired test credentials — not live secrets. +STRIPE_KEY=sk_live_51H8nQeF9bXcVaS2mK4pL7tR3wY6uI0oP9aZxCvBnM1qW2eR3tY4uI5oP6aS7dF8gH9jK0lZ +NPM_TOKEN=npm_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8 diff --git a/fixtures/nightly/eco/js-pnpm/package.json b/fixtures/nightly/eco/js-pnpm/package.json new file mode 100644 index 0000000..6f47f32 --- /dev/null +++ b/fixtures/nightly/eco/js-pnpm/package.json @@ -0,0 +1,10 @@ +{ + "name": "checkout-pnpm", + "version": "2.1.0", + "private": true, + "dependencies": { + "axios": "0.21.1", + "express": "4.17.1", + "lodash": "4.17.20" + } +} diff --git a/fixtures/nightly/eco/js-pnpm/pnpm-lock.yaml b/fixtures/nightly/eco/js-pnpm/pnpm-lock.yaml new file mode 100644 index 0000000..8d98738 --- /dev/null +++ b/fixtures/nightly/eco/js-pnpm/pnpm-lock.yaml @@ -0,0 +1,27 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + .: + dependencies: + axios: + specifier: 0.21.1 + version: 0.21.1 + express: + specifier: 4.17.1 + version: 4.17.1 + lodash: + specifier: 4.17.20 + version: 4.17.20 + +packages: + axios@0.21.1: + resolution: {integrity: sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==} + express@4.17.1: + resolution: {integrity: sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==} + engines: {node: '>= 0.10.0'} + lodash@4.17.20: + resolution: {integrity: sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==} diff --git a/fixtures/nightly/eco/js-pnpm/src/server.js b/fixtures/nightly/eco/js-pnpm/src/server.js new file mode 100644 index 0000000..2c83178 --- /dev/null +++ b/fixtures/nightly/eco/js-pnpm/src/server.js @@ -0,0 +1,18 @@ +// Checkout service. Planted for the scan regression. +const express = require("express"); +const axios = require("axios"); + +const app = express(); + +app.get("/profile", (req, res) => { + // Reflected cross-site scripting: request input echoed into HTML. + res.send("

" + req.query.name + "

"); +}); + +app.get("/fetch", async (req, res) => { + // Server-side request forgery: the URL comes from the request. + const upstream = await axios.get(req.query.url); + res.json(upstream.data); +}); + +app.listen(3000); diff --git a/fixtures/nightly/eco/js-pnpm/src/session.ts b/fixtures/nightly/eco/js-pnpm/src/session.ts new file mode 100644 index 0000000..094e3df --- /dev/null +++ b/fixtures/nightly/eco/js-pnpm/src/session.ts @@ -0,0 +1,12 @@ +// Token handling, TypeScript, so the code graph sees a .ts file. +export interface Session { + user: string; + token: string; +} + +// OAuth pattern: a client secret in source. +const OAUTH_CLIENT_SECRET = "9c1e0b7a4f2d4c8e9a0b1c2d3e4f5061"; + +export function authorize(session: Session): string { + return `https://auth.example.com/authorize?client_id=checkout&client_secret=${OAUTH_CLIENT_SECRET}&token=${session.token}`; +} diff --git a/fixtures/nightly/eco/js-yarn-berry/.env.local b/fixtures/nightly/eco/js-yarn-berry/.env.local new file mode 100644 index 0000000..6dc90f4 --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-berry/.env.local @@ -0,0 +1,3 @@ +# Planted, expired test credentials — not live secrets. +STRIPE_KEY=sk_live_51H8nQeF9bXcVaS2mK4pL7tR3wY6uI0oP9aZxCvBnM1qW2eR3tY4uI5oP6aS7dF8gH9jK0lZ +NPM_TOKEN=npm_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8 diff --git a/fixtures/nightly/eco/js-yarn-berry/.yarnrc.yml b/fixtures/nightly/eco/js-yarn-berry/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-berry/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/fixtures/nightly/eco/js-yarn-berry/package.json b/fixtures/nightly/eco/js-yarn-berry/package.json new file mode 100644 index 0000000..03ca439 --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-berry/package.json @@ -0,0 +1,10 @@ +{ + "name": "checkout-yarn-berry", + "version": "2.1.0", + "private": true, + "dependencies": { + "axios": "0.21.1", + "express": "4.17.1", + "lodash": "4.17.20" + } +} diff --git a/fixtures/nightly/eco/js-yarn-berry/src/server.js b/fixtures/nightly/eco/js-yarn-berry/src/server.js new file mode 100644 index 0000000..2c83178 --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-berry/src/server.js @@ -0,0 +1,18 @@ +// Checkout service. Planted for the scan regression. +const express = require("express"); +const axios = require("axios"); + +const app = express(); + +app.get("/profile", (req, res) => { + // Reflected cross-site scripting: request input echoed into HTML. + res.send("

" + req.query.name + "

"); +}); + +app.get("/fetch", async (req, res) => { + // Server-side request forgery: the URL comes from the request. + const upstream = await axios.get(req.query.url); + res.json(upstream.data); +}); + +app.listen(3000); diff --git a/fixtures/nightly/eco/js-yarn-berry/src/session.ts b/fixtures/nightly/eco/js-yarn-berry/src/session.ts new file mode 100644 index 0000000..094e3df --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-berry/src/session.ts @@ -0,0 +1,12 @@ +// Token handling, TypeScript, so the code graph sees a .ts file. +export interface Session { + user: string; + token: string; +} + +// OAuth pattern: a client secret in source. +const OAUTH_CLIENT_SECRET = "9c1e0b7a4f2d4c8e9a0b1c2d3e4f5061"; + +export function authorize(session: Session): string { + return `https://auth.example.com/authorize?client_id=checkout&client_secret=${OAUTH_CLIENT_SECRET}&token=${session.token}`; +} diff --git a/fixtures/nightly/eco/js-yarn-berry/yarn.lock b/fixtures/nightly/eco/js-yarn-berry/yarn.lock new file mode 100644 index 0000000..7fadd92 --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-berry/yarn.lock @@ -0,0 +1,27 @@ +# This file is generated by running "yarn install" inside your project. +# Manual changes might be lost - proceed with caution! + +__metadata: + version: 8 + cacheKey: 10c0 + +"axios@npm:0.21.1": + version: 0.21.1 + resolution: "axios@npm:0.21.1" + checksum: 10c0/6f3b6b3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a + languageName: node + linkType: hard + +"express@npm:4.17.1": + version: 4.17.1 + resolution: "express@npm:4.17.1" + checksum: 10c0/7f2b8a3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a + languageName: node + linkType: hard + +"lodash@npm:4.17.20": + version: 4.17.20 + resolution: "lodash@npm:4.17.20" + checksum: 10c0/8a3b9c4e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a6b3e4e3e1f3a + languageName: node + linkType: hard diff --git a/fixtures/nightly/eco/js-yarn-classic/.env.local b/fixtures/nightly/eco/js-yarn-classic/.env.local new file mode 100644 index 0000000..6dc90f4 --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-classic/.env.local @@ -0,0 +1,3 @@ +# Planted, expired test credentials — not live secrets. +STRIPE_KEY=sk_live_51H8nQeF9bXcVaS2mK4pL7tR3wY6uI0oP9aZxCvBnM1qW2eR3tY4uI5oP6aS7dF8gH9jK0lZ +NPM_TOKEN=npm_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6Q7r8 diff --git a/fixtures/nightly/eco/js-yarn-classic/package.json b/fixtures/nightly/eco/js-yarn-classic/package.json new file mode 100644 index 0000000..754c7ce --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-classic/package.json @@ -0,0 +1,10 @@ +{ + "name": "checkout-yarn-classic", + "version": "2.1.0", + "private": true, + "dependencies": { + "axios": "0.21.1", + "express": "4.17.1", + "lodash": "4.17.20" + } +} diff --git a/fixtures/nightly/eco/js-yarn-classic/src/server.js b/fixtures/nightly/eco/js-yarn-classic/src/server.js new file mode 100644 index 0000000..2c83178 --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-classic/src/server.js @@ -0,0 +1,18 @@ +// Checkout service. Planted for the scan regression. +const express = require("express"); +const axios = require("axios"); + +const app = express(); + +app.get("/profile", (req, res) => { + // Reflected cross-site scripting: request input echoed into HTML. + res.send("

" + req.query.name + "

"); +}); + +app.get("/fetch", async (req, res) => { + // Server-side request forgery: the URL comes from the request. + const upstream = await axios.get(req.query.url); + res.json(upstream.data); +}); + +app.listen(3000); diff --git a/fixtures/nightly/eco/js-yarn-classic/src/session.ts b/fixtures/nightly/eco/js-yarn-classic/src/session.ts new file mode 100644 index 0000000..094e3df --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-classic/src/session.ts @@ -0,0 +1,12 @@ +// Token handling, TypeScript, so the code graph sees a .ts file. +export interface Session { + user: string; + token: string; +} + +// OAuth pattern: a client secret in source. +const OAUTH_CLIENT_SECRET = "9c1e0b7a4f2d4c8e9a0b1c2d3e4f5061"; + +export function authorize(session: Session): string { + return `https://auth.example.com/authorize?client_id=checkout&client_secret=${OAUTH_CLIENT_SECRET}&token=${session.token}`; +} diff --git a/fixtures/nightly/eco/js-yarn-classic/yarn.lock b/fixtures/nightly/eco/js-yarn-classic/yarn.lock new file mode 100644 index 0000000..0a35899 --- /dev/null +++ b/fixtures/nightly/eco/js-yarn-classic/yarn.lock @@ -0,0 +1,18 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +axios@0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d7cc4cd88f89b0d90e" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + +express@4.17.1: + version "4.17.1" + resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134" + integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g== + +lodash@4.17.20: + version "4.17.20" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" + integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== diff --git a/fixtures/nightly/eco/py-bare-pyproject/app.py b/fixtures/nightly/eco/py-bare-pyproject/app.py new file mode 100644 index 0000000..10b42b8 --- /dev/null +++ b/fixtures/nightly/eco/py-bare-pyproject/app.py @@ -0,0 +1,46 @@ +"""Customer records service. Planted for the scan regression.""" + +import hashlib +import os # noqa-free on purpose: ruff reports this unused import (F401) +import subprocess + +import yaml +from flask import Flask, request + +app = Flask(__name__) + + +@app.route("/import", methods=["POST"]) +def import_records(): + # Unsafe deserialisation: the loader executes tags in the payload. + records = yaml.load(request.data, Loader=yaml.Loader) + # Personal data written to the log (GDPR pattern). + for record in records: + app.logger.info( + "imported %s <%s> national_id=%s", + record["full_name"], + record["email"], + record["national_id"], + ) + return {"imported": len(records)} + + +@app.route("/report") +def report(): + name = request.args.get("customer", "") + # Shell command built from request input. + out = subprocess.check_output("report-for " + name, shell=True) + return out + + +def fingerprint(value: str) -> str: + # Weak hash used as an identifier. + return hashlib.md5(value.encode()).hexdigest() + + +def load_settings(path: str) -> dict: + try: + with open(path) as handle: + return yaml.safe_load(handle) + except: # ruff reports the bare except (E722) + return {} diff --git a/fixtures/nightly/eco/py-bare-pyproject/auth.py b/fixtures/nightly/eco/py-bare-pyproject/auth.py new file mode 100644 index 0000000..6dc2636 --- /dev/null +++ b/fixtures/nightly/eco/py-bare-pyproject/auth.py @@ -0,0 +1,21 @@ +"""Token exchange against the identity provider.""" + +import requests + +# OAuth client credentials in source. +CLIENT_ID = "customer-records" +CLIENT_SECRET = "5f4dcc3b5aa765d61d8327deb882cf99e1a2b3c4" +TOKEN_URL = "https://auth.example.com/oauth2/token" + + +def fetch_token() -> str: + response = requests.post( + TOKEN_URL, + data={ + "grant_type": "client_credentials", + "client_id": CLIENT_ID, + "client_secret": CLIENT_SECRET, + }, + verify=False, # certificate verification disabled + ) + return response.json()["access_token"] diff --git a/fixtures/nightly/eco/py-bare-pyproject/deploy/service.env b/fixtures/nightly/eco/py-bare-pyproject/deploy/service.env new file mode 100644 index 0000000..ac5a4f2 --- /dev/null +++ b/fixtures/nightly/eco/py-bare-pyproject/deploy/service.env @@ -0,0 +1,4 @@ +# Planted, expired test credentials — not live secrets. +AWS_ACCESS_KEY_ID=AKIAIOSFODNN7SCANTEST +AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY +GITLAB_TOKEN=glpat-A1b2C3d4E5f6G7h8I9j0 diff --git a/fixtures/nightly/eco/py-bare-pyproject/pyproject.toml b/fixtures/nightly/eco/py-bare-pyproject/pyproject.toml new file mode 100644 index 0000000..39b716f --- /dev/null +++ b/fixtures/nightly/eco/py-bare-pyproject/pyproject.toml @@ -0,0 +1,10 @@ +[project] +name = "customer-records-bare" +version = "1.2.0" +requires-python = ">=3.11" +dependencies = [ + "requests==2.19.1", +"PyYAML==5.1", +"Jinja2==2.10", +"urllib3==1.24.1", +] diff --git a/fixtures/nightly/eco/py-pipenv/Pipfile b/fixtures/nightly/eco/py-pipenv/Pipfile new file mode 100644 index 0000000..1e9b86b --- /dev/null +++ b/fixtures/nightly/eco/py-pipenv/Pipfile @@ -0,0 +1,13 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +requests = "==2.19.1" +pyyaml = "==5.1" +jinja2 = "==2.10" +urllib3 = "==1.24.1" + +[requires] +python_version = "3.11" diff --git a/fixtures/nightly/eco/py-pipenv/Pipfile.lock b/fixtures/nightly/eco/py-pipenv/Pipfile.lock new file mode 100644 index 0000000..e6f8336 --- /dev/null +++ b/fixtures/nightly/eco/py-pipenv/Pipfile.lock @@ -0,0 +1,37 @@ +{ + "_meta": { + "hash": { + "sha256": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.11" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "requests": { + "index": "pypi", + "version": "==2.19.1" + }, + "pyyaml": { + "index": "pypi", + "version": "==5.1" + }, + "jinja2": { + "index": "pypi", + "version": "==2.10" + }, + "urllib3": { + "index": "pypi", + "version": "==1.24.1" + } + }, + "develop": {} +} diff --git a/fixtures/nightly/eco/py-pipenv/app.py b/fixtures/nightly/eco/py-pipenv/app.py new file mode 100644 index 0000000..10b42b8 --- /dev/null +++ b/fixtures/nightly/eco/py-pipenv/app.py @@ -0,0 +1,46 @@ +"""Customer records service. Planted for the scan regression.""" + +import hashlib +import os # noqa-free on purpose: ruff reports this unused import (F401) +import subprocess + +import yaml +from flask import Flask, request + +app = Flask(__name__) + + +@app.route("/import", methods=["POST"]) +def import_records(): + # Unsafe deserialisation: the loader executes tags in the payload. + records = yaml.load(request.data, Loader=yaml.Loader) + # Personal data written to the log (GDPR pattern). + for record in records: + app.logger.info( + "imported %s <%s> national_id=%s", + record["full_name"], + record["email"], + record["national_id"], + ) + return {"imported": len(records)} + + +@app.route("/report") +def report(): + name = request.args.get("customer", "") + # Shell command built from request input. + out = subprocess.check_output("report-for " + name, shell=True) + return out + + +def fingerprint(value: str) -> str: + # Weak hash used as an identifier. + return hashlib.md5(value.encode()).hexdigest() + + +def load_settings(path: str) -> dict: + try: + with open(path) as handle: + return yaml.safe_load(handle) + except: # ruff reports the bare except (E722) + return {} diff --git a/fixtures/nightly/eco/py-pipenv/auth.py b/fixtures/nightly/eco/py-pipenv/auth.py new file mode 100644 index 0000000..6dc2636 --- /dev/null +++ b/fixtures/nightly/eco/py-pipenv/auth.py @@ -0,0 +1,21 @@ +"""Token exchange against the identity provider.""" + +import requests + +# OAuth client credentials in source. +CLIENT_ID = "customer-records" +CLIENT_SECRET = "5f4dcc3b5aa765d61d8327deb882cf99e1a2b3c4" +TOKEN_URL = "https://auth.example.com/oauth2/token" + + +def fetch_token() -> str: + response = requests.post( + TOKEN_URL, + data={ + "grant_type": "client_credentials", + "client_id": CLIENT_ID, + "client_secret": CLIENT_SECRET, + }, + verify=False, # certificate verification disabled + ) + return response.json()["access_token"] diff --git a/fixtures/nightly/eco/py-pipenv/deploy/service.env b/fixtures/nightly/eco/py-pipenv/deploy/service.env new file mode 100644 index 0000000..ac5a4f2 --- /dev/null +++ b/fixtures/nightly/eco/py-pipenv/deploy/service.env @@ -0,0 +1,4 @@ +# Planted, expired test credentials — not live secrets. +AWS_ACCESS_KEY_ID=AKIAIOSFODNN7SCANTEST +AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY +GITLAB_TOKEN=glpat-A1b2C3d4E5f6G7h8I9j0 diff --git a/fixtures/nightly/eco/py-poetry/app.py b/fixtures/nightly/eco/py-poetry/app.py new file mode 100644 index 0000000..10b42b8 --- /dev/null +++ b/fixtures/nightly/eco/py-poetry/app.py @@ -0,0 +1,46 @@ +"""Customer records service. Planted for the scan regression.""" + +import hashlib +import os # noqa-free on purpose: ruff reports this unused import (F401) +import subprocess + +import yaml +from flask import Flask, request + +app = Flask(__name__) + + +@app.route("/import", methods=["POST"]) +def import_records(): + # Unsafe deserialisation: the loader executes tags in the payload. + records = yaml.load(request.data, Loader=yaml.Loader) + # Personal data written to the log (GDPR pattern). + for record in records: + app.logger.info( + "imported %s <%s> national_id=%s", + record["full_name"], + record["email"], + record["national_id"], + ) + return {"imported": len(records)} + + +@app.route("/report") +def report(): + name = request.args.get("customer", "") + # Shell command built from request input. + out = subprocess.check_output("report-for " + name, shell=True) + return out + + +def fingerprint(value: str) -> str: + # Weak hash used as an identifier. + return hashlib.md5(value.encode()).hexdigest() + + +def load_settings(path: str) -> dict: + try: + with open(path) as handle: + return yaml.safe_load(handle) + except: # ruff reports the bare except (E722) + return {} diff --git a/fixtures/nightly/eco/py-poetry/auth.py b/fixtures/nightly/eco/py-poetry/auth.py new file mode 100644 index 0000000..6dc2636 --- /dev/null +++ b/fixtures/nightly/eco/py-poetry/auth.py @@ -0,0 +1,21 @@ +"""Token exchange against the identity provider.""" + +import requests + +# OAuth client credentials in source. +CLIENT_ID = "customer-records" +CLIENT_SECRET = "5f4dcc3b5aa765d61d8327deb882cf99e1a2b3c4" +TOKEN_URL = "https://auth.example.com/oauth2/token" + + +def fetch_token() -> str: + response = requests.post( + TOKEN_URL, + data={ + "grant_type": "client_credentials", + "client_id": CLIENT_ID, + "client_secret": CLIENT_SECRET, + }, + verify=False, # certificate verification disabled + ) + return response.json()["access_token"] diff --git a/fixtures/nightly/eco/py-poetry/deploy/service.env b/fixtures/nightly/eco/py-poetry/deploy/service.env new file mode 100644 index 0000000..ac5a4f2 --- /dev/null +++ b/fixtures/nightly/eco/py-poetry/deploy/service.env @@ -0,0 +1,4 @@ +# Planted, expired test credentials — not live secrets. +AWS_ACCESS_KEY_ID=AKIAIOSFODNN7SCANTEST +AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY +GITLAB_TOKEN=glpat-A1b2C3d4E5f6G7h8I9j0 diff --git a/fixtures/nightly/eco/py-poetry/poetry.lock b/fixtures/nightly/eco/py-poetry/poetry.lock new file mode 100644 index 0000000..d99b887 --- /dev/null +++ b/fixtures/nightly/eco/py-poetry/poetry.lock @@ -0,0 +1,36 @@ +[[package]] +name = "requests" +version = "2.19.1" +description = "pinned for the scan regression" +optional = false +python-versions = "*" +files = [] + +[[package]] +name = "pyyaml" +version = "5.1" +description = "pinned for the scan regression" +optional = false +python-versions = "*" +files = [] + +[[package]] +name = "jinja2" +version = "2.10" +description = "pinned for the scan regression" +optional = false +python-versions = "*" +files = [] + +[[package]] +name = "urllib3" +version = "1.24.1" +description = "pinned for the scan regression" +optional = false +python-versions = "*" +files = [] + +[metadata] +lock-version = "2.0" +python-versions = "^3.11" +content-hash = "0000000000000000000000000000000000000000000000000000000000000000" diff --git a/fixtures/nightly/eco/py-poetry/pyproject.toml b/fixtures/nightly/eco/py-poetry/pyproject.toml new file mode 100644 index 0000000..0d0619e --- /dev/null +++ b/fixtures/nightly/eco/py-poetry/pyproject.toml @@ -0,0 +1,16 @@ +[tool.poetry] +name = "customer-records-poetry" +version = "1.2.0" +description = "Customer records service" +authors = ["Platform "] + +[tool.poetry.dependencies] +python = "^3.11" +requests = "2.19.1" +PyYAML = "5.1" +Jinja2 = "2.10" +urllib3 = "1.24.1" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/fixtures/nightly/eco/py-requirements/app.py b/fixtures/nightly/eco/py-requirements/app.py new file mode 100644 index 0000000..10b42b8 --- /dev/null +++ b/fixtures/nightly/eco/py-requirements/app.py @@ -0,0 +1,46 @@ +"""Customer records service. Planted for the scan regression.""" + +import hashlib +import os # noqa-free on purpose: ruff reports this unused import (F401) +import subprocess + +import yaml +from flask import Flask, request + +app = Flask(__name__) + + +@app.route("/import", methods=["POST"]) +def import_records(): + # Unsafe deserialisation: the loader executes tags in the payload. + records = yaml.load(request.data, Loader=yaml.Loader) + # Personal data written to the log (GDPR pattern). + for record in records: + app.logger.info( + "imported %s <%s> national_id=%s", + record["full_name"], + record["email"], + record["national_id"], + ) + return {"imported": len(records)} + + +@app.route("/report") +def report(): + name = request.args.get("customer", "") + # Shell command built from request input. + out = subprocess.check_output("report-for " + name, shell=True) + return out + + +def fingerprint(value: str) -> str: + # Weak hash used as an identifier. + return hashlib.md5(value.encode()).hexdigest() + + +def load_settings(path: str) -> dict: + try: + with open(path) as handle: + return yaml.safe_load(handle) + except: # ruff reports the bare except (E722) + return {} diff --git a/fixtures/nightly/eco/py-requirements/auth.py b/fixtures/nightly/eco/py-requirements/auth.py new file mode 100644 index 0000000..6dc2636 --- /dev/null +++ b/fixtures/nightly/eco/py-requirements/auth.py @@ -0,0 +1,21 @@ +"""Token exchange against the identity provider.""" + +import requests + +# OAuth client credentials in source. +CLIENT_ID = "customer-records" +CLIENT_SECRET = "5f4dcc3b5aa765d61d8327deb882cf99e1a2b3c4" +TOKEN_URL = "https://auth.example.com/oauth2/token" + + +def fetch_token() -> str: + response = requests.post( + TOKEN_URL, + data={ + "grant_type": "client_credentials", + "client_id": CLIENT_ID, + "client_secret": CLIENT_SECRET, + }, + verify=False, # certificate verification disabled + ) + return response.json()["access_token"] diff --git a/fixtures/nightly/eco/py-requirements/deploy/service.env b/fixtures/nightly/eco/py-requirements/deploy/service.env new file mode 100644 index 0000000..ac5a4f2 --- /dev/null +++ b/fixtures/nightly/eco/py-requirements/deploy/service.env @@ -0,0 +1,4 @@ +# Planted, expired test credentials — not live secrets. +AWS_ACCESS_KEY_ID=AKIAIOSFODNN7SCANTEST +AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY +GITLAB_TOKEN=glpat-A1b2C3d4E5f6G7h8I9j0 diff --git a/fixtures/nightly/eco/py-requirements/requirements.txt b/fixtures/nightly/eco/py-requirements/requirements.txt new file mode 100644 index 0000000..19a33c8 --- /dev/null +++ b/fixtures/nightly/eco/py-requirements/requirements.txt @@ -0,0 +1,5 @@ +# Pinned, as a deployment requires. +requests==2.19.1 +PyYAML==5.1 +Jinja2==2.10 +urllib3==1.24.1 diff --git a/fixtures/nightly/eco/py-uv/app.py b/fixtures/nightly/eco/py-uv/app.py new file mode 100644 index 0000000..10b42b8 --- /dev/null +++ b/fixtures/nightly/eco/py-uv/app.py @@ -0,0 +1,46 @@ +"""Customer records service. Planted for the scan regression.""" + +import hashlib +import os # noqa-free on purpose: ruff reports this unused import (F401) +import subprocess + +import yaml +from flask import Flask, request + +app = Flask(__name__) + + +@app.route("/import", methods=["POST"]) +def import_records(): + # Unsafe deserialisation: the loader executes tags in the payload. + records = yaml.load(request.data, Loader=yaml.Loader) + # Personal data written to the log (GDPR pattern). + for record in records: + app.logger.info( + "imported %s <%s> national_id=%s", + record["full_name"], + record["email"], + record["national_id"], + ) + return {"imported": len(records)} + + +@app.route("/report") +def report(): + name = request.args.get("customer", "") + # Shell command built from request input. + out = subprocess.check_output("report-for " + name, shell=True) + return out + + +def fingerprint(value: str) -> str: + # Weak hash used as an identifier. + return hashlib.md5(value.encode()).hexdigest() + + +def load_settings(path: str) -> dict: + try: + with open(path) as handle: + return yaml.safe_load(handle) + except: # ruff reports the bare except (E722) + return {} diff --git a/fixtures/nightly/eco/py-uv/auth.py b/fixtures/nightly/eco/py-uv/auth.py new file mode 100644 index 0000000..6dc2636 --- /dev/null +++ b/fixtures/nightly/eco/py-uv/auth.py @@ -0,0 +1,21 @@ +"""Token exchange against the identity provider.""" + +import requests + +# OAuth client credentials in source. +CLIENT_ID = "customer-records" +CLIENT_SECRET = "5f4dcc3b5aa765d61d8327deb882cf99e1a2b3c4" +TOKEN_URL = "https://auth.example.com/oauth2/token" + + +def fetch_token() -> str: + response = requests.post( + TOKEN_URL, + data={ + "grant_type": "client_credentials", + "client_id": CLIENT_ID, + "client_secret": CLIENT_SECRET, + }, + verify=False, # certificate verification disabled + ) + return response.json()["access_token"] diff --git a/fixtures/nightly/eco/py-uv/deploy/service.env b/fixtures/nightly/eco/py-uv/deploy/service.env new file mode 100644 index 0000000..ac5a4f2 --- /dev/null +++ b/fixtures/nightly/eco/py-uv/deploy/service.env @@ -0,0 +1,4 @@ +# Planted, expired test credentials — not live secrets. +AWS_ACCESS_KEY_ID=AKIAIOSFODNN7SCANTEST +AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY +GITLAB_TOKEN=glpat-A1b2C3d4E5f6G7h8I9j0 diff --git a/fixtures/nightly/eco/py-uv/pyproject.toml b/fixtures/nightly/eco/py-uv/pyproject.toml new file mode 100644 index 0000000..899ad8c --- /dev/null +++ b/fixtures/nightly/eco/py-uv/pyproject.toml @@ -0,0 +1,10 @@ +[project] +name = "customer-records-uv" +version = "1.2.0" +requires-python = ">=3.11" +dependencies = [ + "requests==2.19.1", +"PyYAML==5.1", +"Jinja2==2.10", +"urllib3==1.24.1", +] diff --git a/fixtures/nightly/eco/py-uv/uv.lock b/fixtures/nightly/eco/py-uv/uv.lock new file mode 100644 index 0000000..929613d --- /dev/null +++ b/fixtures/nightly/eco/py-uv/uv.lock @@ -0,0 +1,22 @@ +version = 1 +requires-python = ">=3.11" + +[[package]] +name = "requests" +version = "2.19.1" +source = { registry = "https://pypi.org/simple" } + +[[package]] +name = "pyyaml" +version = "5.1" +source = { registry = "https://pypi.org/simple" } + +[[package]] +name = "jinja2" +version = "2.10" +source = { registry = "https://pypi.org/simple" } + +[[package]] +name = "urllib3" +version = "1.24.1" +source = { registry = "https://pypi.org/simple" } diff --git a/fixtures/nightly/targets.json b/fixtures/nightly/targets.json index a40f6f5..62ad716 100644 --- a/fixtures/nightly/targets.json +++ b/fixtures/nightly/targets.json @@ -284,6 +284,195 @@ "javascript.lang.security.detect-child-process.detect-child-process" ] } + }, + { + "key": "js-npm-lock-v3", + "name": "JavaScript/TypeScript · npm lockfile v3", + "target_type": "web_app", + "description": "Uploaded as a source archive. package-lock.json v3 (v2 is covered by the order-intake archive). Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/js-npm-lock-v3" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "js-yarn-classic", + "name": "JavaScript/TypeScript · yarn classic", + "target_type": "web_app", + "description": "Uploaded as a source archive. yarn.lock v1. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/js-yarn-classic" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "js-yarn-berry", + "name": "JavaScript/TypeScript · yarn berry", + "target_type": "web_app", + "description": "Uploaded as a source archive. yarn.lock with the berry __metadata header and npm: resolutions. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/js-yarn-berry" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "js-pnpm", + "name": "JavaScript/TypeScript · pnpm", + "target_type": "web_app", + "description": "Uploaded as a source archive. pnpm-lock.yaml v9. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/js-pnpm" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "js-no-lockfile", + "name": "JavaScript/TypeScript · no lockfile", + "target_type": "web_app", + "description": "Uploaded as a source archive. package.json alone: nothing pins the versions, and generating a lockfile runs the project's code, which this deployment does not. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/js-no-lockfile" + } + ], + "expect": { + "min_graph_nodes": 1 + } + }, + { + "key": "js-bun", + "name": "JavaScript/TypeScript · Bun (text bun.lock)", + "target_type": "web_app", + "description": "Uploaded as a source archive. bun.lock, Bun's text lockfile and its default since 1.2. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/js-bun" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "js-bun-binary", + "name": "JavaScript/TypeScript · Bun (binary bun.lockb only)", + "target_type": "web_app", + "description": "Uploaded as a source archive. bun.lockb alone, Bun's older binary lockfile, which the SBOM tooling cannot read. The run must say so, and npm must not re-resolve the project, which would report versions it does not ship. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/js-bun-binary" + } + ], + "expect": { + "min_graph_nodes": 1 + } + }, + { + "key": "py-requirements", + "name": "Python · pinned requirements.txt", + "target_type": "backend_service", + "description": "Uploaded as a source archive. requirements.txt with exact pins. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/py-requirements" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "py-poetry", + "name": "Python · poetry", + "target_type": "backend_service", + "description": "Uploaded as a source archive. pyproject.toml + poetry.lock. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/py-poetry" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "py-pipenv", + "name": "Python · pipenv", + "target_type": "backend_service", + "description": "Uploaded as a source archive. Pipfile + Pipfile.lock. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/py-pipenv" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "py-uv", + "name": "Python · uv", + "target_type": "backend_service", + "description": "Uploaded as a source archive. pyproject.toml + uv.lock. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/py-uv" + } + ], + "expect": { + "min_graph_nodes": 1, + "min_sbom_components": 3 + } + }, + { + "key": "py-bare-pyproject", + "name": "Python · bare pyproject.toml", + "target_type": "backend_service", + "description": "Uploaded as a source archive. pyproject.toml alone: PEP 621 dependencies with nothing pinning them. Plants a vulnerable pinned dependency, a SAST sink, a committed secret and OAuth/PII patterns.", + "artifacts": [ + { + "kind": "source_archive", + "upload": "fixtures/nightly/eco/py-bare-pyproject" + } + ], + "expect": { + "min_graph_nodes": 1 + } } ] }