nac-validate 2.0.0b3__tar.gz → 2.2.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.
Files changed (105) hide show
  1. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/.github/dependabot.yml +10 -3
  2. nac_validate-2.2.0/.github/workflows/release.yml +148 -0
  3. nac_validate-2.2.0/.github/workflows/test.yml +188 -0
  4. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/.gitignore +0 -1
  5. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/.pre-commit-config.yaml +9 -5
  6. nac_validate-2.2.0/CHANGELOG.md +140 -0
  7. nac_validate-2.2.0/PKG-INFO +606 -0
  8. nac_validate-2.2.0/README.md +564 -0
  9. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/nac_validate/__init__.py +6 -3
  10. nac_validate-2.2.0/nac_validate/cli/main.py +317 -0
  11. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/nac_validate/cli/options.py +85 -4
  12. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/nac_validate/constants.py +13 -6
  13. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/nac_validate/exceptions.py +32 -3
  14. nac_validate-2.2.0/nac_validate/ignores.py +701 -0
  15. nac_validate-2.2.0/nac_validate/layers.py +200 -0
  16. nac_validate-2.2.0/nac_validate/models.py +108 -0
  17. nac_validate-2.2.0/nac_validate/output_formatter.py +678 -0
  18. nac_validate-2.2.0/nac_validate/schema/__init__.py +289 -0
  19. nac_validate-2.2.0/nac_validate/schema/base.py +108 -0
  20. nac_validate-2.2.0/nac_validate/schema/description.py +24 -0
  21. nac_validate-2.2.0/nac_validate/schema/ip_type.py +116 -0
  22. nac_validate-2.2.0/nac_validate/schema/ordered.py +24 -0
  23. nac_validate-2.2.0/nac_validate/schema/primary_key.py +82 -0
  24. nac_validate-2.2.0/nac_validate/schema/reference.py +510 -0
  25. nac_validate-2.2.0/nac_validate/schema/unique.py +152 -0
  26. nac_validate-2.2.0/nac_validate/schema/values.py +107 -0
  27. nac_validate-2.2.0/nac_validate/schema/walker.py +721 -0
  28. nac_validate-2.2.0/nac_validate/tftpl.py +886 -0
  29. nac_validate-2.2.0/nac_validate/validator.py +1549 -0
  30. nac_validate-2.2.0/nac_validate/variables.py +1086 -0
  31. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/pyproject.toml +24 -32
  32. nac_validate-2.2.0/release-notes.md +22 -0
  33. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/scripts/license-headers.sh +6 -4
  34. nac_validate-2.2.0/tests/conftest.py +19 -0
  35. nac_validate-2.2.0/tests/integration/fixtures/data_composite_key_conflict/file1.yaml +9 -0
  36. nac_validate-2.2.0/tests/integration/fixtures/data_composite_key_conflict/file2.yaml +6 -0
  37. nac_validate-2.2.0/tests/integration/fixtures/data_primary_key/file1.yaml +5 -0
  38. nac_validate-2.2.0/tests/integration/fixtures/data_primary_key/file2.yaml +6 -0
  39. nac_validate-2.2.0/tests/integration/fixtures/data_primary_key_conflict/file1.yaml +5 -0
  40. nac_validate-2.2.0/tests/integration/fixtures/data_primary_key_conflict/file2.yaml +5 -0
  41. nac_validate-2.2.0/tests/integration/fixtures/data_reference/file1.yaml +6 -0
  42. nac_validate-2.2.0/tests/integration/fixtures/data_reference/file2.yaml +9 -0
  43. nac_validate-2.2.0/tests/integration/fixtures/data_reference_error/file1.yaml +10 -0
  44. nac_validate-2.2.0/tests/integration/fixtures/data_unique/file1.yaml +10 -0
  45. nac_validate-2.2.0/tests/integration/fixtures/data_unique/file2.yaml +6 -0
  46. nac_validate-2.2.0/tests/integration/fixtures/data_unique_conflict/file1.yaml +5 -0
  47. nac_validate-2.2.0/tests/integration/fixtures/data_unique_conflict/file2.yaml +5 -0
  48. nac_validate-2.2.0/tests/integration/fixtures/data_vault/data.yaml +10 -0
  49. nac_validate-2.2.0/tests/integration/fixtures/rules/rule_102.py +34 -0
  50. nac_validate-2.2.0/tests/integration/fixtures/schema_composite_key/schema.yaml +10 -0
  51. nac_validate-2.2.0/tests/integration/fixtures/schema_invalid_extension/schema.yaml +9 -0
  52. nac_validate-2.2.0/tests/integration/fixtures/schema_primary_key/schema.yaml +10 -0
  53. nac_validate-2.2.0/tests/integration/fixtures/schema_reference/schema.yaml +17 -0
  54. nac_validate-2.2.0/tests/integration/fixtures/schema_unique/schema.yaml +15 -0
  55. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/test_integration.py +170 -4
  56. nac_validate-2.2.0/tests/unit/conftest.py +29 -0
  57. nac_validate-2.2.0/tests/unit/fixtures/variable_merge.yaml +83 -0
  58. nac_validate-2.2.0/tests/unit/fixtures/variable_schema.yaml +187 -0
  59. nac_validate-2.2.0/tests/unit/helpers.py +125 -0
  60. nac_validate-2.2.0/tests/unit/test_api.py +397 -0
  61. nac_validate-2.2.0/tests/unit/test_cli.py +1399 -0
  62. nac_validate-2.2.0/tests/unit/test_ignores.py +390 -0
  63. nac_validate-2.2.0/tests/unit/test_layers.py +315 -0
  64. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/unit/test_output_formatter.py +208 -54
  65. nac_validate-2.2.0/tests/unit/test_reference.py +586 -0
  66. nac_validate-2.2.0/tests/unit/test_schema.py +1328 -0
  67. nac_validate-2.2.0/tests/unit/test_tftpl.py +406 -0
  68. nac_validate-2.2.0/tests/unit/test_validator.py +1287 -0
  69. nac_validate-2.2.0/tests/unit/test_variables.py +698 -0
  70. nac_validate-2.2.0/uv.lock +1181 -0
  71. nac_validate-2.0.0b3/.github/workflows/release.yml +0 -21
  72. nac_validate-2.0.0b3/.github/workflows/test.yml +0 -136
  73. nac_validate-2.0.0b3/CHANGELOG.md +0 -99
  74. nac_validate-2.0.0b3/PKG-INFO +0 -303
  75. nac_validate-2.0.0b3/README.md +0 -263
  76. nac_validate-2.0.0b3/nac_validate/cli/main.py +0 -200
  77. nac_validate-2.0.0b3/nac_validate/models.py +0 -58
  78. nac_validate-2.0.0b3/nac_validate/output_formatter.py +0 -409
  79. nac_validate-2.0.0b3/nac_validate/validator.py +0 -485
  80. nac_validate-2.0.0b3/tests/integration/fixtures/data_vault/data.yaml +0 -10
  81. nac_validate-2.0.0b3/tests/unit/test_cli.py +0 -147
  82. nac_validate-2.0.0b3/tests/unit/test_validator.py +0 -218
  83. nac_validate-2.0.0b3/uv.lock +0 -1207
  84. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/.pre-commit-hooks.yaml +0 -0
  85. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/LICENSE +0 -0
  86. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/nac_validate/__main__.py +0 -0
  87. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/nac_validate/cli/__init__.py +0 -0
  88. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/__init__.py +0 -0
  89. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/__init__.py +0 -0
  90. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/additional_data/data.yaml +0 -0
  91. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/additional_data_schema/schema.yaml +0 -0
  92. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data/data.yaml +0 -0
  93. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_empty/data.yaml +0 -0
  94. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_empty/empty.yaml +0 -0
  95. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_env/data.yaml +0 -0
  96. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_merge/file1.yaml +0 -0
  97. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_merge/file2.yaml +0 -0
  98. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_merge/result.yaml +0 -0
  99. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_non_strict/data.yaml +0 -0
  100. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_semantic_error/data.yaml +0 -0
  101. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/data_syntax_error/data.yaml +0 -0
  102. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/rules/rule_101.py +0 -0
  103. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/rules_schema/rule_101.py +0 -0
  104. {nac_validate-2.0.0b3 → nac_validate-2.2.0}/tests/integration/fixtures/schema/schema.yaml +0 -0
  105. {nac_validate-2.0.0b3 → nac_validate-2.2.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
- - package-ecosystem: 'pip'
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@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
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@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
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@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
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@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
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@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
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"
@@ -74,6 +74,5 @@ ENV/
74
74
 
75
75
  tmp/
76
76
 
77
- .mypy_cache/
78
77
 
79
78
  logs/
@@ -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.12.12
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: https://github.com/pre-commit/mirrors-mypy
18
- rev: v1.17.1
17
+ - repo: local
19
18
  hooks:
20
- - id: mypy
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.8.6
27
+ rev: 1.9.4
24
28
  hooks:
25
29
  - id: bandit
26
30
  args: ['-r', 'nac_validate/']
@@ -0,0 +1,140 @@
1
+ ## 2.2.0
2
+
3
+ - Put the leading keys of list items first in the merged output (`--output`), like `yaml_encode` of the Terraform utils provider: the first present of `id`, `order`, `sequence`, `seq`, `sequence_number`, `sequence_id`, `name`, `number`, `ip`, `address`, `prefix` and `vrf`, and for items of a `devices` list `name`, `url`, `managed`, `configuration` and `cli_templates`. All other keys keep the order of the input files
4
+ - Check variable schemas (`variable_schema` of templates, device groups and `global`) with the syntax validation of the merged data: expressions, includes, the types of template defaults and undeclared references in templates (a conservative scan of `${...}` and `%{...}`) for every architecture, and on device models the variables a template sees where it is applied (deep merged like the renderer, with the template defaults below them) and the resolved variables of every device. Errors fail syntax validation; unused declarations and includes, Meraki variables no applied template declares and Meraki type overrides in template inheritance are warnings, listed under `variable_warnings` in the JSON output. Findings name the file that defines their path, e.g. the file of the template or the template instance. Data without `variable_schema` is not checked
5
+ - Add `nac_validate.variables` with `variable_findings()`, `VariableSchema`, `merge_variables()` and the reference scan (`scan_template()`, `scan_expression()`)
6
+ - Add ignore comments in data files to exempt objects from rules: `# nac-validate: ignore[505, 506] reason` after an entry or on the line above it, or `# nac-validate: ignore-file[413]`. Violations are matched by the list item selectors of their path (`devices[name=edge-1]`), so comments keep working when files are merged. Suppressed violations are counted in the summary and listed under `suppressed` in the JSON output; comments that suppressed nothing are reported as a warning and under `unused_ignores`. Files are only read again when a comment names a rule that reported violations
7
+ - Add `--fail-on {HIGH,MEDIUM,LOW}` option (`NAC_VALIDATE_FAIL_ON`) to set the lowest rule severity that fails semantic validation. Violations of less severe rules are still reported, counted as below the failure threshold in the summary and marked `"blocking": false` in the JSON output, but no longer affect the exit code. Defaults to `LOW`, so every violation fails as before
8
+ - Log a warning for rules declaring a severity other than `HIGH`, `MEDIUM` or `LOW` (case-insensitive), and treat them as `HIGH`. Before, such rules were counted as `LOW` in the summary
9
+ - Read `severity.rules` in `nac/overrides.yaml` (and in bundles' `overrides.yaml`) to change the severity of packaged rules of lower layers (`"205": LOW`). The new severity applies to the output, the JSON output and `--fail-on`, and `--list-artifacts` shows each change, entries matching no rule and entries without effect because the rule is shadowed. Two bundles setting different severities for the same rule are a configuration error unless the project sets it
10
+ - Skip bundles whose `overrides.yaml` only has entries for other tools (`disable.templates`), like bundles without schema or rules
11
+ - Refer to list items by their schema primary key instead of their index in error messages (`Duplicate unique key ip=x in items [name=a], [name=b]`)
12
+ - Update nac-yaml to 2.2.1: faster parsing, and files in directories are merged in sorted order
13
+ - Add a library API for tools such as editors: `Validator.check_file()`, `check_merged()` and `check_model()` return schema violations with path segments, `Validator.run_rules()` returns a `RuleResult` per rule and reports a rule that raises instead of stopping, and ignore comments can be read from text (`read_comments()`, `IgnoreMatcher(texts=...)`). `walk_data()`, `walk_schema_contexts()`, `ReferenceIndex`, `parse_path()` and `is_blocking()` are now public. `nac_validate.schema.schema_at(schema, path)` describes what the schema says about the value at a data path (`("nxos", "devices", 0)`) for completion and hover: its kinds, the keys of its maps, whether it is required, enum and bool values, constraints, references, the primary key of its lists and whether it can be a template variable
14
+ - Validate the files of a directory in merge order
15
+ - Check templates (`*.tftpl`) in the paths before they are rendered: directive, YAML and schema errors fail syntax validation, with the file, line and column; what can't be checked before rendering (interpolations in fields without template variables, keys made by interpolations, YAML made by an interpolation alone on its line, directives in the middle of a line) is a warning, listed under `template_warnings` in the JSON output. Templates are validated against the include named by `templates.file.root` in the manifest of the module or a bundle, else `device_configuration`. Syntax errors in the text output now show the line and column when known
16
+ - Add `nac_validate.tftpl` to check templates (`.tftpl`) before they are rendered: `mask_template()` replaces their HCL directives and interpolations by text of the same length and checks that directives are balanced, `check_template()` validates the YAML against the part of the schema the template renders into, `include_path()` finds that part by its include (e.g. `device_configuration`), and `template_findings()` and `find_templates()` give the CLI's results and files
17
+ - Schema errors at map keys containing dots or colons name the whole key, and Yamale's `path : message` errors are printed as `path: message`
18
+ - Fix ignore comments not applying to list items selected by a boolean, null or float field (`[enabled=True]` for `enabled: true`)
19
+ - Add `ordered` schema option for lists to document that the order of the items is significant (`list(str(), ordered=True)`). Without it, or with `ordered=False`, the order is not significant. It is not checked against the data
20
+ - Add `type` schema option for `ip()` to restrict the form of a value: `address` (`10.0.0.1`), `interface` (host address with prefix length, `10.0.0.1/24`, not the network or broadcast address) or `network` (no host bits set, `10.0.0.0/24`), or several comma-separated (`ip(type='address,network')`). Prefix lengths must be numbers, not netmasks
21
+ - Add `description` schema option on every validator (`str(description='Name of the tenant')`) to document schema elements. It is not checked against the data, only that it is a non-empty string
22
+ - Add reference schema options: `ref_name` on a list with a single-field `primary_key` registers its items' keys under a name (shared by several lists for references to any of them), `ref` on a field requires its value to be such a key. Targets are looked up following the nesting of the data (e.g. the VRFs of the same device); `ref_in` selects the enclosing items by fields of the referencing item (e.g. `tenant` + `vrf`), `ref_scope='any'` on a list lifts the isolation of its items, and `ref_implicit` lists values that exist without being defined (globs allowed). Checked on the merged data, also for a single file. `nac_validate.schema.references()` gives rules the references of the data, for visibility the schema can't express
23
+ - Add `unique` schema option for lists, for values that must be unique without identifying an item: `unique=True` on a list of single values (`list(str(), unique=True)`), or comma-separated fields of the items whose combination must be unique (`unique='prefix,vrf'`). Unlike `primary_key`, the fields may be optional: a field that is not set is a value of its own, and items setting none of the fields are not compared. Checked per file and on the merged data
24
+
25
+ ## 2.1.0
26
+
27
+ - 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
28
+ - 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
29
+ - Drop support for Python 3.10 (end of life); Python 3.11 or later is now required
30
+ - Update nac-yaml to 2.1.0: `!vault` values are now decrypted with the password from `ANSIBLE_VAULT_PASSWORD`
31
+ - Fix syntax validation failure for empty or comment-only YAML files
32
+ - **Packaged schema and rules** (EXPERIMENTAL, may change in future versions and is not subject to semantic versioning guarantees)
33
+ - 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
34
+ - 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`
35
+ - 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/`)
36
+ - 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
37
+ - 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
38
+ - 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
39
+ - 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
40
+ - 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
41
+
42
+ ## 2.0.0
43
+
44
+ - Add `RuleBase` base class for semantic validation rules
45
+ - 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
46
+ - Add `--json` CLI option for machine-readable JSON validation output
47
+ - Add `--list-rules` CLI option to display available validation rules
48
+ - Add `--no-color` CLI option to disable colored terminal output
49
+ - Add `--compact` CLI option to reduce output verbosity
50
+ - 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
51
+ - 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
52
+
53
+ ## 1.2.0
54
+
55
+ - Add `jmespath` as a direct dependency
56
+ - Enhance displayed paths in error messages by showing keys instead of indexes for list items
57
+
58
+ ## 1.1.0
59
+
60
+ - Enhance error handling and logging
61
+ - Migrate to `uv` package manager
62
+ - Update license references
63
+
64
+ ## 1.0.0
65
+
66
+ - BREAKING CHANGE: Rename tool from `iac-validate` to `nac-validate`
67
+ - Modernize CLI interface using [typer](https://github.com/fastapi/typer)
68
+ - BREAKING CHANGE: Do not deduplicate items in a list of primitive values, for example a list of strings
69
+ - BREAKING CHANGE: Deduplicate items in a list of dictionaries consistently, regardless of whether they are in the same file or not
70
+ - Add option to get access to schema from semantic validation rules
71
+
72
+ ## 0.2.7
73
+
74
+ - Suppress Yamale syntax warnings when running Python 3.12+
75
+
76
+ ## 0.2.6
77
+
78
+ - Fix issue with directly nested lists in YAML files
79
+
80
+ ## 0.2.5
81
+
82
+ - Check non-default schema and rules paths for existence
83
+
84
+ ## 0.2.4
85
+
86
+ - Dependency updates
87
+
88
+ ## 0.2.3
89
+
90
+ - Handle file errors gracefully
91
+ - Allow empty YAML files
92
+
93
+ ## 0.2.2
94
+
95
+ - Add `--non-strict` CLI argument to accept unexpected elements in YAML files
96
+
97
+ ## 0.2.1
98
+
99
+ - Do not merge YAML dictionary list items, where each list item has unique attributes with primitive values
100
+
101
+ ## 0.2.0
102
+
103
+ - Preserve YAML quotes in output
104
+ - Add `!env` tag to read values from environment variables
105
+
106
+ ## 0.1.8
107
+
108
+ - Use `ruamel.yaml` package consistently
109
+
110
+ ## 0.1.7
111
+
112
+ - Add `output` CLI argument
113
+
114
+ ## 0.1.6
115
+
116
+ - Add YAML syntax validation
117
+
118
+ ## 0.1.5
119
+
120
+ - Add pre-commit config
121
+
122
+ ## 0.1.4
123
+
124
+ - Add support for logging multiple error messsages
125
+
126
+ ## 0.1.3
127
+
128
+ - Add support for Ansible Vault encrypted values
129
+
130
+ ## 0.1.2
131
+
132
+ - Allow multiple paths as argument
133
+
134
+ ## 0.1.1
135
+
136
+ - No changes
137
+
138
+ ## 0.1.0
139
+
140
+ - Initial release