Security Owasp logo

Security Owasp

Organization
navikt
security-owasp

OWASP Top 10:2025 kodenivå-mønstre for Kotlin, Go, Java og Node.js — tilgangskontroll, forsyningskjede, injeksjon og feilhåndtering

Overview

Publishernavikt
Repositorycopilot
Skill namesecurity-owasp
Stars
60
Forks
16
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by navikt on GitHub. Read the source before you install it.

Installation

Install the Security Owasp AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/navikt/copilot/tree/main/skills/security-owasp
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/navikt/copilot.git /tmp/copilot
mkdir -p .claude/skills
cp -r /tmp/copilot/skills/security-owasp .claude/skills/security-owasp
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Security Owasp in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Security Owasp on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Security Owasp is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

OWASP Top 10:2025 — Code-Level Security

Tactical security patterns for Kotlin, Go, Java, and Node.js on NAIS, aligned with the 2025 OWASP Top 10.

Complements @security-champion-agent (architecture-level threat modeling) and the security-review skill (scanning tools).

Full code examples for each category: see examples.md in this skill directory.

A01: Broken Access Control (incl. SSRF)

kotlin
// ❌ IDOR — trusts user-supplied ID without ownership check
get("/api/vedtak/{id}") {
    val vedtak = vedtakRepository.findById(call.parameters["id"]!!.toLong())
    call.respond(vedtak)
}

// ✅ Verify ownership before returning resource
get("/api/vedtak/{id}") {
    val bruker = call.hentBruker()
    val vedtak = vedtakRepository.findById(call.parameters["id"]!!.toLong())
        ?: return@get call.respond(HttpStatusCode.NotFound)
    if (vedtak.brukerId != bruker.id) return@get call.respond(HttpStatusCode.Forbidden)
    call.respond(vedtak.toDTO())
}
go
// ✅ SSRF prevention — validate outbound URL against allowlist
func fetchExternal(targetURL string) error {
    parsed, err := url.Parse(targetURL)
    if err != nil { return err }
    if !isAllowedHost(parsed.Host) { return fmt.Errorf("host not allowed: %s", parsed.Host) }
    // proceed with request
}
  • Deny by default — require explicit grants, not explicit denials
  • Resource-level checks — not just "is authenticated" but "owns this resource"
  • M2M tokens — validate azp claim against AZURE_APP_PRE_AUTHORIZED_APPS
  • SSRF — validate outbound URLs; use Nais accessPolicy.outbound as defense-in-depth

A02: Security Misconfiguration

kotlin
// ❌ Open CORS
install(CORS) { anyHost() }

// ✅ Restrict to known origins
install(CORS) { allowHost("my-app.intern.nav.no", schemes = listOf("https")) }
go
// ❌ Debug endpoint exposed on public ingress
mux.HandleFunc("/debug/pprof/", pprof.Index)

// ✅ Debug endpoints on separate internal-only port (Nais handles this)
internalMux := http.NewServeMux()
internalMux.HandleFunc("/debug/pprof/", pprof.Index)
go http.ListenAndServe(":9090", internalMux) // not exposed via ingress
  • CORS restricted to known origins — never * or anyHost()
  • Debug/admin endpoints not on public ingress
  • Error responses sanitized — no stack traces, SQL errors, or file paths to client
  • Default-deny Nais accessPolicy — explicit inbound/outbound only

A03: Software Supply Chain Failures (NEW in 2025)

go
// go.sum provides integrity verification — always commit it
// Use govulncheck for known vulnerabilities
// $ govulncheck ./...

// ✅ Pin dependencies to exact versions in go.mod
require (
    golang.org/x/crypto v0.31.0
    github.com/jackc/pgx/v5 v5.7.2
)
kotlin
// build.gradle.kts — use dependency locking and BOM
dependencyLocking { lockAllConfigurations() }
dependencyManagement {
    imports { mavenBom("org.springframework.boot:spring-boot-dependencies:3.5.16") }
}
// Run: ./gradlew dependencies --write-locks
yaml
# ✅ GitHub Actions — pin to full SHA, never @main or floating tags
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# ❌ Vulnerable to supply chain attack
- uses: actions/checkout@main
  • Pin all dependencies to exact versions; use lockfiles
  • Scan dependencies: govulncheck ./..., trivy repo ., ./gradlew dependencyCheckAnalyze
  • GitHub Actions pinned to full commit SHA (not tags)
  • Generate SBOM for production artifacts when possible
  • Prefer well-maintained, first-party packages

A04: Cryptographic Failures

go
// ❌ Disabling TLS verification
client := &http.Client{
    Transport: &http.Transport{
        TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
    },
}

// ✅ Default TLS config (Go enforces TLS 1.2+ by default)
client := &http.Client{}
kotlin
// ❌ Weak hashing for passwords
val hash = MessageDigest.getInstance("MD5").digest(password.toByteArray())

// ✅ bcrypt for password hashing
val hashed = BCrypt.hashpw(password, BCrypt.gensalt(12))
  • Passwords: bcrypt (cost ≥ 12) or argon2id — never MD5/SHA-1/SHA-256
  • Secrets: always from Nais environment variables or Secret resources — never hardcoded
  • TLS 1.2+: never set InsecureSkipVerify: true
  • Encryption: AES-256-GCM; rotate keys periodically

A05: Injection

kotlin
// ❌ SQL injection via string template
session.run(queryOf("SELECT * FROM vedtak WHERE status = '$status'").map { ... }.asList)

