Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a6d5618e0 | ||
|
|
d29eaebbd2 | ||
|
|
4b6638d6dc | ||
|
|
e689dbfda1 | ||
|
|
c5f2de7697 | ||
|
|
97895dabd1 | ||
|
|
680fa7ee6b | ||
|
|
860bb22aef | ||
|
|
80d51a43cd |
@@ -95,7 +95,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
+19
-11
@@ -33,8 +33,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "pnpm"
|
||||
@@ -134,8 +134,8 @@ jobs:
|
||||
--health-timeout 5s
|
||||
--health-retries 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "pnpm"
|
||||
@@ -271,10 +271,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Trivy
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Install Trivy (pinned + checksum verified)
|
||||
run: |
|
||||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
set -euo pipefail
|
||||
TRIVY_VERSION=0.76.2
|
||||
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
|
||||
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
|
||||
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
trivy --version
|
||||
# `siax/sbom/` är CycloneDX-evidenens för REDAN BYGGDA images (release-kedjan),
|
||||
# inte källberoenden. Att scanna dem här återrapporterar gamla image-versioner
|
||||
# (next 16.3.x, sharp 0.35.4) och blockerar källfixar som redan är patchade.
|
||||
@@ -292,7 +300,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: SonarQube analysis (self-hosted sonar.siax.dev)
|
||||
@@ -316,12 +324,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Checkout canonical siax-standard (SSOT)
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
with:
|
||||
repository: admin/siax-standard
|
||||
token: ${{ secrets.SIAX_CI_TOKEN }}
|
||||
|
||||
@@ -12,12 +12,21 @@ jobs:
|
||||
health:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Required files
|
||||
run: |
|
||||
for f in README.md LICENSE .gitignore; do [ -f "$f" ] || echo "::warning file=$f,title=Missing::$f is missing"; done
|
||||
[ -f .gitea/workflows/ci.yml ] || echo "::warning title=No CI::No CI workflow found"
|
||||
- name: Install Trivy
|
||||
run: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
- name: Install Trivy (pinned + checksum verified)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TRIVY_VERSION=0.76.2
|
||||
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
|
||||
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
|
||||
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
trivy --version
|
||||
- name: Secret scan
|
||||
run: trivy fs --scanners secret --exit-code 0 .
|
||||
@@ -21,6 +21,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Masterplan lock check
|
||||
run: sh scripts/check-masterplan-lock.sh
|
||||
@@ -17,8 +17,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "pnpm"
|
||||
@@ -43,10 +43,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Trivy
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Install Trivy (pinned + checksum verified)
|
||||
run: |
|
||||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
set -euo pipefail
|
||||
TRIVY_VERSION=0.76.2
|
||||
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
|
||||
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
|
||||
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
trivy --version
|
||||
# A nightly scan exists to catch CVEs published against code that did
|
||||
# not change. With `--exit-code 0` it could never report failure, so it
|
||||
# could never raise that alarm -- the one job whose entire purpose is
|
||||
|
||||
@@ -53,10 +53,13 @@ jobs:
|
||||
echo "::warning::SIAX_CI_TOKEN is not set — cannot compare with main; commit $running is live"
|
||||
exit 0
|
||||
fi
|
||||
expected="$(curl -fsS --max-time 15 \
|
||||
# Ladda ner först och parsea sedan: curl | tolk leder till Semgrep
|
||||
# gha-curl-pipe-shell och gör det omöjligt att verifiera svaret.
|
||||
curl -fsS --max-time 15 \
|
||||
-H "Authorization: token ${SIAX_CI_TOKEN}" \
|
||||
"https://git.siax.io/api/v1/repos/admin/0pt/commits?limit=1" \
|
||||
| python3 -c 'import sys,json; print(json.load(sys.stdin)[0]["sha"])')"
|
||||
-o "${RUNNER_TEMP}/0pt-main.json" \
|
||||
"https://git.siax.io/api/v1/repos/admin/0pt/commits?limit=1"
|
||||
expected="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[0]["sha"])' "${RUNNER_TEMP}/0pt-main.json")"
|
||||
echo "running=$running expected(main)=$expected"
|
||||
[ -n "$expected" ] || { echo "::error::could not read main SHA from Gitea"; exit 1; }
|
||||
[ "$running" = "$expected" ] || {
|
||||
|
||||
@@ -162,8 +162,10 @@ jobs:
|
||||
if [ $rc -eq 1 ]; then echo "::error::Trivy filesystem scan hittade fynd"; exit 1; fi
|
||||
echo "::error::Trivy filesystem scan kunde inte koras (rc=$rc) - scannerfel, inte fynd; grinden far inte bli tyst gron"; exit 1
|
||||
|
||||
# Dockerfile- och IaC-misconfig är informativt: DS-0002 (root-USER)
|
||||
# kräver ändrade runtime-användare och hanteras per repo, inte i grinden.
|
||||
# Dockerfile- och IaC-misconfig är informativt. DS-0002 (root-USER),
|
||||
# KSV-0014/KSV-0118 (readOnlyRootFilesystem + icke-root) är åtgärdade i
|
||||
# services/*/Dockerfile och deploy/k8s/deployment.yaml; steget finns kvar
|
||||
# som tidig varning för nya misconfigs, inte som en tyst grön grind.
|
||||
- name: Trivy config informational
|
||||
continue-on-error: true
|
||||
run: |
|
||||
|
||||
@@ -36,8 +36,8 @@ jobs:
|
||||
# requires" section are actually done.
|
||||
VEHIQ_INGEST_MODE: preview
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
- name: Enable corepack + pin pnpm@9
|
||||
|
||||
@@ -6,3 +6,7 @@ confirmModulesPurge=false
|
||||
# Only scoped @siax/* names resolve here; everything else stays on the
|
||||
# public npm registry.
|
||||
@siax:registry=https://git.siax.io/api/packages/admin/npm/
|
||||
|
||||
# Supply-chain: wait 7 days before resolving newly published versions
|
||||
# (Semgrep npm-missing-minimum-release-age; same setting as aud0/cl0ud).
|
||||
min-release-age=7
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { Metadata } from "next";
|
||||
import { findDataset } from "@/app/katalog/datasets";
|
||||
|
||||
const BASE = "https://0pt.app";
|
||||
|
||||
// A dataset detail is a real, indexable search target: it has its own title,
|
||||
// description and content, and is linked from /katalog. Without its own
|
||||
// metadata it inherits the parent /katalog canonical and search engines fold
|
||||
// every dataset into the catalog page. Route-level generateMetadata is the
|
||||
// existing Next mechanism for per-dataset metadata; the detail page itself
|
||||
// stays a client component.
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const dataset = findDataset(id);
|
||||
|
||||
if (!dataset) {
|
||||
// An unknown id renders the client-side "dataset does not exist" state.
|
||||
// Make the policy explicit: not indexable, canonical back to the catalog.
|
||||
return {
|
||||
title: "Dataset not found — 0pt",
|
||||
alternates: { canonical: `${BASE}/katalog` },
|
||||
robots: { index: false, follow: true },
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${dataset.title.en} — 0pt`,
|
||||
description: `${dataset.blurb.en} ${dataset.count.en} across ${dataset.markets}. Provenance per field and transparent pricing.`,
|
||||
alternates: { canonical: `${BASE}/katalog/${dataset.id}` },
|
||||
};
|
||||
}
|
||||
|
||||
export default function DatasetDetailLayout({ children }: { children: React.ReactNode }) {
|
||||
return children;
|
||||
}
|
||||
+1
-119
@@ -11,119 +11,7 @@ import { LoadingSkeleton, EmptyState, ErrorState } from "@/components/states";
|
||||
import { useReveal } from "@/hooks/use-reveal";
|
||||
import { FIELDS, SAMPLE_ROWS, MARKETS, formatSEK, type ProvLevel } from "@/lib/data";
|
||||
import type { Loc } from "@/lib/data";
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Inline catalog. No detail API yet — keyed by slugified id with a safe fallback.
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
interface Dataset {
|
||||
id: string;
|
||||
markets: string;
|
||||
marketCodes: string[];
|
||||
title: Loc;
|
||||
blurb: Loc;
|
||||
count: Loc;
|
||||
rows: number;
|
||||
freshness: Loc;
|
||||
level: ProvLevel;
|
||||
source: string;
|
||||
cat: Loc;
|
||||
price: number;
|
||||
artifact: "table" | "map" | "schema" | "chart";
|
||||
}
|
||||
|
||||
const CATALOG: Dataset[] = [
|
||||
{
|
||||
id: "nordic-companies",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Nordic company data", sv: "Nordisk bolagsdata" },
|
||||
blurb: { en: "Official registers. Per field.", sv: "Officiella register. Per fält." },
|
||||
count: { en: "4.9M records", sv: "4,9M poster" },
|
||||
rows: 4900000,
|
||||
freshness: { en: "daily", sv: "daglig" },
|
||||
level: 3,
|
||||
source: "GLEIF · Brreg",
|
||||
cat: { en: "Companies", sv: "Bolag" },
|
||||
price: 18400,
|
||||
artifact: "table",
|
||||
},
|
||||
{
|
||||
id: "tech-decisionmakers",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Decision-makers in tech", sv: "Beslutsfattare i tech" },
|
||||
blurb: { en: "Role and path. Source per field.", sv: "Roll och väg. Källa per fält." },
|
||||
count: { en: "182k records", sv: "182k poster" },
|
||||
rows: 182000,
|
||||
freshness: { en: "weekly", sv: "veckovis" },
|
||||
level: 1,
|
||||
source: "public web",
|
||||
cat: { en: "Decision-makers", sv: "Beslutsfattare" },
|
||||
price: 9600,
|
||||
artifact: "schema",
|
||||
},
|
||||
{
|
||||
id: "vehicles-fleet",
|
||||
markets: "SE",
|
||||
marketCodes: ["SE"],
|
||||
title: { en: "Vehicles & fleet", sv: "Fordon & flotta" },
|
||||
blurb: { en: "Technical data. VehIQ synergy.", sv: "Tekniska data. VehIQ-synergin." },
|
||||
count: { en: "6.1M records", sv: "6,1M poster" },
|
||||
rows: 6100000,
|
||||
freshness: { en: "daily", sv: "daglig" },
|
||||
level: 2,
|
||||
source: "register",
|
||||
cat: { en: "Vehicles", sv: "Fordon" },
|
||||
price: 12200,
|
||||
artifact: "map",
|
||||
},
|
||||
{
|
||||
id: "financial-series",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Financial series", sv: "Finansiella serier" },
|
||||
blurb: { en: "Revenue, result, KPIs.", sv: "Omsättning, resultat, nyckeltal." },
|
||||
count: { en: "12 years", sv: "12 år" },
|
||||
rows: 240000,
|
||||
freshness: { en: "annual", sv: "årlig" },
|
||||
level: 2,
|
||||
source: "register",
|
||||
cat: { en: "Financials", sv: "Finansiellt" },
|
||||
price: 14800,
|
||||
artifact: "chart",
|
||||
},
|
||||
{
|
||||
id: "buying-signals",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Buying signals", sv: "Köpsignaler" },
|
||||
blurb: { en: "Ads, news, tech changes. Intent per company.", sv: "Annonser, nyheter, teknikbyten. Intent per bolag." },
|
||||
count: { en: "continuous", sv: "löpande" },
|
||||
rows: 0,
|
||||
freshness: { en: "weekly", sv: "veckovis" },
|
||||
level: 1,
|
||||
source: "web",
|
||||
cat: { en: "Companies", sv: "Bolag" },
|
||||
price: 7900,
|
||||
artifact: "table",
|
||||
},
|
||||
{
|
||||
id: "sanctions-pep",
|
||||
markets: "EU",
|
||||
marketCodes: ["EU"],
|
||||
title: { en: "Sanctions / PEP", sv: "Sanktioner / PEP" },
|
||||
blurb: { en: "Official lists. Automated screening.", sv: "Officiella listor. Automatisk screening." },
|
||||
count: { en: "global", sv: "global" },
|
||||
rows: 0,
|
||||
freshness: { en: "daily", sv: "daglig" },
|
||||
level: 3,
|
||||
source: "OpenSanctions",
|
||||
cat: { en: "Compliance", sv: "Efterlevnad" },
|
||||
price: 5900,
|
||||
artifact: "table",
|
||||
},
|
||||
];
|
||||
import { findDataset, type Dataset } from "@/app/katalog/datasets";
|
||||
|
||||
// Stable tab keys — never change, display labels are localized separately
|
||||
type TabKey = "overview" | "samples" | "quality" | "schema" | "coverage" | "price";
|
||||
@@ -136,12 +24,6 @@ const TABS: { key: TabKey; label: Loc }[] = [
|
||||
{ key: "price", label: { en: "Price", sv: "Pris" } },
|
||||
];
|
||||
|
||||
function findDataset(raw: string | undefined): Dataset | undefined {
|
||||
if (!raw) return undefined;
|
||||
const slug = decodeURIComponent(raw).toLowerCase();
|
||||
return CATALOG.find((d) => d.id === slug);
|
||||
}
|
||||
|
||||
const TAB_KEYS = TABS.map((t) => t.key);
|
||||
function isTabKey(value: string | null): value is TabKey {
|
||||
return value !== null && (TAB_KEYS as string[]).includes(value);
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
import type { Loc, ProvLevel } from "@/lib/data";
|
||||
|
||||
// Single source of truth for the ready-made datasets shown under /katalog.
|
||||
// Kept framework-neutral (no "use client") so both the client detail page and
|
||||
// the route's server-side generateMetadata resolve the same ids and titles.
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Static dataset seed (no detail API yet) — keyed by slugified id with a safe fallback.
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface Dataset {
|
||||
id: string;
|
||||
markets: string;
|
||||
marketCodes: string[];
|
||||
title: Loc;
|
||||
blurb: Loc;
|
||||
count: Loc;
|
||||
rows: number;
|
||||
freshness: Loc;
|
||||
level: ProvLevel;
|
||||
source: string;
|
||||
cat: Loc;
|
||||
price: number;
|
||||
artifact: "table" | "map" | "schema" | "chart";
|
||||
}
|
||||
|
||||
export const CATALOG: Dataset[] = [
|
||||
{
|
||||
id: "nordic-companies",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Nordic company data", sv: "Nordisk bolagsdata" },
|
||||
blurb: { en: "Official registers. Per field.", sv: "Officiella register. Per fält." },
|
||||
count: { en: "4.9M records", sv: "4,9M poster" },
|
||||
rows: 4900000,
|
||||
freshness: { en: "daily", sv: "daglig" },
|
||||
level: 3,
|
||||
source: "GLEIF · Brreg",
|
||||
cat: { en: "Companies", sv: "Bolag" },
|
||||
price: 18400,
|
||||
artifact: "table",
|
||||
},
|
||||
{
|
||||
id: "tech-decisionmakers",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Decision-makers in tech", sv: "Beslutsfattare i tech" },
|
||||
blurb: { en: "Role and path. Source per field.", sv: "Roll och väg. Källa per fält." },
|
||||
count: { en: "182k records", sv: "182k poster" },
|
||||
rows: 182000,
|
||||
freshness: { en: "weekly", sv: "veckovis" },
|
||||
level: 1,
|
||||
source: "public web",
|
||||
cat: { en: "Decision-makers", sv: "Beslutsfattare" },
|
||||
price: 9600,
|
||||
artifact: "schema",
|
||||
},
|
||||
{
|
||||
id: "vehicles-fleet",
|
||||
markets: "SE",
|
||||
marketCodes: ["SE"],
|
||||
title: { en: "Vehicles & fleet", sv: "Fordon & flotta" },
|
||||
blurb: { en: "Technical data. VehIQ synergy.", sv: "Tekniska data. VehIQ-synergin." },
|
||||
count: { en: "6.1M records", sv: "6,1M poster" },
|
||||
rows: 6100000,
|
||||
freshness: { en: "daily", sv: "daglig" },
|
||||
level: 2,
|
||||
source: "register",
|
||||
cat: { en: "Vehicles", sv: "Fordon" },
|
||||
price: 12200,
|
||||
artifact: "map",
|
||||
},
|
||||
{
|
||||
id: "financial-series",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Financial series", sv: "Finansiella serier" },
|
||||
blurb: { en: "Revenue, result, KPIs.", sv: "Omsättning, resultat, nyckeltal." },
|
||||
count: { en: "12 years", sv: "12 år" },
|
||||
rows: 240000,
|
||||
freshness: { en: "annual", sv: "årlig" },
|
||||
level: 2,
|
||||
source: "register",
|
||||
cat: { en: "Financials", sv: "Finansiellt" },
|
||||
price: 14800,
|
||||
artifact: "chart",
|
||||
},
|
||||
{
|
||||
id: "buying-signals",
|
||||
markets: "SE · NO · DK · FI",
|
||||
marketCodes: ["SE", "NO", "DK", "FI"],
|
||||
title: { en: "Buying signals", sv: "Köpsignaler" },
|
||||
blurb: { en: "Ads, news, tech changes. Intent per company.", sv: "Annonser, nyheter, teknikbyten. Intent per bolag." },
|
||||
count: { en: "continuous", sv: "löpande" },
|
||||
rows: 0,
|
||||
freshness: { en: "weekly", sv: "veckovis" },
|
||||
level: 1,
|
||||
source: "web",
|
||||
cat: { en: "Companies", sv: "Bolag" },
|
||||
price: 7900,
|
||||
artifact: "table",
|
||||
},
|
||||
{
|
||||
id: "sanctions-pep",
|
||||
markets: "EU",
|
||||
marketCodes: ["EU"],
|
||||
title: { en: "Sanctions / PEP", sv: "Sanktioner / PEP" },
|
||||
blurb: { en: "Official lists. Automated screening.", sv: "Officiella listor. Automatisk screening." },
|
||||
count: { en: "global", sv: "global" },
|
||||
rows: 0,
|
||||
freshness: { en: "daily", sv: "daglig" },
|
||||
level: 3,
|
||||
source: "OpenSanctions",
|
||||
cat: { en: "Compliance", sv: "Efterlevnad" },
|
||||
price: 5900,
|
||||
artifact: "table",
|
||||
},
|
||||
];
|
||||
|
||||
export function findDataset(raw: string | undefined): Dataset | undefined {
|
||||
if (!raw) return undefined;
|
||||
const slug = decodeURIComponent(raw).toLowerCase();
|
||||
return CATALOG.find((d) => d.id === slug);
|
||||
}
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
const BASE = "https://0pt.app";
|
||||
const ROUTES = ["", "/tjanster", "/katalog", "/kallor", "/bestall", "/bestall/beskriv", "/bestall/forskott"];
|
||||
// /bestall, /bestall/beskriv and /bestall/forskott are deliberately noindex
|
||||
// (app/bestall/layout.tsx) — the order flow is transactional, not a landing
|
||||
// page. Keep the sitemap in sync with that indexation policy.
|
||||
const ROUTES = ["", "/tjanster", "/katalog", "/kallor"];
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
return ROUTES.map((r) => ({
|
||||
|
||||
@@ -15,9 +15,23 @@ spec:
|
||||
labels:
|
||||
app: 0pt-web
|
||||
spec:
|
||||
# Den här manifesten är referens-only (se README.md), men den ska vara
|
||||
# säker att använda. Imagebygget kör redan USER node (uid 1000).
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
fsGroup: 1000
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: 0pt-web
|
||||
image: REPLACE_ME/0pt-web:REPLACE_ME_TAG
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
env:
|
||||
@@ -50,6 +64,18 @@ spec:
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: "512Mi"
|
||||
# readOnlyRootFilesystem above needs explicit writable scratch space:
|
||||
# Node/Next writes temp files and caches here at runtime.
|
||||
volumeMounts:
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
- name: next-cache
|
||||
mountPath: /app/.next/cache
|
||||
volumes:
|
||||
- name: tmp
|
||||
emptyDir: {}
|
||||
- name: next-cache
|
||||
emptyDir: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
@@ -16,3 +16,11 @@ packages:
|
||||
onlyBuiltDependencies:
|
||||
- sharp
|
||||
- esbuild
|
||||
|
||||
# Supply-chain hardening (Semgrep p/ci blocking rules):
|
||||
# - no transitive dependency from an untrusted/exotic source
|
||||
# - wait 7 days (10080 min) for newly published versions
|
||||
# - never accept a downgrade of security settings via a dependency update
|
||||
blockExoticSubdeps: true
|
||||
minimumReleaseAge: 10080
|
||||
trustPolicy: no-downgrade
|
||||
|
||||
@@ -4,6 +4,10 @@ ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
COPY app.py ingest_aud0.py ./
|
||||
# Kör som icke-root (DS-0002). Inga skrivningar till /app krävs.
|
||||
RUN useradd --create-home --uid 10001 appuser
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8096
|
||||
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8096/health', timeout=3)"
|
||||
|
||||
@@ -15,6 +15,11 @@ RUN pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
# Kör som icke-root (DS-0002). Beroendena ligger i globala /usr/local och är
|
||||
# läsliga för alla användare; appens egen kod skrivs inte vid körning.
|
||||
RUN useradd --create-home --uid 10001 appuser
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8000
|
||||
# API: uvicorn orchestrator.main:app --host 0.0.0.0 --port 8000
|
||||
# Worker: python -m workers.run
|
||||
|
||||
@@ -14,8 +14,11 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copy scraper code
|
||||
COPY . .
|
||||
|
||||
# Create data directories
|
||||
RUN mkdir -p /data/output /data/checkpoints /data/sources
|
||||
# Create data directories (writable by the non-root runtime user, DS-0002)
|
||||
RUN mkdir -p /data/output /data/checkpoints /data/sources \
|
||||
&& useradd --create-home --uid 10001 appuser \
|
||||
&& chown -R appuser:appuser /data
|
||||
USER appuser
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV S3_ENDPOINT=https://s3.siax.io
|
||||
|
||||
@@ -70,7 +70,10 @@ export function parseServiceTenants(value: string | undefined | null): string[]
|
||||
|
||||
/** Read the configured service tenant allowlist from the environment. */
|
||||
export function resolveInternalServiceTenants(
|
||||
env: { INTERNAL_SERVICE_TENANTS?: string } = process.env,
|
||||
// @types/node 22's ProcessEnv has only an index signature, so a direct
|
||||
// default is not assignable to the narrow named-property shape. This is a
|
||||
// type-only view of the same object; runtime behaviour is unchanged.
|
||||
env: { INTERNAL_SERVICE_TENANTS?: string } = process.env as { INTERNAL_SERVICE_TENANTS?: string },
|
||||
): string[] {
|
||||
return parseServiceTenants(env.INTERNAL_SERVICE_TENANTS);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,10 @@ function timingSafeEqualStr(a: string, b: string): boolean {
|
||||
*/
|
||||
export function verifyInternalServiceToken(
|
||||
headers: HeaderLookup,
|
||||
env: { INTERNAL_TOKEN?: string } = process.env,
|
||||
// @types/node 22's ProcessEnv has only an index signature, so a direct
|
||||
// default is not assignable to the narrow named-property shape. This is a
|
||||
// type-only view of the same object; runtime behaviour is unchanged.
|
||||
env: { INTERNAL_TOKEN?: string } = process.env as { INTERNAL_TOKEN?: string },
|
||||
): boolean {
|
||||
const expected = env.INTERNAL_TOKEN?.trim();
|
||||
if (!expected) return false;
|
||||
|
||||
@@ -23,6 +23,11 @@ function req(url: string, headers: Record<string, string> = {}): NextRequest {
|
||||
return new NextRequest(new URL(url, 'http://localhost'), { headers });
|
||||
}
|
||||
|
||||
// @types/node 22 declares NODE_ENV readonly. These tests deliberately save
|
||||
// and restore it; a typed mutable view keeps that exact without weakening the
|
||||
// production auth checks under test.
|
||||
const mutableEnv = process.env as Record<string, string | undefined>;
|
||||
|
||||
describe('anonymous-access regression: /api/orders (GET) and /api/admin/metrics (GET)', () => {
|
||||
const saved = { auth: process.env.AUTH_ENFORCE, node: process.env.NODE_ENV };
|
||||
|
||||
@@ -35,8 +40,8 @@ describe('anonymous-access regression: /api/orders (GET) and /api/admin/metrics
|
||||
afterEach(() => {
|
||||
if (saved.auth === undefined) delete process.env.AUTH_ENFORCE;
|
||||
else process.env.AUTH_ENFORCE = saved.auth;
|
||||
if (saved.node === undefined) delete process.env.NODE_ENV;
|
||||
else process.env.NODE_ENV = saved.node;
|
||||
if (saved.node === undefined) delete mutableEnv.NODE_ENV;
|
||||
else mutableEnv.NODE_ENV = saved.node;
|
||||
});
|
||||
|
||||
it('REGRESSION: GET /api/orders 401s with no Authorization header (was: 200 + full order list)', async () => {
|
||||
|
||||
@@ -36,6 +36,11 @@ function h(init: Record<string, string>): Headers {
|
||||
return new Headers(init);
|
||||
}
|
||||
|
||||
// @types/node 22 declares NODE_ENV readonly. These tests deliberately save
|
||||
// and restore it; a typed mutable view keeps that exact without weakening the
|
||||
// fail-closed auth contract under test.
|
||||
const mutableEnv = process.env as Record<string, string | undefined>;
|
||||
|
||||
describe('auth default -- fail-closed (no AUTH_ENFORCE in the environment)', () => {
|
||||
const saved = { auth: process.env.AUTH_ENFORCE, node: process.env.NODE_ENV };
|
||||
|
||||
@@ -46,8 +51,8 @@ describe('auth default -- fail-closed (no AUTH_ENFORCE in the environment)', ()
|
||||
afterEach(() => {
|
||||
if (saved.auth === undefined) delete process.env.AUTH_ENFORCE;
|
||||
else process.env.AUTH_ENFORCE = saved.auth;
|
||||
if (saved.node === undefined) delete process.env.NODE_ENV;
|
||||
else process.env.NODE_ENV = saved.node;
|
||||
if (saved.node === undefined) delete mutableEnv.NODE_ENV;
|
||||
else mutableEnv.NODE_ENV = saved.node;
|
||||
});
|
||||
|
||||
it('REGRESSION: with the variable unset, an unauthenticated request is REJECTED (401)', async () => {
|
||||
@@ -98,7 +103,7 @@ describe('auth default -- fail-closed (no AUTH_ENFORCE in the environment)', ()
|
||||
});
|
||||
|
||||
it('a production process with AUTH_ENFORCE=false cannot serve a request at all (throws)', async () => {
|
||||
process.env.NODE_ENV = 'production';
|
||||
mutableEnv.NODE_ENV = 'production';
|
||||
process.env.AUTH_ENFORCE = 'false';
|
||||
await expect(
|
||||
resolveAuthContext(h({ 'x-tenant-id': 'tenant_attacker' }), { verify: okVerify }),
|
||||
|
||||
@@ -20,6 +20,10 @@ function req(path: string, headers: Record<string, string> = {}): NextRequest {
|
||||
return new NextRequest(new URL(path, 'http://localhost'), { headers });
|
||||
}
|
||||
|
||||
// @types/node 22 declares NODE_ENV readonly. This key is one of the three
|
||||
// restored below; a typed mutable view keeps that exact.
|
||||
const mutableEnv = process.env as Record<string, string | undefined>;
|
||||
|
||||
describe('middleware.ts: internal-token path for /api/0pt/quality/bridge-run', () => {
|
||||
const saved = { auth: process.env.AUTH_ENFORCE, internal: process.env.INTERNAL_TOKEN, node: process.env.NODE_ENV };
|
||||
|
||||
@@ -31,8 +35,8 @@ describe('middleware.ts: internal-token path for /api/0pt/quality/bridge-run', (
|
||||
afterEach(() => {
|
||||
for (const [k, v] of Object.entries(saved)) {
|
||||
const envKey = k === 'auth' ? 'AUTH_ENFORCE' : k === 'internal' ? 'INTERNAL_TOKEN' : 'NODE_ENV';
|
||||
if (v === undefined) delete process.env[envKey];
|
||||
else process.env[envKey] = v;
|
||||
if (v === undefined) delete mutableEnv[envKey];
|
||||
else mutableEnv[envKey] = v;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* SEO regression guard: sitemap vs. indexation policy, and per-dataset
|
||||
* canonicals on /katalog/[id].
|
||||
*
|
||||
* PR #622 made /bestall*, noindex via app/bestall/layout.tsx but left those
|
||||
* steps in app/sitemap.ts, and the new /katalog layout canonical leaked down
|
||||
* to every dataset detail. These tests exercise the public surfaces together:
|
||||
* home (sitemap root), catalog, two datasets, an order step, sitemap + robots.
|
||||
*/
|
||||
import { describe, it, expect } from "vitest";
|
||||
import type { Metadata } from "next";
|
||||
import sitemap from "@/app/sitemap";
|
||||
import robots from "@/app/robots";
|
||||
import { metadata as catalogMetadata } from "@/app/katalog/layout";
|
||||
import { metadata as bestallMetadata } from "@/app/bestall/layout";
|
||||
import { generateMetadata as datasetGenerateMetadata } from "@/app/katalog/[id]/layout";
|
||||
import { CATALOG } from "@/app/katalog/datasets";
|
||||
|
||||
const BASE = "https://0pt.app";
|
||||
|
||||
function canonicalOf(m: Metadata): unknown {
|
||||
return m.alternates?.canonical;
|
||||
}
|
||||
|
||||
// Next's Metadata.robots is `string | Robots`; the root layout sets
|
||||
// index:true, so an unset value means the detail stays indexable.
|
||||
function isIndexed(m: Metadata): boolean {
|
||||
const r = m.robots;
|
||||
if (r === undefined || r === null) return true;
|
||||
if (typeof r === "string") return r !== "noindex" && r !== "none";
|
||||
return r.index !== false;
|
||||
}
|
||||
|
||||
function datasetMeta(id: string): Promise<Metadata> {
|
||||
// Next 16 passes dynamic route params as a Promise to generateMetadata.
|
||||
return datasetGenerateMetadata({ params: Promise.resolve({ id }) });
|
||||
}
|
||||
|
||||
describe("sitemap — public pages only", () => {
|
||||
const urls = () => sitemap().map((entry) => entry.url);
|
||||
|
||||
it("lists home, tjanster, katalog and kallor — and nothing else", () => {
|
||||
expect(urls()).toEqual([
|
||||
`${BASE}`,
|
||||
`${BASE}/tjanster`,
|
||||
`${BASE}/katalog`,
|
||||
`${BASE}/kallor`,
|
||||
]);
|
||||
});
|
||||
|
||||
it("never lists the noindex order flow (/bestall*)", () => {
|
||||
expect(urls().filter((url) => url.startsWith(`${BASE}/bestall`))).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps home as the top-priority entry", () => {
|
||||
const home = sitemap().find((entry) => entry.url === `${BASE}`);
|
||||
expect(home).toBeDefined();
|
||||
expect(home?.priority).toBe(1);
|
||||
for (const entry of sitemap().filter((e) => e.url !== `${BASE}`)) {
|
||||
expect(entry.priority).toBeLessThan(1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("robots + order-step indexation", () => {
|
||||
it("allows public crawling, disallows auth surfaces and advertises the sitemap", () => {
|
||||
const rules = robots().rules as Array<{
|
||||
userAgent: string;
|
||||
allow?: string;
|
||||
disallow?: string | string[];
|
||||
}>;
|
||||
expect(rules[0].userAgent).toBe("*");
|
||||
expect(rules[0].allow).toBe("/");
|
||||
expect(rules[0].disallow).toEqual(["/portal/", "/admin/", "/order/", "/api/"]);
|
||||
expect(robots().sitemap).toBe(`${BASE}/sitemap.xml`);
|
||||
});
|
||||
|
||||
it("the order step is noindex/follow and stays out of the sitemap", () => {
|
||||
expect(bestallMetadata.robots).toMatchObject({ index: false, follow: true });
|
||||
expect(sitemap().map((e) => e.url).some((u) => u.includes("/bestall"))).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("catalog + dataset detail canonicals", () => {
|
||||
it("the catalog index keeps its own canonical", () => {
|
||||
expect(canonicalOf(catalogMetadata)).toBe(`${BASE}/katalog`);
|
||||
});
|
||||
|
||||
it("every indexable dataset detail carries its own canonical, title and description", async () => {
|
||||
expect(CATALOG).toHaveLength(6);
|
||||
for (const dataset of CATALOG) {
|
||||
const meta = await datasetMeta(dataset.id);
|
||||
expect(canonicalOf(meta)).toBe(`${BASE}/katalog/${dataset.id}`);
|
||||
expect(canonicalOf(meta)).not.toBe(canonicalOf(catalogMetadata));
|
||||
expect(String(meta.title)).toContain(dataset.title.en);
|
||||
expect(String(meta.description ?? "")).toContain(dataset.blurb.en);
|
||||
// Root layout declares index:true; details must not silently opt out.
|
||||
expect(isIndexed(meta)).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it("two different datasets resolve to distinct canonicals and titles", async () => {
|
||||
const a = await datasetMeta("nordic-companies");
|
||||
const b = await datasetMeta("tech-decisionmakers");
|
||||
expect(canonicalOf(a)).toBe(`${BASE}/katalog/nordic-companies`);
|
||||
expect(canonicalOf(b)).toBe(`${BASE}/katalog/tech-decisionmakers`);
|
||||
expect(canonicalOf(a)).not.toBe(canonicalOf(b));
|
||||
expect(a.title).not.toBe(b.title);
|
||||
});
|
||||
|
||||
it("canonical uses the stable catalogue id even for a non-normalized request", async () => {
|
||||
const meta = await datasetMeta("Nordic-Companies");
|
||||
expect(canonicalOf(meta)).toBe(`${BASE}/katalog/nordic-companies`);
|
||||
});
|
||||
|
||||
it("an unknown dataset id is explicitly noindex and canonicals to the catalog", async () => {
|
||||
const meta = await datasetMeta("does-not-exist");
|
||||
expect(meta.robots).toMatchObject({ index: false, follow: true });
|
||||
expect(canonicalOf(meta)).toBe(`${BASE}/katalog`);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user