|
1 | | -# Snapshot report for `tests/secrets_scanning/tests.js` |
| 1 | +# Snapshot report for `packages/build/tests/secrets_scanning/tests.js` |
2 | 2 |
|
3 | 3 | The actual snapshot is saved in `tests.js.snap`. |
4 | 4 |
|
@@ -276,6 +276,154 @@ Generated by [AVA](https://avajs.dev). |
276 | 276 | ␊ |
277 | 277 | (Netlify Build completed in 1ms)` |
278 | 278 |
|
| 279 | +## secrets scanning, should fail build when it finds secrets in the src and build output and report to API |
| 280 | + |
| 281 | +> Snapshot 1 |
| 282 | +
|
| 283 | + `␊ |
| 284 | + Netlify Build ␊ |
| 285 | + ────────────────────────────────────────────────────────────────␊ |
| 286 | + ␊ |
| 287 | + > Version␊ |
| 288 | + @netlify/build 1.0.0␊ |
| 289 | + ␊ |
| 290 | + > Flags␊ |
| 291 | + debug: false␊ |
| 292 | + ␊ |
| 293 | + > Current directory␊ |
| 294 | + packages/build/tests/secrets_scanning/fixtures/src_scanning_env_vars_set_non_empty␊ |
| 295 | + ␊ |
| 296 | + > Config file␊ |
| 297 | + packages/build/tests/secrets_scanning/fixtures/src_scanning_env_vars_set_non_empty/netlify.toml␊ |
| 298 | + ␊ |
| 299 | + > Context␊ |
| 300 | + production␊ |
| 301 | + ␊ |
| 302 | + build.command from netlify.toml ␊ |
| 303 | + ────────────────────────────────────────────────────────────────␊ |
| 304 | + ␊ |
| 305 | + $ cp -r ./src/. ./dist␊ |
| 306 | + ␊ |
| 307 | + (build.command completed in 1ms)␊ |
| 308 | + ␊ |
| 309 | + Scanning for secrets in code and build output. ␊ |
| 310 | + ────────────────────────────────────────────────────────────────␊ |
| 311 | + ␊ |
| 312 | + ␊ |
| 313 | + > Scanning complete. 14 file(s) scanned. Secrets scanning found 32 instance(s) of secrets in build output or repo code.␊ |
| 314 | + ␊ |
| 315 | + Secret env var "ENV_VAR_1"'s value detected:␊ |
| 316 | + found value at line 12 in dist/static-files/static-a.txt␊ |
| 317 | + found value at line 6 in netlify.toml␊ |
| 318 | + found value at line 12 in src/static-files/static-a.txt␊ |
| 319 | + Secret env var "ENV_VAR_2"'s value detected:␊ |
| 320 | + found value at line 1 in dist/some-file.txt␊ |
| 321 | + found value at line 1 in dist/static-files/static-a.txt␊ |
| 322 | + found value at line 6 in dist/static-files/static-a.txt␊ |
| 323 | + found value at line 7 in netlify.toml␊ |
| 324 | + found value at line 1 in src/some-file.txt␊ |
| 325 | + found value at line 1 in src/static-files/static-a.txt␊ |
| 326 | + found value at line 6 in src/static-files/static-a.txt␊ |
| 327 | + Secret env var "ENV_VAR_3"'s value detected:␊ |
| 328 | + found value at line 14 in dist/static-files/static-a.txt␊ |
| 329 | + found value at line 16 in dist/static-files/static-a.txt␊ |
| 330 | + found value at line 1 in dist/static-files/static-c.txt␊ |
| 331 | + found value at line 8 in netlify.toml␊ |
| 332 | + found value at line 14 in src/static-files/static-a.txt␊ |
| 333 | + found value at line 16 in src/static-files/static-a.txt␊ |
| 334 | + found value at line 1 in src/static-files/static-c.txt␊ |
| 335 | + Secret env var "ENV_VAR_4"'s value detected:␊ |
| 336 | + found value at line 20 in dist/static-files/static-a.txt␊ |
| 337 | + found value at line 9 in netlify.toml␊ |
| 338 | + found value at line 20 in src/static-files/static-a.txt␊ |
| 339 | + Secret env var "ENV_VAR_MULTILINE_A"'s value detected:␊ |
| 340 | + found value at line 17 in dist/static-files/static-c.txt␊ |
| 341 | + found value at line 38 in dist/static-files/static-c.txt␊ |
| 342 | + found value at line 1 in dist/static-files/static-d.txt␊ |
| 343 | + found value at line 15 in netlify.toml␊ |
| 344 | + found value at line 17 in src/static-files/static-c.txt␊ |
| 345 | + found value at line 38 in src/static-files/static-c.txt␊ |
| 346 | + found value at line 1 in src/static-files/static-d.txt␊ |
| 347 | + Secret env var "ENV_VAR_MULTILINE_B"'s value detected:␊ |
| 348 | + found value at line 4 in dist/static-files/static-d.txt␊ |
| 349 | + found value at line 1 in dist/static-files/static-e.txt␊ |
| 350 | + found value at line 21 in netlify.toml␊ |
| 351 | + found value at line 4 in src/static-files/static-d.txt␊ |
| 352 | + found value at line 1 in src/static-files/static-e.txt␊ |
| 353 | + ␊ |
| 354 | + To prevent exposing secrets, the build will fail until these secret values are not found in build output or repo files.␊ |
| 355 | + If these are expected, use SECRETS_SCAN_OMIT_PATHS, SECRETS_SCAN_OMIT_KEYS, or SECRETS_SCAN_ENABLED to prevent detecting.␊ |
| 356 | + For more information on secrets scanning, see the Netlify Docs: https://ntl.fyi/configure-secrets-scanning␊ |
| 357 | + ␊ |
| 358 | + Secrets scanning detected secrets in files during build. ␊ |
| 359 | + ────────────────────────────────────────────────────────────────␊ |
| 360 | + ␊ |
| 361 | + Error message␊ |
| 362 | + Secrets scanning found secrets in build.␊ |
| 363 | + ␊ |
| 364 | + Resolved config␊ |
| 365 | + build:␊ |
| 366 | + command: cp -r ./src/. ./dist␊ |
| 367 | + commandOrigin: config␊ |
| 368 | + environment:␊ |
| 369 | + - ENV_VAR_1␊ |
| 370 | + - ENV_VAR_2␊ |
| 371 | + - ENV_VAR_3␊ |
| 372 | + - ENV_VAR_4␊ |
| 373 | + - ENV_VAR_5␊ |
| 374 | + - ENV_VAR_6␊ |
| 375 | + - ENV_VAR_7␊ |
| 376 | + - NOT_SECRET_VAL␊ |
| 377 | + - ENV_VAR_MULTILINE_A␊ |
| 378 | + - ENV_VAR_MULTILINE_B␊ |
| 379 | + - ENV_VAR_MULTI_NOT_SECRET␊ |
| 380 | + publish: packages/build/tests/secrets_scanning/fixtures/src_scanning_env_vars_set_non_empty/dist␊ |
| 381 | + publishOrigin: config` |
| 382 | + |
| 383 | +## secrets scanning should report success to API when no secrets are found |
| 384 | + |
| 385 | +> Snapshot 1 |
| 386 | +
|
| 387 | + `␊ |
| 388 | + Netlify Build ␊ |
| 389 | + ────────────────────────────────────────────────────────────────␊ |
| 390 | + ␊ |
| 391 | + > Version␊ |
| 392 | + @netlify/build 1.0.0␊ |
| 393 | + ␊ |
| 394 | + > Flags␊ |
| 395 | + debug: false␊ |
| 396 | + ␊ |
| 397 | + > Current directory␊ |
| 398 | + packages/build/tests/secrets_scanning/fixtures/src_scanning_env_vars_no_matches␊ |
| 399 | + ␊ |
| 400 | + > Config file␊ |
| 401 | + packages/build/tests/secrets_scanning/fixtures/src_scanning_env_vars_no_matches/netlify.toml␊ |
| 402 | + ␊ |
| 403 | + > Context␊ |
| 404 | + production␊ |
| 405 | + ␊ |
| 406 | + build.command from netlify.toml ␊ |
| 407 | + ────────────────────────────────────────────────────────────────␊ |
| 408 | + ␊ |
| 409 | + $ cp -r ./src/static-files ./dist␊ |
| 410 | + ␊ |
| 411 | + (build.command completed in 1ms)␊ |
| 412 | + ␊ |
| 413 | + Scanning for secrets in code and build output. ␊ |
| 414 | + ────────────────────────────────────────────────────────────────␊ |
| 415 | + ␊ |
| 416 | + SECRETS_SCAN_OMIT_PATHS override option set to: netlify.toml␊ |
| 417 | + ␊ |
| 418 | + Secrets scanning complete. 4 file(s) scanned. No secrets detected in build output or repo code!␊ |
| 419 | + ␊ |
| 420 | + (Secrets scanning completed in 1ms)␊ |
| 421 | + ␊ |
| 422 | + Netlify Build Complete ␊ |
| 423 | + ────────────────────────────────────────────────────────────────␊ |
| 424 | + ␊ |
| 425 | + (Netlify Build completed in 1ms)` |
| 426 | + |
279 | 427 | ## secrets scanning, should fail build when it finds secrets in the src and build output |
280 | 428 |
|
281 | 429 | > Snapshot 1 |
|
0 commit comments