Repository navigation
feat(review): synthetic defect templates for infrastructure code and documentation - #534
Merged
Merged
Conversation
…documentation The defect generator covered a few YAML and Dockerfile patterns. It now injects the defects reviews of infrastructure code and documentation should catch: - Terraform: expose-public-access, disable-encryption, open-ingress. - Dockerfiles: run-as-root, and unverified-download (ADD --checksum or a checksum segment of a continued RUN). - Shell: drop-strict-mode, unquote-expansion, pipe-to-shell, curl --insecure and wget --no-check-certificate on https downloads, standalone checksum checks, chmod. - Kubernetes: enable-host-network, mount-host-path, drop-resource-limits. - Documentation: insecure example commands inside fenced code blocks and Hugo code shortcodes, and contradict-documented-default. Every site on the pinned samples was applied and still parses: HCL, YAML, bash -n, and each Dockerfile RUN. A corpus over them injected 31 defects. Closes #504
This was referenced Sep 24, 2026
Merged
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.
Closes #504.
Why
The synthetic defect generator (#415, extended in #503) covered only a few YAML and Dockerfile patterns. Infrastructure code and documentation get reviewed too.
New templates (
src/devops_cli/ai/review/defects.py)expose-public-access,disable-encryption,open-ingressrun-as-root,unverified-downloaddrop-strict-mode,unquote-expansion,pipe-to-shell,unverified-downloadenable-host-network,mount-host-path,drop-resource-limitscontradict-documented-defaultdisable-tls-verify,widen-file-modeandpipe-to-shellalso gain shell, Dockerfile and docs finders:curl --insecureandwget --no-check-certificate;chmod 600→666.Docs changes stay inside fenced code blocks and Hugo code shortcodes.
Keeping files well formed
#comments blanked. Ingress means aningressblock, an ingress SG rule, an NACL rule withegress = false, oraws_vpc_security_group_ingress_rule. Egress rules, ranges that are already open, and lists spread over lines are left alone.RUN. A check that decides anifis left alone.||,&&or a block.[[ ]],casewords and comments.limitsare removed only underresources, and a file that already setshostNetworkis skipped.Verification on the pinned samples (#502)
Every site was applied one at a time and the mutated file checked:
bash -nfor shell scripts and for each DockerfileRUN.open-ingress9,expose-public-access1enable-host-network5,mount-host-path1,drop-resource-limits1disable-tls-verify5,unverified-download2,drop-strict-mode10unquote-expansion566,disable-tls-verify2,drop-strict-mode1disable-tls-verify4,contradict-documented-default2No mutation breaks its file. The sweep caught two problems, both fixed before the numbers above:
md5sum -c - ... || {check broke the script;A corpus over the samples injected 31 defects across 11 templates. The samples have no
USERlines, encryption settings or script downloads, sorun-as-root,disable-encryptionandpipe-to-shellare covered by unit tests only.Test plan
tests/test_review_defects_infra.py(45 tests):uv run devops ci --force: all 13 gates pass