Skip to content

Commit 6b04157

Browse files
docs(queries): update queries catalog (#7507)
Co-authored-by: cx-miguel-silva <100352574+cx-miguel-silva@users.noreply.github.com>
1 parent ca7abdc commit 6b04157

File tree

8 files changed

+709
-20
lines changed

8 files changed

+709
-20
lines changed

docs/queries/cloudformation-queries/aws/6c131358-c54d-419b-9dd6-1f7dd41d180c.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,3 +845,68 @@ Outputs:
845845
}
846846

847847
```
848+
```yaml title="Negative test num. 3 - yaml file"
849+
Resources:
850+
TaskDef54694570:
851+
Type: AWS::ECS::TaskDefinition
852+
Properties:
853+
ContainerDefinitions:
854+
- Environment:
855+
- Name: DEPLOYMENT_TIMESTAMP
856+
Value: "2024-08-20T00:41:57.620Z"
857+
Essential: true
858+
HealthCheck:
859+
Command:
860+
- CMD-SHELL
861+
- curl -f http://localhost:3000/health || exit
862+
Interval: 30
863+
Retries: 3
864+
StartPeriod: 30
865+
Timeout: 5
866+
Image:
867+
Fn::Join:
868+
- ""
869+
- - 123456789012.dkr.ecr.us-west-2.
870+
- Ref: AWS::URLSuffix
871+
- /example-nms:latest
872+
ExecutionRoleArn:
873+
Fn::GetAtt:
874+
- TaskDefExecutionRoleB4775C97
875+
- Arn
876+
RequiresCompatibilities:
877+
- EC2
878+
Tags:
879+
- Key: classification
880+
Value: internal
881+
- Key: component
882+
Value: example-nms
883+
- Key: env
884+
Value: development
885+
- Key: owner
886+
Value: example@owner.com
887+
- Key: product
888+
Value: internal_tools
889+
TaskRoleArn:
890+
Fn::GetAtt:
891+
- EcsTaskRole8DFA0181
892+
- Arn
893+
ExampleNameMatchService0992A2E7:
894+
Type: AWS::ECS::Service
895+
Properties:
896+
Cluster: example-ecs
897+
SchedulingStrategy: REPLICA
898+
Tags:
899+
- Key: classification
900+
Value: internal
901+
- Key: component
902+
Value: example-nms
903+
- Key: env
904+
Value: development
905+
- Key: owner
906+
Value: example@owner.com
907+
- Key: product
908+
Value: internal_tools
909+
TaskDefinition:
910+
Ref: TaskDef54694570
911+
912+
```

docs/queries/common-queries/a88baa34-e2ad-44ea-ad6f-8cac87bc7c71.md

Lines changed: 143 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,6 +1526,38 @@ tags: []
15261526
</details>
15271527
<details><summary>Positive test num. 47 - dockerfile file</summary>
15281528
1529+
```dockerfile hl_lines="4"
1530+
FROM baseImage
1531+
1532+
ENV ARTEMIS_USER artemis
1533+
ENV ARTEMIS_PASSWORD artemis
1534+
1535+
RUN apk add --no-cache git \
1536+
&& git config \
1537+
--global \
1538+
url."https://${GIT_USER}:${GIT_TOKEN}@github.com".insteadOf \
1539+
"https://github.com"
1540+
1541+
```
1542+
</details>
1543+
<details><summary>Positive test num. 48 - dockerfile file</summary>
1544+
1545+
```dockerfile hl_lines="4"
1546+
FROM baseImage
1547+
1548+
ENV ARTEMIS_USER=artemis
1549+
ENV ARTEMIS_PASSWORD=artemis
1550+
1551+
RUN apk add --no-cache git \
1552+
&& git config \
1553+
--global \
1554+
url."https://${GIT_USER}:${GIT_TOKEN}@github.com".insteadOf \
1555+
"https://github.com"
1556+
1557+
```
1558+
</details>
1559+
<details><summary>Positive test num. 49 - dockerfile file</summary>
1560+
15291561
```dockerfile hl_lines="3 7"
15301562
FROM baseImage
15311563

@@ -1537,7 +1569,7 @@ ARG password=pass!1213Fs
15371569

