KMNS logo KMNS / Validate Docs
v0.4.0 ← Platform Hub GitHub ↗

Files & Permissions

Asserts presence, permissions, mode, ownership, and contents of files and directories using direct stat syscalls.


Canonical Syntax (kmns.io/validate/v1alpha1)

# yaml-language-server: $schema=https://kmns.io/validate/v1alpha1
schema_version: kmns.io/validate/v1alpha1
id: filesystem-integrity-contract
metadata:
  name: "Critical Configuration Files"
  description: "Assert ownership and permissions on security files"
  severity: high
checks:
  - id: FILE_HOSTS
    kind: resource
    metadata:
      name: "Hosts Resolution File"
      severity: medium
    resource:
      kind: file
      path: /etc/hosts
    expect:
      exists: true
      mode: "0644"
      owner: "root"

  - id: FILE_SECRET_ENV
    kind: resource
    metadata:
      name: "Encrypted SOPS Secrets"
      severity: critical
    resource:
      kind: file
      path: /etc/kmns/secrets.sops.env
    expect:
      exists: true
      mode: "0600"
      filetype: file

Supported Attributes

Resource Parameters (resource:)

FieldTypeRequiredDescription
kindstringYesMust be file
pathstringYesAbsolute filesystem path

Expectations (expect:)

FieldTypeDescription
existsbooleanPath exists in filesystem (true or false)
modestringExpected octal permissions mode (e.g. "0644", "0600")
ownerstringExpected owner username or UID
groupstringExpected group name or GID
filetypestringExpected file type (file, directory, symlink)
contentslist of stringSubstrings that must be present in file contents