// ✅ Parameterized query (Kotliquery)
session.run(queryOf("SELECT * FROM vedtak WHERE status = ?", status).map { ... }.asList)
go
// ❌ Command injection via shell
exec.Command("sh", "-c", fmt.Sprintf("process %s", userInput)).Run()

// ✅ Pass arguments directly (no shell interpretation)
exec.Command("process", userInput).Run()
  • All SQL queries parameterized (? / $1) — never string concatenation
  • No shell execution with user-controlled input
  • Validate/sanitize all external input at service boundary

A09: Security Logging and Alerting Failures

kotlin
// ✅ Structured logging with correlation ID, no PII
log.info("Vedtak opprettet", kv("vedtakId", vedtak.id), kv("sakId", sak.id))

// ❌ PII in logs — GDPR violation
log.info("Vedtak for bruker ${bruker.fnr}")
  • No PII in logs (fnr, name, address, tokens)
  • Audit trail for sensitive operations (vedtak, utbetaling, tilgang)
  • Correlation IDs propagated across services (OpenTelemetry trace context)
  • Alerting on anomalous patterns (auth failures, rate spikes)

A10: Mishandling of Exceptional Conditions (NEW in 2025)

go
// ❌ Panic leaks to caller, crashes service
func processRequest(data []byte) Result {
    var req Request
    json.Unmarshal(data, &req) // ignores error, req may be zero-value
    return handle(req)
}

// ✅ Handle errors explicitly, fail safely
func processRequest(data []byte) (Result, error) {
    var req Request
    if err := json.Unmarshal(data, &req); err != nil {
        return Result{}, fmt.Errorf("invalid request payload: %w", err)
    }
    return handle(req)
}
kotlin
// ❌ Swallowing exceptions silently
fun process(data: String): Result {
    try { return parse(data) }
    catch (e: Exception) { return Result.empty() } // silent failure, no logging
}

// ✅ Log, wrap, and surface errors appropriately
fun process(data: String): Result {
    return try { parse(data) }
    catch (e: Exception) {
        log.error("Parsing failed", kv("error", e.message))
        throw ServiceException("Could not process input", e)
    }
}
  • Always handle errors — never ignore returned errors in Go
  • Recover from panics at HTTP handler boundaries (middleware)
  • Fail securely: deny access by default when state is uncertain
  • Sanitize error messages: internal details stay in logs, not in responses
  • Centralized error handling via middleware/exception mappers

Quick Reference Checklist

  • A01 — Resource-level access checks on every endpoint (not just auth)
  • A01 — M2M tokens validate azp against pre-authorized apps
  • A01 — Outbound URLs validated; Nais egress policy configured
  • A02 — CORS restricted to known origins
  • A02 — Debug endpoints not on public ingress
  • A02 — Error responses sanitized (no stack traces to client)
  • A03 — Dependencies pinned to exact versions with lockfiles
  • A03 — govulncheck / trivy repo . pass without HIGH/CRITICAL
  • A03 — GitHub Actions pinned to full SHA
  • A04 — bcrypt/argon2id for passwords, never MD5/SHA-1
  • A04 — TLS 1.2+ enforced, no InsecureSkipVerify
  • A04 — Secrets from environment/Nais, never hardcoded
  • A05 — All SQL queries parameterized (? / $1)
  • A05 — No shell execution with user input
  • A07 — JWT validates exp, iss, aud, and algorithm
  • A08 — Deserialization into concrete types only
  • A09 — No PII in logs (fnr, name, address)
  • A09 — Audit trail for sensitive operations
  • A10 — All errors handled (no ignored returns in Go)
  • A10 — Panic recovery in HTTP handlers
  • A10 — Error messages sanitized before client responses

Related

ResourceUse For
security-review skillPre-commit scanning (trivy, zizmor, govulncheck)
@security-champion-agentThreat modeling, compliance, Nav security architecture
$nav-authJWT validation, TokenX, ID-porten implementation
threat-model skillSTRIDE-A analysis for new services
OWASP Top 10:2025Official category descriptions
OWASP Go SCPGo-specific secure coding guide
OWASP CI/CD Top 10Pipeline security risks
sikkerhet.nav.noNav Golden Path

Boundaries

✅ Always

  • Parameterized queries for all SQL
  • Resource-level access checks on every data-returning endpoint
  • Structured logging without PII
  • SHA-pinned GitHub Actions
  • Explicit error handling (no ignored errors)
  • Dependencies scanned before release

⚠️ Ask First

  • Custom cryptographic implementations
  • Disabling security features for testing
  • Changing authentication or authorization logic
  • Adding new outbound external hosts

🚫 Never

  • String-concatenated SQL queries
  • InsecureSkipVerify: true in production
  • PII in log statements (fnr, name, address)
  • Wildcard CORS (* / anyHost())
  • Hardcoded secrets or encryption keys
  • Floating tags (@main, @v3) for GitHub Actions
  • Silently swallowing errors without logging

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Security Owasp AI skill do?

OWASP Top 10:2025 kodenivå-mønstre for Kotlin, Go, Java og Node.js — tilgangskontroll, forsyningskjede, injeksjon og feilhåndtering

Why use Security Owasp on TypingMind?

Because you install it once and use it with any model. Security Owasp is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Security Owasp in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/navikt/copilot/tree/main/skills/security-owasp. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Security Owasp?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Security Owasp?

As many as you like. As long as a model supports skills, you can use Security Owasp with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Security Owasp AI skill free?

Yes. It is published on GitHub by navikt under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