Repository navigation
[Test Quality] test: assert DLP ACLs are defined before their deny rule - #11936
Merged
lpcox merged 2 commits intoNov 22, 2026
Merged
Conversation
The DLP ordering test only checked that the dlp_blocked deny precedes the domain deny. It did not check that the acl dlp_blocked definitions precede the http_access rule that references them. Squid parses squid.conf top-down, so a misplaced definition is a startup failure or silently ineffective. Add an assertion over the generated config. It passes on the current template and fails when the DLP ACL section is moved after its deny rule. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new fixture does not exercise API-proxy upstreams, so it could miss a regression where the DLP ACL definition appears after API-proxy rules that reference it.
1 open issue
What changed in this PR
This PR strengthens DLP configuration regression coverage by verifying that generated Squid ACL definitions appear before the access rule that references them, without changing production behavior.
Changes:
- Adds an integration test using the real Squid configuration generator.
- Verifies the expected DLP ACL definitions precede the standalone
http_access deny dlp_blockedrule. - Keeps the change limited to the existing DLP test suite.
| File | Description |
|---|---|
| src/squid-config-dlp.test.ts | Adds generated-config assertions covering the ordering of DLP ACL definitions before the DLP deny rule. |
Review effort: Lite (adaptive)
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Contributor
Author
|
✅ Copilot review passed with no inline comments. @github-actions[bot] Add the |
lpcox
deleted the
test-quality/dlp-acl-definition-order-d618c5041896b02a
branch
November 22, 2026 17:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Contract
Squid parses
squid.conftop-down. Everyaclmust be defined before anyhttp_accessline references it, otherwise Squid rejects the config at startup or the rule is ineffective. The DLP block (generateDlpSquidConfig, emitted viasrc/squid/config-generator.ts) must therefore place itsacl dlp_blocked url_regex ...definitions beforehttp_access deny dlp_blocked.Reference:
src/squid/config-generator.tsemits${dlpAclSection}before${dlpAccessSection}in the template.Previous weakness and missed regression
src/squid-config-dlp.test.tsonly asserted thathttp_access deny dlp_blockedprecedeshttp_access deny !allowed_domains. It never checked the definitions. I confirmed the gap by moving the${dlpAclSection}template line after${dlpAccessSection}: all 8 existing DLP tests still passed, so the regression was undetected.Change
Adds one test case in the existing
DLP Integrationblock. It takes the generated config and asserts that everyacl dlp_blockedline (at least 10) appears before the singlehttp_access deny dlp_blockedline. This is a config-output oracle with no mocks; it uses the real generator.Test-only change:
src/squid-config-dlp.test.ts(+21 lines). No production code, manifests, or workflows changed.Regression sensitivity
src/squid-config-dlp.test.tspasses 9/9.src/squid/config-generator.ts. The new test fails atexpect(Math.max(...aclLineIndexes)).toBeLessThan(denyLineIndexes[0])(Expected < 99, Received 118). The other 8 tests still pass, so the failure is the intended assertion, not setup or syntax. The production file was restored with no diff.Validation
./node_modules/.bin/jest --runInBand --no-coverage --testPathPatterns 'squid|dlp|domain': 34 suites, 751 tests passed.npx eslint src/squid-config-dlp.test.ts: exit 0.npx tsc --noEmit -p tsconfig.json: exit 0.CI discovery
The file runs in root
npm test(jest, rootssrc/andscripts/), executed by thebuild.ymlunit-test job on every PR. No new test file was added.Limitations
This verifies the generated Squid config text, not a running Squid. I did not run real Squid because Docker and the Squid container are unavailable in this environment. The assertion checks ordering only, not that the regexes are accepted by Squid's POSIX engine.
Notes on docs
docs/INTEGRATION-TESTS.mdand the code comments say DLP denies come "before allow rules". The generated config puts the DLP deny after the API-proxy allow rules (lines 118 and 125 in a sample render). This PR does not change that behavior or encode it as the spec. It only pins the definition-before-reference invariant.