nac-validate 2.0.0b2__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/.github/dependabot.yml +10 -3
- nac_validate-2.1.0/.github/workflows/release.yml +148 -0
- nac_validate-2.1.0/.github/workflows/test.yml +188 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/.gitignore +0 -1
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/.pre-commit-config.yaml +9 -5
- nac_validate-2.1.0/CHANGELOG.md +116 -0
- nac_validate-2.0.0b2/README.md → nac_validate-2.1.0/PKG-INFO +124 -8
- nac_validate-2.0.0b2/PKG-INFO → nac_validate-2.1.0/README.md +82 -48
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/cli/main.py +95 -26
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/cli/options.py +60 -4
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/constants.py +5 -2
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/exceptions.py +24 -2
- nac_validate-2.1.0/nac_validate/layers.py +155 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/models.py +1 -1
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/output_formatter.py +168 -11
- nac_validate-2.1.0/nac_validate/schema/__init__.py +111 -0
- nac_validate-2.1.0/nac_validate/schema/base.py +60 -0
- nac_validate-2.1.0/nac_validate/schema/primary_key.py +97 -0
- nac_validate-2.1.0/nac_validate/schema/walker.py +160 -0
- nac_validate-2.1.0/nac_validate/validator.py +978 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/pyproject.toml +24 -32
- nac_validate-2.1.0/release-notes.md +15 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/scripts/license-headers.sh +6 -4
- nac_validate-2.1.0/tests/integration/fixtures/data_composite_key_conflict/file1.yaml +9 -0
- nac_validate-2.1.0/tests/integration/fixtures/data_composite_key_conflict/file2.yaml +6 -0
- nac_validate-2.1.0/tests/integration/fixtures/data_primary_key/file1.yaml +5 -0
- nac_validate-2.1.0/tests/integration/fixtures/data_primary_key/file2.yaml +6 -0
- nac_validate-2.1.0/tests/integration/fixtures/data_primary_key_conflict/file1.yaml +5 -0
- nac_validate-2.1.0/tests/integration/fixtures/data_primary_key_conflict/file2.yaml +5 -0
- nac_validate-2.1.0/tests/integration/fixtures/data_vault/data.yaml +10 -0
- nac_validate-2.1.0/tests/integration/fixtures/rules/rule_102.py +34 -0
- nac_validate-2.1.0/tests/integration/fixtures/schema_composite_key/schema.yaml +10 -0
- nac_validate-2.1.0/tests/integration/fixtures/schema_invalid_extension/schema.yaml +9 -0
- nac_validate-2.1.0/tests/integration/fixtures/schema_primary_key/schema.yaml +10 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/test_integration.py +108 -4
- nac_validate-2.1.0/tests/unit/conftest.py +28 -0
- nac_validate-2.1.0/tests/unit/helpers.py +125 -0
- nac_validate-2.1.0/tests/unit/test_cli.py +844 -0
- nac_validate-2.1.0/tests/unit/test_layers.py +227 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/unit/test_output_formatter.py +168 -54
- nac_validate-2.1.0/tests/unit/test_schema.py +527 -0
- nac_validate-2.1.0/tests/unit/test_validator.py +879 -0
- nac_validate-2.1.0/uv.lock +932 -0
- nac_validate-2.0.0b2/.github/workflows/release.yml +0 -21
- nac_validate-2.0.0b2/.github/workflows/test.yml +0 -136
- nac_validate-2.0.0b2/CHANGELOG.md +0 -99
- nac_validate-2.0.0b2/nac_validate/validator.py +0 -475
- nac_validate-2.0.0b2/tests/integration/fixtures/data_vault/data.yaml +0 -10
- nac_validate-2.0.0b2/tests/unit/test_cli.py +0 -147
- nac_validate-2.0.0b2/tests/unit/test_validator.py +0 -218
- nac_validate-2.0.0b2/uv.lock +0 -1207
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/.pre-commit-hooks.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/LICENSE +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/__main__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/nac_validate/cli/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/__init__.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/additional_data/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/additional_data_schema/schema.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_empty/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_empty/empty.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_env/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_merge/file1.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_merge/file2.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_merge/result.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_non_strict/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_semantic_error/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/data_syntax_error/data.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/rules/rule_101.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/rules_schema/rule_101.py +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/integration/fixtures/schema/schema.yaml +0 -0
- {nac_validate-2.0.0b2 → nac_validate-2.1.0}/tests/unit/__init__.py +0 -0
|
@@ -6,12 +6,19 @@ updates:
|
|
|
6
6
|
directory: '/'
|
|
7
7
|
schedule:
|
|
8
8
|
interval: 'daily'
|
|
9
|
+
cooldown:
|
|
10
|
+
default-days: 3
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
# Native uv support updates pyproject.toml and uv.lock in the same pull request
|
|
13
|
+
- package-ecosystem: 'uv'
|
|
11
14
|
directory: '/'
|
|
12
15
|
schedule:
|
|
13
16
|
interval: 'daily'
|
|
14
|
-
# Note: lockfile-only removed because dependabot doesn't support uv.lock
|
|
15
|
-
# The workflow will auto-update uv.lock when pyproject.toml changes
|
|
16
17
|
allow:
|
|
17
18
|
- dependency-type: 'all'
|
|
19
|
+
cooldown:
|
|
20
|
+
default-days: 3
|
|
21
|
+
# Maintained by us, so new releases are picked up right away
|
|
22
|
+
exclude:
|
|
23
|
+
- 'nac-artifacts'
|
|
24
|
+
- 'nac-yaml'
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Actions are pinned to commit SHAs (not version tags) to prevent supply chain attacks.
|
|
2
|
+
# Version comments (e.g., "# v7") allow Dependabot to track and update to newer versions.
|
|
3
|
+
name: Release
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
uses: ./.github/workflows/test.yml
|
|
13
|
+
|
|
14
|
+
build:
|
|
15
|
+
needs: test
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
24
|
+
|
|
25
|
+
- name: Check tag matches project version
|
|
26
|
+
env:
|
|
27
|
+
TAG: ${{ github.ref_name }}
|
|
28
|
+
run: |
|
|
29
|
+
VERSION=$(uv version --short)
|
|
30
|
+
if [ "$TAG" != "v$VERSION" ]; then
|
|
31
|
+
echo "Tag $TAG does not match pyproject.toml version $VERSION"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
- name: Extract release notes from CHANGELOG.md
|
|
36
|
+
env:
|
|
37
|
+
TAG: ${{ github.ref_name }}
|
|
38
|
+
run: |
|
|
39
|
+
# Take the body of the "## <version>" section, up to the next "## " heading.
|
|
40
|
+
# Fails here, before anything is published, if the section is missing,
|
|
41
|
+
# still marked "unreleased" or empty.
|
|
42
|
+
VERSION="${TAG#v}"
|
|
43
|
+
rc=0
|
|
44
|
+
notes=$(awk -v v="$VERSION" '
|
|
45
|
+
/^## / {
|
|
46
|
+
if (found) exit
|
|
47
|
+
h = $2
|
|
48
|
+
gsub(/[][]/, "", h)
|
|
49
|
+
if (h == v) {
|
|
50
|
+
found = 1
|
|
51
|
+
if (tolower($0) ~ /unreleased/) unreleased = 1
|
|
52
|
+
}
|
|
53
|
+
next
|
|
54
|
+
}
|
|
55
|
+
found { print }
|
|
56
|
+
END {
|
|
57
|
+
if (!found) exit 2
|
|
58
|
+
if (unreleased) exit 3
|
|
59
|
+
}
|
|
60
|
+
' CHANGELOG.md) || rc=$?
|
|
61
|
+
if [ "$rc" -eq 2 ]; then
|
|
62
|
+
echo "::error::No '## $VERSION' section found in CHANGELOG.md"
|
|
63
|
+
exit 1
|
|
64
|
+
elif [ "$rc" -eq 3 ]; then
|
|
65
|
+
echo "::error::CHANGELOG.md section for $VERSION is still marked unreleased"
|
|
66
|
+
exit 1
|
|
67
|
+
elif [ "$rc" -ne 0 ]; then
|
|
68
|
+
echo "::error::Failed to read CHANGELOG.md"
|
|
69
|
+
exit 1
|
|
70
|
+
fi
|
|
71
|
+
if [ -z "$(printf '%s' "$notes" | tr -d '[:space:]')" ]; then
|
|
72
|
+
echo "::error::CHANGELOG.md section for $VERSION is empty"
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
printf '%s\n' "$notes" > release-notes.md
|
|
76
|
+
|
|
77
|
+
- name: Build
|
|
78
|
+
run: uv build
|
|
79
|
+
|
|
80
|
+
- name: Upload distributions
|
|
81
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
82
|
+
with:
|
|
83
|
+
name: dist
|
|
84
|
+
path: dist/
|
|
85
|
+
if-no-files-found: error
|
|
86
|
+
|
|
87
|
+
- name: Upload release notes
|
|
88
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
89
|
+
with:
|
|
90
|
+
name: release-notes
|
|
91
|
+
path: release-notes.md
|
|
92
|
+
if-no-files-found: error
|
|
93
|
+
|
|
94
|
+
# Publishing is a separate job so that only it can mint the OIDC token PyPI
|
|
95
|
+
# trusts; the build step above never has access to it.
|
|
96
|
+
publish:
|
|
97
|
+
needs: build
|
|
98
|
+
runs-on: ubuntu-latest
|
|
99
|
+
environment: pypi
|
|
100
|
+
permissions:
|
|
101
|
+
contents: read
|
|
102
|
+
id-token: write # Required for PyPI trusted publishing
|
|
103
|
+
steps:
|
|
104
|
+
- name: Install uv
|
|
105
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
106
|
+
|
|
107
|
+
- name: Download distributions
|
|
108
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
109
|
+
with:
|
|
110
|
+
name: dist
|
|
111
|
+
path: dist/
|
|
112
|
+
|
|
113
|
+
- name: Publish to PyPI
|
|
114
|
+
run: uv publish --trusted-publishing always
|
|
115
|
+
|
|
116
|
+
github-release:
|
|
117
|
+
needs: publish
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
permissions:
|
|
120
|
+
contents: write # Required to create the release
|
|
121
|
+
steps:
|
|
122
|
+
- name: Download distributions
|
|
123
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
124
|
+
with:
|
|
125
|
+
name: dist
|
|
126
|
+
path: dist/
|
|
127
|
+
|
|
128
|
+
- name: Download release notes
|
|
129
|
+
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
130
|
+
with:
|
|
131
|
+
name: release-notes
|
|
132
|
+
|
|
133
|
+
- name: Create GitHub release
|
|
134
|
+
env:
|
|
135
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
136
|
+
GH_REPO: ${{ github.repository }}
|
|
137
|
+
TAG: ${{ github.ref_name }}
|
|
138
|
+
run: |
|
|
139
|
+
# Versions with a letter (e.g. 1.0.0rc1) are marked as pre-releases
|
|
140
|
+
PRERELEASE=""
|
|
141
|
+
if [[ "${TAG#v}" =~ [a-zA-Z] ]]; then
|
|
142
|
+
PRERELEASE="--prerelease"
|
|
143
|
+
fi
|
|
144
|
+
gh release create "$TAG" dist/* \
|
|
145
|
+
--verify-tag \
|
|
146
|
+
--title "$TAG" \
|
|
147
|
+
--notes-file release-notes.md \
|
|
148
|
+
$PRERELEASE
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Actions are pinned to commit SHAs (not version tags) to prevent supply chain attacks.
|
|
2
|
+
# Version comments (e.g., "# v7") allow Dependabot to track and update to newer versions.
|
|
3
|
+
name: Tests
|
|
4
|
+
on:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
pull_request:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
workflow_call:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
security:
|
|
14
|
+
name: Security Scan
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
timeout-minutes: 5
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout
|
|
21
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
|
|
28
|
+
- name: Install bandit
|
|
29
|
+
run: uv tool install bandit[toml]
|
|
30
|
+
|
|
31
|
+
- name: Run bandit security scan
|
|
32
|
+
run: bandit -r nac_validate/ -ll -f json -o bandit-security-report.json
|
|
33
|
+
|
|
34
|
+
- name: Upload security report
|
|
35
|
+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
36
|
+
if: always()
|
|
37
|
+
with:
|
|
38
|
+
name: bandit-security-report
|
|
39
|
+
path: bandit-security-report.json
|
|
40
|
+
|
|
41
|
+
lint:
|
|
42
|
+
name: Lint
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
timeout-minutes: 5
|
|
45
|
+
permissions:
|
|
46
|
+
contents: read
|
|
47
|
+
steps:
|
|
48
|
+
- name: Checkout
|
|
49
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
50
|
+
|
|
51
|
+
- name: Install uv
|
|
52
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
53
|
+
with:
|
|
54
|
+
enable-cache: true
|
|
55
|
+
|
|
56
|
+
- name: Sync dependencies
|
|
57
|
+
run: uv sync --extra dev
|
|
58
|
+
|
|
59
|
+
- name: Check License Headers
|
|
60
|
+
run: bash scripts/license-headers.sh
|
|
61
|
+
|
|
62
|
+
- name: Pre-commit Checks
|
|
63
|
+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
|
|
64
|
+
|
|
65
|
+
test:
|
|
66
|
+
name: Tests
|
|
67
|
+
runs-on: ${{ matrix.os }}
|
|
68
|
+
timeout-minutes: 10
|
|
69
|
+
permissions:
|
|
70
|
+
contents: read
|
|
71
|
+
strategy:
|
|
72
|
+
matrix:
|
|
73
|
+
os:
|
|
74
|
+
- ubuntu-latest
|
|
75
|
+
- macos-latest
|
|
76
|
+
- windows-latest
|
|
77
|
+
python:
|
|
78
|
+
- "3.11"
|
|
79
|
+
- "3.12"
|
|
80
|
+
- "3.13"
|
|
81
|
+
- "3.14"
|
|
82
|
+
steps:
|
|
83
|
+
- name: Checkout
|
|
84
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
85
|
+
|
|
86
|
+
- name: Python Setup
|
|
87
|
+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
|
|
88
|
+
with:
|
|
89
|
+
python-version: ${{ matrix.python }}
|
|
90
|
+
|
|
91
|
+
- name: Install uv
|
|
92
|
+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
|
|
93
|
+
with:
|
|
94
|
+
enable-cache: true
|
|
95
|
+
|
|
96
|
+
- name: Test
|
|
97
|
+
shell: bash
|
|
98
|
+
run: |
|
|
99
|
+
uv sync --extra dev
|
|
100
|
+
uv run pytest
|
|
101
|
+
|
|
102
|
+
notification:
|
|
103
|
+
name: Notification
|
|
104
|
+
# github.workflow is the caller's name when run via workflow_call, so this
|
|
105
|
+
# skips the release run (reusable workflows don't receive the Webex secrets)
|
|
106
|
+
if: always() && github.event_name != 'pull_request' && github.workflow == 'Tests' && github.actor != 'dependabot[bot]'
|
|
107
|
+
needs: [security, lint, test]
|
|
108
|
+
runs-on: ubuntu-latest
|
|
109
|
+
timeout-minutes: 5
|
|
110
|
+
permissions: {}
|
|
111
|
+
steps:
|
|
112
|
+
- name: Check Job Success
|
|
113
|
+
run: |
|
|
114
|
+
if [ ${{ needs.security.result }} == 'success' ] && [ ${{ needs.lint.result }} == 'success' ] && [ ${{ needs.test.result }} == 'success' ]; then
|
|
115
|
+
echo "All jobs succeeded"
|
|
116
|
+
echo "JOB_SUCCESS=success" >> $GITHUB_ENV
|
|
117
|
+
else
|
|
118
|
+
echo "Not all jobs succeeded"
|
|
119
|
+
echo "JOB_SUCCESS=fail" >> $GITHUB_ENV
|
|
120
|
+
fi
|
|
121
|
+
id: print_status
|
|
122
|
+
|
|
123
|
+
- name: Sanitize notification variables
|
|
124
|
+
env:
|
|
125
|
+
# Pass through env to avoid shell injection from server-side expression expansion
|
|
126
|
+
RAW_COMMIT_MSG: ${{ github.event.head_commit.message }}
|
|
127
|
+
RAW_PR_TITLE: ${{ github.event.pull_request.title }}
|
|
128
|
+
run: |
|
|
129
|
+
# Truncate to stay within Webex message size limits (500 chars for commit
|
|
130
|
+
# messages, 200 chars for PR titles are generous practical limits)
|
|
131
|
+
COMMIT_MSG=$(echo "$RAW_COMMIT_MSG" | head -c 500)
|
|
132
|
+
PR_TITLE=$(echo "$RAW_PR_TITLE" | head -c 200)
|
|
133
|
+
|
|
134
|
+
{
|
|
135
|
+
echo "SAFE_COMMIT_MSG<<EOF"
|
|
136
|
+
echo "$COMMIT_MSG"
|
|
137
|
+
echo "EOF"
|
|
138
|
+
echo "SAFE_PR_TITLE<<EOF"
|
|
139
|
+
echo "$PR_TITLE"
|
|
140
|
+
echo "EOF"
|
|
141
|
+
} >> "$GITHUB_ENV"
|
|
142
|
+
|
|
143
|
+
# Using direct curl to Webex API instead of a GitHub Action because:
|
|
144
|
+
# - qsnyder/action-wxt is unmaintained (last commit 2022, no releases)
|
|
145
|
+
# - Direct API call has no third-party action dependency to maintain
|
|
146
|
+
# - Gives full control over error handling and message format
|
|
147
|
+
- name: Webex Notification
|
|
148
|
+
if: always()
|
|
149
|
+
env:
|
|
150
|
+
# Pass sanitized env vars and static context values through env to avoid
|
|
151
|
+
# server-side expression expansion inside the shell script
|
|
152
|
+
JOB_SUCCESS: ${{ env.JOB_SUCCESS }}
|
|
153
|
+
SAFE_COMMIT_MSG: ${{ env.SAFE_COMMIT_MSG }}
|
|
154
|
+
SAFE_PR_TITLE: ${{ env.SAFE_PR_TITLE }}
|
|
155
|
+
WEBEX_TOKEN: ${{ secrets.WEBEX_TOKEN }}
|
|
156
|
+
WEBEX_ROOM_ID: ${{ secrets.WEBEX_ROOM_ID }}
|
|
157
|
+
COMMIT_URL: ${{ github.event.head_commit.url }}
|
|
158
|
+
AUTHOR: ${{ github.event.sender.login }}
|
|
159
|
+
REF: ${{ github.ref }}
|
|
160
|
+
HEAD_REF: ${{ github.head_ref }}
|
|
161
|
+
EVENT: ${{ github.event_name }}
|
|
162
|
+
REPO: ${{ github.repository }}
|
|
163
|
+
RUN_NUM: ${{ github.run_number }}
|
|
164
|
+
RUN_ID: ${{ github.run_id }}
|
|
165
|
+
run: |
|
|
166
|
+
# jq -n --arg handles all JSON escaping; avoids double-encoding from jq -Rs
|
|
167
|
+
PAYLOAD=$(jq -n \
|
|
168
|
+
--arg room_id "$WEBEX_ROOM_ID" \
|
|
169
|
+
--arg status "$JOB_SUCCESS" \
|
|
170
|
+
--arg repo "$REPO" \
|
|
171
|
+
--arg run_num "$RUN_NUM" \
|
|
172
|
+
--arg run_url "https://github.com/$REPO/actions/runs/$RUN_ID" \
|
|
173
|
+
--arg commit_msg "$SAFE_COMMIT_MSG" \
|
|
174
|
+
--arg commit_url "$COMMIT_URL" \
|
|
175
|
+
--arg pr_title "$SAFE_PR_TITLE" \
|
|
176
|
+
--arg author "$AUTHOR" \
|
|
177
|
+
--arg ref "$REF" \
|
|
178
|
+
--arg head_ref "$HEAD_REF" \
|
|
179
|
+
--arg event "$EVENT" \
|
|
180
|
+
'{roomId: $room_id, markdown: ("[**[\($status)] \($repo) #\($run_num)**](\($run_url))\n* Commit: [\($commit_msg)](\($commit_url))\($pr_title)\n* Author: \($author)\n* Branch: \($ref) \($head_ref)\n* Event: \($event)")}')
|
|
181
|
+
# --fail-with-body: exit non-zero on HTTP 4xx/5xx so the || warning fires
|
|
182
|
+
curl --silent --fail-with-body --max-time 30 \
|
|
183
|
+
--request POST \
|
|
184
|
+
--url https://webexapis.com/v1/messages \
|
|
185
|
+
--header "Authorization: Bearer $WEBEX_TOKEN" \
|
|
186
|
+
--header "Content-Type: application/json" \
|
|
187
|
+
--data "$PAYLOAD" \
|
|
188
|
+
|| echo "::warning::Webex notification failed"
|
|
@@ -8,19 +8,23 @@ repos:
|
|
|
8
8
|
types: [python]
|
|
9
9
|
|
|
10
10
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
11
|
-
rev: v0.
|
|
11
|
+
rev: v0.17.2
|
|
12
12
|
hooks:
|
|
13
13
|
- id: ruff-check
|
|
14
14
|
args: [--fix, --exit-non-zero-on-fix]
|
|
15
15
|
- id: ruff-format
|
|
16
16
|
|
|
17
|
-
- repo:
|
|
18
|
-
rev: v1.17.1
|
|
17
|
+
- repo: local
|
|
19
18
|
hooks:
|
|
20
|
-
- id:
|
|
19
|
+
- id: ty
|
|
20
|
+
name: ty
|
|
21
|
+
entry: uv run ty check
|
|
22
|
+
language: system
|
|
23
|
+
types: [python]
|
|
24
|
+
pass_filenames: false
|
|
21
25
|
|
|
22
26
|
- repo: https://github.com/PyCQA/bandit
|
|
23
|
-
rev: 1.
|
|
27
|
+
rev: 1.9.4
|
|
24
28
|
hooks:
|
|
25
29
|
- id: bandit
|
|
26
30
|
args: ['-r', 'nac_validate/']
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
## 2.1.0
|
|
2
|
+
|
|
3
|
+
- Add `primary_key` schema option for lists (`list(include('item'), primary_key='name')`): every item must set the key and its value must be unique within the list, checked per file and on the merged data. A composite key names several comma-separated fields (`primary_key='node_id,name'`), whose combination must be unique
|
|
4
|
+
- Fail loading a schema with an invalid schema option (e.g. `primary_key` on a `str()`), and log a warning for unknown keywords of schema validators, like a misspelled option
|
|
5
|
+
- Drop support for Python 3.10 (end of life); Python 3.11 or later is now required
|
|
6
|
+
- Update nac-yaml to 2.1.0: `!vault` values are now decrypted with the password from `ANSIBLE_VAULT_PASSWORD`
|
|
7
|
+
- Fix syntax validation failure for empty or comment-only YAML files
|
|
8
|
+
- **Packaged schema and rules** (EXPERIMENTAL, may change in future versions and is not subject to semantic versioning guarantees)
|
|
9
|
+
- Add `--artifacts/--no-artifacts` CLI option (env `NAC_VALIDATE_ARTIFACTS`) to opt in to loading schema and rules from bundles and modules; it is off by default for now (implied by `--bundle` and `--module-dir`) and will become the default in a future version
|
|
10
|
+
- Bundles and the module are looked up relative to the current working directory (`nac/bundles/`, `nac/overrides.yaml`, `.terraform/` or `TF_DATA_DIR`), not the location of the data, `-s` or `-r`
|
|
11
|
+
- Discover schema and rules packaged with an installed Terraform module (`nac/schema.yaml`, `nac/rules/`, located via `terraform init`'s `modules.json`) and with bundles dropped into the project (every `.zip`, `.tar.gz` or `.tgz` file and every directory in `nac/bundles/`, holding `schema.yaml` and `rules/` at the bundle root); local `-s`/`-r` and `.schema.yaml`/`.rules/` take priority over the bundle, which takes priority over the module (archives are extracted once into a git-ignored `nac/bundles/.cache/`)
|
|
12
|
+
- Add `--bundle` (repeatable) and `--module-dir` CLI options (env `NAC_VALIDATE_BUNDLE`, `NAC_VALIDATE_MODULE_DIR`). Several bundles are peers of one priority tier and may split rules and the schema between them; a rule ID or schema provided by two bundles is an error, as are two bundles with the same manifest `name` (e.g. an old and a new version left in `nac/bundles/`). Bundles in `nac/bundles/` that provide nothing for nac-validate (e.g. only test templates) are skipped
|
|
13
|
+
- Add `overrides.yaml` to disable rules of lower layers by rule ID (`disable: {rules: [...]}`): `nac/overrides.yaml` in the project disables rules of a bundle and the module, a bundle's `overrides.yaml` disables rules of the module. Local rules are never affected. Entries are declarative: one that matches nothing is not an error, and `--list-artifacts` shows disabled rules and entries that matched no rule
|
|
14
|
+
- Add `--list-artifacts` CLI option showing the effective schema, artifact layers and rules with their origin; `--list-rules` remains as an undocumented alias. Rules are read from their source instead of imported, so listing runs no rule code; a rule whose ID is not a literal is listed as having an unknown ID, and a rule file that is valid Python but incomplete (e.g. without an `id`) is listed instead of failing
|
|
15
|
+
- Fix duplicate rule IDs across multiple `-r` directories going undetected; they now raise an error instead of the later directory silently replacing the earlier rule. Setups that relied on a later `-r` directory replacing a rule now fail; remove or renumber one of the rules
|
|
16
|
+
- Fix unexpected error when a rule declaring an integer ID (`id = 101`) reports a violation; rule IDs are now stored as text when rules are loaded. An ID that is not a number logs a warning and is listed after the numeric IDs instead of breaking `--list-artifacts`; an ID that is not an int or a non-empty string fails loading the rule
|
|
17
|
+
|
|
18
|
+
## 2.0.0
|
|
19
|
+
|
|
20
|
+
- Add `RuleBase` base class for semantic validation rules
|
|
21
|
+
- Overhaul CLI output: validation results now show structured errors with file paths, line context, and rule identifiers, followed by a checklist-style summary per rule
|
|
22
|
+
- Add `--json` CLI option for machine-readable JSON validation output
|
|
23
|
+
- Add `--list-rules` CLI option to display available validation rules
|
|
24
|
+
- Add `--no-color` CLI option to disable colored terminal output
|
|
25
|
+
- Add `--compact` CLI option to reduce output verbosity
|
|
26
|
+
- BREAKING CHANGE (via `nac-yaml`): Rework list merge logic — within-file duplicates are now preserved; if any file contains duplicate dict items in a list, merging is disabled for that entire list and items are concatenated instead
|
|
27
|
+
- BREAKING CHANGE (via `nac-yaml`): Two dict items in a list now merge when all shared primitive fields match, even if both sides have additional unique primitive fields
|
|
28
|
+
|
|
29
|
+
## 1.2.0
|
|
30
|
+
|
|
31
|
+
- Add `jmespath` as a direct dependency
|
|
32
|
+
- Enhance displayed paths in error messages by showing keys instead of indexes for list items
|
|
33
|
+
|
|
34
|
+
## 1.1.0
|
|
35
|
+
|
|
36
|
+
- Enhance error handling and logging
|
|
37
|
+
- Migrate to `uv` package manager
|
|
38
|
+
- Update license references
|
|
39
|
+
|
|
40
|
+
## 1.0.0
|
|
41
|
+
|
|
42
|
+
- BREAKING CHANGE: Rename tool from `iac-validate` to `nac-validate`
|
|
43
|
+
- Modernize CLI interface using [typer](https://github.com/fastapi/typer)
|
|
44
|
+
- BREAKING CHANGE: Do not deduplicate items in a list of primitive values, for example a list of strings
|
|
45
|
+
- BREAKING CHANGE: Deduplicate items in a list of dictionaries consistently, regardless of whether they are in the same file or not
|
|
46
|
+
- Add option to get access to schema from semantic validation rules
|
|
47
|
+
|
|
48
|
+
## 0.2.7
|
|
49
|
+
|
|
50
|
+
- Suppress Yamale syntax warnings when running Python 3.12+
|
|
51
|
+
|
|
52
|
+
## 0.2.6
|
|
53
|
+
|
|
54
|
+
- Fix issue with directly nested lists in YAML files
|
|
55
|
+
|
|
56
|
+
## 0.2.5
|
|
57
|
+
|
|
58
|
+
- Check non-default schema and rules paths for existence
|
|
59
|
+
|
|
60
|
+
## 0.2.4
|
|
61
|
+
|
|
62
|
+
- Dependency updates
|
|
63
|
+
|
|
64
|
+
## 0.2.3
|
|
65
|
+
|
|
66
|
+
- Handle file errors gracefully
|
|
67
|
+
- Allow empty YAML files
|
|
68
|
+
|
|
69
|
+
## 0.2.2
|
|
70
|
+
|
|
71
|
+
- Add `--non-strict` CLI argument to accept unexpected elements in YAML files
|
|
72
|
+
|
|
73
|
+
## 0.2.1
|
|
74
|
+
|
|
75
|
+
- Do not merge YAML dictionary list items, where each list item has unique attributes with primitive values
|
|
76
|
+
|
|
77
|
+
## 0.2.0
|
|
78
|
+
|
|
79
|
+
- Preserve YAML quotes in output
|
|
80
|
+
- Add `!env` tag to read values from environment variables
|
|
81
|
+
|
|
82
|
+
## 0.1.8
|
|
83
|
+
|
|
84
|
+
- Use `ruamel.yaml` package consistently
|
|
85
|
+
|
|
86
|
+
## 0.1.7
|
|
87
|
+
|
|
88
|
+
- Add `output` CLI argument
|
|
89
|
+
|
|
90
|
+
## 0.1.6
|
|
91
|
+
|
|
92
|
+
- Add YAML syntax validation
|
|
93
|
+
|
|
94
|
+
## 0.1.5
|
|
95
|
+
|
|
96
|
+
- Add pre-commit config
|
|
97
|
+
|
|
98
|
+
## 0.1.4
|
|
99
|
+
|
|
100
|
+
- Add support for logging multiple error messsages
|
|
101
|
+
|
|
102
|
+
## 0.1.3
|
|
103
|
+
|
|
104
|
+
- Add support for Ansible Vault encrypted values
|
|
105
|
+
|
|
106
|
+
## 0.1.2
|
|
107
|
+
|
|
108
|
+
- Allow multiple paths as argument
|
|
109
|
+
|
|
110
|
+
## 0.1.1
|
|
111
|
+
|
|
112
|
+
- No changes
|
|
113
|
+
|
|
114
|
+
## 0.1.0
|
|
115
|
+
|
|
116
|
+
- Initial release
|
|
@@ -1,5 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: nac-validate
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: A CLI tool to perform syntactic and semantic validation of YAML files.
|
|
5
|
+
Project-URL: homepage, https://github.com/netascode/nac-validate
|
|
6
|
+
Project-URL: repository, https://github.com/netascode/nac-validate
|
|
7
|
+
Project-URL: documentation, https://github.com/netascode/nac-validate
|
|
8
|
+
Author-email: Daniel Schmidt <danischm@cisco.com>
|
|
9
|
+
Maintainer-email: Daniel Schmidt <danischm@cisco.com>
|
|
10
|
+
License: MPL-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: automation,cli,testing,validation,yaml
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Requires-Dist: jmespath>=1.1.0
|
|
26
|
+
Requires-Dist: nac-artifacts>=0.2.0
|
|
27
|
+
Requires-Dist: nac-yaml>=2.1.0
|
|
28
|
+
Requires-Dist: ruamel-yaml>=0.19.1
|
|
29
|
+
Requires-Dist: typer>=0.27.3
|
|
30
|
+
Requires-Dist: yamale<7,>=6.1.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: ansible-core>=2.17.6; (sys_platform != 'win32' and python_version < '3.12') and extra == 'dev'
|
|
33
|
+
Requires-Dist: ansible-core>=2.20.0; (sys_platform != 'win32' and python_version >= '3.12') and extra == 'dev'
|
|
34
|
+
Requires-Dist: bandit[toml]>=1.9.4; extra == 'dev'
|
|
35
|
+
Requires-Dist: pre-commit>=4.6.2; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-cov>=7.1.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-mock>=3.17.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest>=9.1.1; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff>=0.17.2; extra == 'dev'
|
|
40
|
+
Requires-Dist: ty>=0.0.86; extra == 'dev'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
1
43
|
[](https://github.com/netascode/nac-validate/actions/workflows/test.yml)
|
|
2
|
-

|
|
3
45
|
|
|
4
46
|
# nac-validate
|
|
5
47
|
|
|
@@ -32,7 +74,19 @@ Options:
|
|
|
32
74
|
--compact Use compact output format without rule context details
|
|
33
75
|
[env: NAC_VALIDATE_COMPACT]
|
|
34
76
|
--version Display version number
|
|
35
|
-
--list-
|
|
77
|
+
--list-artifacts List the effective schema, artifact layers and validation rules and exit
|
|
78
|
+
--artifacts / --no-artifacts
|
|
79
|
+
Experimental: also load schema and rules from bundles in nac/bundles/
|
|
80
|
+
and the installed Terraform module, applying nac/overrides.yaml.
|
|
81
|
+
Off by default (implied by --bundle and --module-dir); will become
|
|
82
|
+
the default in a future version [env: NAC_VALIDATE_ARTIFACTS]
|
|
83
|
+
--bundle PATH Experimental: path to an artifact bundle (zip, tar.gz or directory),
|
|
84
|
+
repeatable; implies --artifacts. Defaults to every .zip, .tar.gz or
|
|
85
|
+
.tgz file and directory in nac/bundles/ [env: NAC_VALIDATE_BUNDLE]
|
|
86
|
+
--module-dir DIRECTORY
|
|
87
|
+
Experimental: path to a module directory containing nac/ artifacts;
|
|
88
|
+
implies --artifacts. Defaults to the module discovered via
|
|
89
|
+
terraform init [env: NAC_VALIDATE_MODULE_DIR]
|
|
36
90
|
--help Show this message and exit
|
|
37
91
|
```
|
|
38
92
|
|
|
@@ -51,6 +105,68 @@ The CLI uses specific exit codes to help automation distinguish between error ty
|
|
|
51
105
|
|
|
52
106
|
Syntactic validation is done by basic YAML syntax validation (e.g., indentation) and by providing a [Yamale](https://github.com/23andMe/Yamale) schema and validating all YAML files against that schema. Semantic validation is done by providing a set of rules (implemented in Python) which are then validated against the YAML data. Every rule is implemented as a Python class and should be placed in a `.py` file located in the `--rules` path.
|
|
53
107
|
|
|
108
|
+
## Schema Extensions
|
|
109
|
+
|
|
110
|
+
nac-validate extends Yamale with additional keyword arguments on the standard validators. Vanilla Yamale accepts and ignores them, so a schema using them still works with plain Yamale, which then just does not enforce them.
|
|
111
|
+
|
|
112
|
+
Extensions are checked once the data passed the Yamale validation. An extension keyword on a validator that does not support it, or with an invalid value, fails loading the schema (exit code 3). A keyword known neither to Yamale nor to nac-validate, like a misspelled one, is logged as a warning and ignored.
|
|
113
|
+
|
|
114
|
+
### Primary Keys
|
|
115
|
+
|
|
116
|
+
`primary_key` on a `list()` of maps names a field that every item must set to a single value (not a map or list), unique within the list:
|
|
117
|
+
|
|
118
|
+
```yaml
|
|
119
|
+
tenants: list(include('tenant'), primary_key='name')
|
|
120
|
+
---
|
|
121
|
+
tenant:
|
|
122
|
+
name: str()
|
|
123
|
+
vrfs: list(include('vrf'), primary_key='name', required=False)
|
|
124
|
+
vrf:
|
|
125
|
+
name: str()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
A composite key names several comma-separated fields, whose combination must be unique, so the same interface name can be used on different nodes:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
interfaces: list(include('interface'), primary_key='node_id,name')
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Values of different types are distinct (`1` and `"1"` do not collide). Primary keys are checked in every file and, once every file passed, on the data merged from all files: items with the same key are only merged when all their shared fields match, so the same key used with conflicting values in two files remains a duplicate.
|
|
135
|
+
|
|
136
|
+
## Packaged Schema and Rules (Experimental)
|
|
137
|
+
|
|
138
|
+
> **Note:** This feature is experimental and may change in future versions. It is not subject to semantic versioning guarantees.
|
|
139
|
+
|
|
140
|
+
Besides the local `--schema` and `--rules` paths, schema and rules can come from two more places. Loading them is currently opt-in: enable it with `--artifacts` or `NAC_VALIDATE_ARTIFACTS=true` (passing `--bundle` or `--module-dir` enables it as well). It will become the default in a future version, after which `--no-artifacts` turns it off.
|
|
141
|
+
|
|
142
|
+
```shell
|
|
143
|
+
nac-validate --artifacts data/
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The layers are, highest priority first:
|
|
147
|
+
|
|
148
|
+
1. **Local**: `--schema`/`--rules`, or the `.schema.yaml` and `.rules/` defaults
|
|
149
|
+
2. **Bundle**: every `.zip`, `.tar.gz` or `.tgz` archive and every directory in the project's `nac/bundles/` (or the paths given with `--bundle`), holding `manifest.yaml`, `schema.yaml` and `rules/` at its root
|
|
150
|
+
3. **Module**: the `nac/` directory (`nac/schema.yaml`, `nac/rules/`) of the Terraform module installed by `terraform init` (or the one given with `--module-dir`)
|
|
151
|
+
|
|
152
|
+
A higher layer replaces the schema of a lower one and rules with the same ID. Rules of lower layers can be disabled by ID in `nac/overrides.yaml`:
|
|
153
|
+
|
|
154
|
+
```yaml
|
|
155
|
+
disable:
|
|
156
|
+
rules:
|
|
157
|
+
- "101"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Run `nac-validate --list-artifacts` to see the effective schema, the layers in use and where each rule comes from. It reads rules without running them: the `id`, `description` and `severity` of each rule are taken from the string or number literals in its `Rule` class, and a rule whose ID is not such a literal (computed or inherited) is listed as having an unknown ID. With `--artifacts` it still extracts bundle archives into `nac/bundles/.cache/`.
|
|
161
|
+
|
|
162
|
+
The project directory is the **current working directory**, not the location of the data, `--schema` or `--rules`: `nac/bundles/`, `nac/overrides.yaml` and the `.terraform/` directory (or `TF_DATA_DIR`) written by `terraform init` are looked up there. Run nac-validate from your root module directory, or point to the artifacts with `--module-dir` and `--bundle`.
|
|
163
|
+
|
|
164
|
+
### Trust
|
|
165
|
+
|
|
166
|
+
Rules are Python code that nac-validate executes, so bundles and modules need the same trust as code in your own repository. Review them with `--list-artifacts` (bundle archives are shown with a SHA-256 prefix) before enabling `--artifacts`. Note that a module update (`terraform init -upgrade`) or a new file in `nac/bundles/` changes which code runs, and `.terraform/` is usually not part of your reviewed changes.
|
|
167
|
+
|
|
168
|
+
Discovery is implemented in [nac-artifacts](https://github.com/netascode/nac-artifacts), which documents the bundle format in detail.
|
|
169
|
+
|
|
54
170
|
## Writing Validation Rules
|
|
55
171
|
|
|
56
172
|
Each `.py` file must have a single class named `Rule` that subclasses `RuleBase`. This class must set `id` and `description` as class attributes. It must implement a `classmethod()` named `match` that has a single function argument `data` which is the data read from all YAML files. It can optionally also have a second argument `schema` which would then provide the `Yamale` schema.
|
|
@@ -157,7 +273,7 @@ All rules must subclass `RuleBase` and set at minimum `id` and `description`. Th
|
|
|
157
273
|
|
|
158
274
|
| Attribute | Required | Default | Description |
|
|
159
275
|
|-----------|----------|---------|-------------|
|
|
160
|
-
| `id` | Yes | — | Unique rule identifier |
|
|
276
|
+
| `id` | Yes | — | Unique rule identifier, a number such as `"101"` or `101` (other IDs log a warning) |
|
|
161
277
|
| `description` | Yes | — | Short description of the rule |
|
|
162
278
|
| `severity` | No | `"HIGH"` | Severity level (`HIGH`, `MEDIUM`, `LOW`) |
|
|
163
279
|
| `title` | No | `""` | Header displayed in violation output |
|
|
@@ -201,16 +317,16 @@ Output structure:
|
|
|
201
317
|
|
|
202
318
|
## Installation
|
|
203
319
|
|
|
204
|
-
Python 3.
|
|
320
|
+
Python 3.11+ is required to install `nac-validate`. Don't have Python 3.11 or later? See [Python 3 Installation & Setup Guide](https://realpython.com/installing-python/).
|
|
205
321
|
|
|
206
|
-
`nac-validate` can be installed in a virtual environment using `
|
|
322
|
+
`nac-validate` can be installed in a virtual environment using `uv` or `pip`:
|
|
207
323
|
|
|
208
324
|
```bash
|
|
209
|
-
# Using pip
|
|
210
|
-
pip install nac-validate
|
|
211
|
-
|
|
212
325
|
# Using uv (recommended)
|
|
213
326
|
uv tools install nac-validate
|
|
327
|
+
|
|
328
|
+
# Using pip
|
|
329
|
+
pip install nac-validate
|
|
214
330
|
```
|
|
215
331
|
|
|
216
332
|
## Pre-Commit Hook
|