Skip to content

Commit af11705

Browse files
fix: address additional Copilot review feedback
Security improvements: - Add SHA256 checksum verification for golangci-lint v1.64.8 (b6270687afb143d019f387c791cd2a6f1cb383be9b3124d241ca11bd3ce2e54e) Password handling: - Consolidate to single env var (MSSQL_SA_PASSWORD only) - Use MSSQL_SA_PASSWORD in healthcheck for consistency - Set savePassword: false in mssql.connections (prompts on first use) Tool management: - Disable go.toolsManagement.autoUpdate to preserve pinned versions Documentation: - Clarify CI comparison (same env var names, not identical config) - Update password change instructions to be clearer
1 parent 08a7029 commit af11705

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ RUN curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor
1515
ENV PATH="/opt/mssql-tools18/bin:${PATH}"
1616

1717
# Install golangci-lint for code quality
18-
# Download pre-built binary directly instead of running install script (supply chain security)
18+
# Download pre-built binary with SHA256 checksum verification (supply chain security)
1919
ARG GOLANGCI_LINT_VERSION=1.64.8
20+
ARG GOLANGCI_LINT_SHA256=b6270687afb143d019f387c791cd2a6f1cb383be9b3124d241ca11bd3ce2e54e
2021
RUN curl -fsSLO "https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" \
22+
&& echo "${GOLANGCI_LINT_SHA256} golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" | sha256sum -c - \
2123
&& tar -xzf "golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" \
2224
&& mv "golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint" /usr/local/bin/ \
2325
&& rm -rf "golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64" "golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz" \

.devcontainer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ The following environment variables are set automatically:
143143
| `SQLCMDDATABASE` | `master` |
144144
| `SQLCMDDBNAME` | `master` |
145145

146-
These are the same variables used by the CI pipeline, so tests run identically.
146+
These use the same environment variable names as the CI pipeline to ensure local tests behave similarly, although the actual password and SQL Server version in CI may differ.
147147

148148
## Working with sqlcmd
149149

@@ -184,7 +184,7 @@ The `setup.sql` script in `.devcontainer/mssql/` is executed automatically when
184184
To change the SQL Server password:
185185

186186
1. Update `MSSQL_SA_PASSWORD` in `docker-compose.yml`
187-
2. Update `SQLCMDPASSWORD` in `devcontainer.json` (remoteEnv section)
187+
2. Update `SQLCMDPASSWORD` in `devcontainer.json` (both `remoteEnv` and `go.testEnvVars` sections)
188188
3. Update the password in the `mssql.connections` settings in `devcontainer.json`
189189

190190
### Using a Different SQL Server Version

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"streetsidesoftware.code-spell-checker"
2020
],
2121
"settings": {
22-
"go.toolsManagement.autoUpdate": true,
22+
"go.toolsManagement.autoUpdate": false,
2323
"go.useLanguageServer": true,
2424
"go.lintTool": "golangci-lint",
2525
"go.lintFlags": ["--fast"],
@@ -36,7 +36,7 @@
3636
"authenticationType": "SqlLogin",
3737
"user": "sa",
3838
"password": "SqlCmd@2025!",
39-
"savePassword": true,
39+
"savePassword": false,
4040
"profileName": "sqlcmd-container",
4141
"encrypt": "Optional",
4242
"trustServerCertificate": true

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,12 @@ services:
2020
restart: unless-stopped
2121
environment:
2222
ACCEPT_EULA: "Y"
23-
SA_PASSWORD: "SqlCmd@2025!"
2423
MSSQL_SA_PASSWORD: "SqlCmd@2025!"
2524
MSSQL_PID: "Developer"
2625
volumes:
2726
- mssql-data:/var/opt/mssql
2827
healthcheck:
29-
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P \"$$SA_PASSWORD\" -C -Q \"SELECT 1\" || exit 1"]
28+
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P \"$$MSSQL_SA_PASSWORD\" -C -Q \"SELECT 1\" || exit 1"]
3029
interval: 10s
3130
timeout: 5s
3231
retries: 15

0 commit comments

Comments
 (0)