diff --git a/.astro/content.d.ts b/.astro/content.d.ts index fabc448..2a98031 100644 --- a/.astro/content.d.ts +++ b/.astro/content.d.ts @@ -164,9 +164,11 @@ declare module 'astro:content' { type DataEntryMap = { "knowledgebase": Record; rendered?: RenderedContent; filePath?: string; }>; diff --git a/.env.example b/.env.example index d2a8622..73f7ea9 100644 --- a/.env.example +++ b/.env.example @@ -30,6 +30,7 @@ NODE_ENV=development # Set to true to require authentication (RECOMMENDED for production) AUTHENTICATION_NECESSARY_CONTRIBUTIONS=false AUTHENTICATION_NECESSARY_AI=false +AUTHENTICATION_NECESSARY_GATEDCONTENT=true # OIDC Provider Configuration OIDC_ENDPOINT=https://your-nextcloud.com/index.php/apps/oidc diff --git a/src/content/config.ts b/src/content/config.ts index 058a80b..32bc781 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -16,6 +16,11 @@ const knowledgebaseCollection = defineCollection({ tags: z.array(z.string()).default([]), published: z.boolean().default(true), + gated_content: z.boolean().default(false), // NEW: Gated content flag }) -}); \ No newline at end of file +}); + +export const collections = { + knowledgebase: knowledgebaseCollection +}; \ No newline at end of file diff --git a/src/content/knowledgebase/tool-velociraptor.md b/src/content/knowledgebase/tool-velociraptor.md index efd55f2..ab4afa5 100644 --- a/src/content/knowledgebase/tool-velociraptor.md +++ b/src/content/knowledgebase/tool-velociraptor.md @@ -6,6 +6,7 @@ last_updated: 2025-07-20 author: "Claude 4 Sonnett (Prompt: Mario Stöckl)" difficulty: "advanced" categories: ["incident-response", "malware-analysis", "network-forensics"] +gated_content: true tags: ["web-based", "endpoint-monitoring", "artifact-extraction", "scripting", "live-forensics", "hunting"] sections: overview: true diff --git a/src/env.d.ts b/src/env.d.ts index f8019ef..7583911 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -25,9 +25,9 @@ declare global { findToolByIdentifier: (tools: any[], identifier: string) => any | undefined; isToolHosted: (tool: any) => boolean; - checkClientAuth: (context?: string) => Promise<{authenticated: boolean; authRequired: boolean; expires?: string}>; - requireClientAuth: (callback?: () => void, returnUrl?: string, context?: string) => Promise; - showIfAuthenticated: (selector: string, context?: string) => Promise; + checkClientAuth: (context?: 'contributions' | 'ai' | 'general' | 'gatedcontent') => Promise<{authenticated: boolean; authRequired: boolean; expires?: string}>; + requireClientAuth: (callback?: () => void, returnUrl?: string, context?: 'contributions' | 'ai' | 'general' | 'gatedcontent') => Promise; + showIfAuthenticated: (selector: string, context?: 'contributions' | 'ai' | 'general' | 'gatedcontent') => Promise; setupAuthButtons: (selector?: string) => void; scrollToElement: (element: Element | null, options?: ScrollIntoViewOptions) => void; diff --git a/src/pages/api/auth/status.ts b/src/pages/api/auth/status.ts index 3dfb749..cd67258 100644 --- a/src/pages/api/auth/status.ts +++ b/src/pages/api/auth/status.ts @@ -9,13 +9,16 @@ export const GET: APIRoute = async ({ request }) => { return await handleAPIRequest(async () => { const contributionAuth = await withAPIAuth(request, 'contributions'); const aiAuth = await withAPIAuth(request, 'ai'); + const gatedContentAuth = await withAPIAuth(request, 'gatedcontent'); // ADDED return apiResponse.success({ - authenticated: contributionAuth.authenticated || aiAuth.authenticated, + authenticated: contributionAuth.authenticated || aiAuth.authenticated || gatedContentAuth.authenticated, contributionAuthRequired: contributionAuth.authRequired, aiAuthRequired: aiAuth.authRequired, + gatedContentAuthRequired: gatedContentAuth.authRequired, // ADDED contributionAuthenticated: contributionAuth.authenticated, aiAuthenticated: aiAuth.authenticated, + gatedContentAuthenticated: gatedContentAuth.authenticated, // ADDED expires: contributionAuth.session?.exp ? new Date(contributionAuth.session.exp * 1000).toISOString() : null }); }, 'Status check failed'); diff --git a/src/pages/contribute/knowledgebase.astro b/src/pages/contribute/knowledgebase.astro index 95874fa..54130f0 100644 --- a/src/pages/contribute/knowledgebase.astro +++ b/src/pages/contribute/knowledgebase.astro @@ -166,6 +166,14 @@ const sortedTools = data.tools.sort((a: any, b: any) => a.name.localeCompare(b.n +
+ + Nur für interne oder vertrauliche Inhalte +
+