15381570
```
15391571
</details>
1540-
<details><summary>Positive test num. 48 - tf file</summary>
1572+
<details><summary>Positive test num. 50 - tf file</summary>
15411573

15421574
```tf hl_lines="8"
15431575
resource "google_container_cluster" "primary2" {
@@ -1562,7 +1594,7 @@ resource "google_container_cluster" "primary2" {
15621594
15631595
```
15641596
</details>
1565-
<details><summary>Positive test num. 49 - json file</summary>
1597+
<details><summary>Positive test num. 51 - json file</summary>
15661598

15671599
```json hl_lines="4 7"
15681600
{
@@ -1578,7 +1610,7 @@ resource "google_container_cluster" "primary2" {
15781610

15791611
```
15801612
</details>
1581-
<details><summary>Positive test num. 50 - tf file</summary>
1613+
<details><summary>Positive test num. 52 - tf file</summary>
15821614

15831615
```tf hl_lines="8"
15841616
resource "google_container_cluster" "primary4" {
@@ -2794,11 +2826,115 @@ data "template_file" "sci_integration_app_properties_secret_template" {
27942826
```dockerfile
27952827
FROM baseImage
27962828

2829+
ENV ARTEMIS_USER artemis
2830+
2831+
RUN apk add --no-cache git \
2832+
&& git config \
2833+
--global \
2834+
url."https://${GIT_USER}:${GIT_TOKEN}@github.com".insteadOf \
2835+
"https://github.com"
2836+
2837+
2838+
```
2839+
</details>
2840+
<details><summary>Negative test num. 45 - dockerfile file</summary>
2841+
2842+
```dockerfile
2843+
FROM baseImage
2844+
27972845
RUN command
27982846

27992847
```
28002848
</details>
2801-
<details><summary>Negative test num. 45 - json file</summary>
2849+
<details><summary>Negative test num. 46 - dockerfile file</summary>
2850+
2851+
```dockerfile
2852+
FROM baseImage
2853+
2854+
ENV ARTEMIS_USER=artemis
2855+
2856+
RUN apk add --no-cache git \
2857+
&& git config \
2858+
--global \
2859+
url."https://${GIT_USER}:${GIT_TOKEN}@github.com".insteadOf \
2860+
"https://github.com"
2861+
2862+
2863+
```
2864+
</details>
2865+
<details><summary>Negative test num. 47 - yml file</summary>
2866+
2867+
```yml
2868+
stages:
2869+
- template: templates/main-stage.yml
2870+
parameters:
2871+
environment: 'foo'
2872+
isSm9ChangeRequired: true
2873+
2874+
isDedicatedSubscription: 'true'
2875+
setResourceLock: 'true'
2876+
nameResourceLock: 'PrdPreventAccidentalDeletion'
2877+
isDevelopment: 'false'
2878+
# example 1 (placeholders)
2879+
vmAdminPassword: '$(VM_ADMIN_PASSWORD)' # SET IN PIPELINE
2880+
sqlAdminPassword: '$(SQL_ADMIN_PASSWORD)' # SET IN PIPELINE
2881+
yetanotherAdminPassword: '${{SQL_ADMIN_PASSWORD}}' # SET IN PIPELINE
2882+
andyetanotherAdminPassword: '${{ SQL_ADMIN_PASSWORD }}' # SET IN PIPELINE
2883+
2884+
# example 2 (empty string value)
2885+
anotherAdminPassword: '' # SET IN PIPELINE
2886+
2887+
serviceConnectionName: 'foo'
2888+
subscriptionId: 'foo'
2889+
organisationalGroup: 'foo' # Replace this with your own Organisational Group name.
2890+
devOrganisationalGroup: 'foo' # should be empty for none DEV env
2891+
sm9ApplicationCi: 'foo' # Replace this with your own SM9 Application CI name.
2892+
resourceGroupBaseName: 'foo' # This is used to construct a Resource Group name. Replace this with your desired resource group name.
2893+
resourceGroupNameSuffix: 'foo' # This is suffixed to the Resource Group name in a Shared subscription (must be an integer). Can be left as-is.
2894+
location: 'foo' # Replace this with your desired Azure region.
2895+
linuxAgentPoolName: 'foo' # Agent pool name of Linux agents. Can be left as-is.
2896+
windowsAgentPoolName: 'foo' # Agent pool name of Windows agents. Can be left as-is.
2897+
System.Debug: 'foo' # Set to 'foo' to enable debug logging. Can be left as-is.
2898+
2899+
skipAdditionalResources: 'foo' # if true skip creating additional resources
2900+
skipSQL: 'foo'
2901+
2902+
#####################################################################################
2903+
# ADF #
2904+
#####################################################################################
2905+
adfName: 'foo'
2906+
adfDeveloperGroup: 'foo' # Group has access to ADF
2907+
irName: 'foo'
2908+
irDescription: 'foo'
2909+
2910+
2911+
2912+
```
2913+
</details>
2914+
<details><summary>Negative test num. 48 - yml file</summary>
2915+
2916+
```yml
2917+
version: '3.7'
2918+
2919+
services:
2920+
apis:
2921+
image: ""
2922+
env_file:
2923+
- .env
2924+
environment:
2925+
env: "dev"
2926+
2927+
# this value is a Docker Compose secrets path, its contents are not exposed
2928+
PrivateKey: /run/secrets/SOME_AUTHORIZATION_PRIVATE_KEY
2929+
2930+
secrets:
2931+
SOME_AUTHORIZATION_PRIVATE_KEY:
2932+
external: true
2933+
2934+
2935+
```
2936+
</details>
2937+
<details><summary>Negative test num. 49 - json file</summary>
28022938

28032939
```json
28042940
{
@@ -2818,7 +2954,7 @@ RUN command
28182954

28192955
```
28202956
</details>
2821-
<details><summary>Negative test num. 46 - tf file</summary>
2957+
<details><summary>Negative test num. 50 - tf file</summary>
28222958

28232959
```tf
28242960
resource "google_container_cluster" "primary3" {
@@ -2843,7 +2979,7 @@ resource "google_container_cluster" "primary3" {
28432979
28442980
```
28452981
</details>
2846-
<details><summary>Negative test num. 47 - tf file</summary>
2982+
<details><summary>Negative test num. 51 - tf file</summary>
28472983

28482984
```tf
28492985
resource "google_container_cluster" "primary5" {
@@ -2868,7 +3004,7 @@ resource "google_container_cluster" "primary5" {
28683004
28693005
```
28703006
</details>
2871-
<details><summary>Negative test num. 48 - tf file</summary>
3007+
<details><summary>Negative test num. 52 - tf file</summary>
28723008

28733009
```tf
28743010
resource "google_secret_manager_secret" "secret-basic" {

docs/queries/dockerfile-queries/7ebd323c-31b7-4e5b-b26f-de5e9e477af8.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,46 @@ RUN dnf in docker-ce
5656
RUN dnf clean all
5757

5858
```
59+
```dockerfile title="Positive test num. 3 - dockerfile file" hl_lines="2"
60+
FROM fedora:27
61+
RUN microdnf install \
62+
openssl-libs-1:1.1.1k-6.el8_5.x86_64 \
63+
zlib-1.2.11-18.el8_5.x86_64 \
64+
&& microdnf clean all
65+
66+
```
67+
<details><summary>Positive test num. 4 - dockerfile file</summary>
68+
69+
```dockerfile hl_lines="21"
70+
ARG BASE_CONTAINER_REGISTRY
71+
72+
# Base the installer on the Azure CLI image as we require the tool
73+
# to download the psa-check from the UniversalPackage feed.
74+
# Additionally, the script to retrieve the Kubernetes schemas
75+
# requires Python (yaml & requests) which are included by
76+
# default in the Azure CLI image.
77+
# hadolint ignore=DL3006
78+
FROM ${BASE_CONTAINER_REGISTRY:-mcr.microsoft.com}/azure-cli AS installer
79+
80+
ARG AZP_URL
81+
ARG AZP_TOKEN
82+
83+
ARG DCP_INSTALLATION=infra-test
84+
85+
ARG HADOLINT_VERSION=2.12.0
86+
ARG KUSTOMIZE_VERSION=5.5.0
87+
ARG KUBECONFORM_VERSION=0.6.7
88+
ARG FLYWAY_VERSION=11.1.0
89+
90+
RUN tdnf install \
91+
jq \
92+
tar \
93+
libicu \
94+
python3-requests \
95+
python3-yaml
96+
97+
```
98+
</details>
5999

60100

61101
#### Code samples without security vulnerabilities
@@ -82,3 +122,35 @@ RUN microdnf install -y \
82122
&& microdnf clean all
83123

84124
```
125+
<details><summary>Negative test num. 4 - dockerfile file</summary>
126+
127+
```dockerfile
128+
ARG BASE_CONTAINER_REGISTRY
129+
130+
# Base the installer on the Azure CLI image as we require the tool
131+
# to download the psa-check from the UniversalPackage feed.
132+
# Additionally, the script to retrieve the Kubernetes schemas
133+
# requires Python (yaml & requests) which are included by
134+
# default in the Azure CLI image.
135+
# hadolint ignore=DL3006
136+
FROM ${BASE_CONTAINER_REGISTRY:-mcr.microsoft.com}/azure-cli AS installer
137+
138+
ARG AZP_URL
139+
ARG AZP_TOKEN
140+
141+
ARG DCP_INSTALLATION=infra-test
142+
143+
ARG HADOLINT_VERSION=2.12.0
144+
ARG KUSTOMIZE_VERSION=5.5.0
145+
ARG KUBECONFORM_VERSION=0.6.7
146+
ARG FLYWAY_VERSION=11.1.0
147+
148+
RUN tdnf install -y \
149+
jq \
150+
tar \
151+
libicu \
152+
python3-requests \
153+
python3-yaml
154+
155+
```
156+
</details>

0 commit comments

Comments
 (0)