Skip to content

refactor(iast): prefer optional chaining over guard expressions#7621

Merged
CarlesDD merged 1 commit intomasterfrom
ccapell/appsec-prefer-optional-chaining
Feb 26, 2026
Merged

refactor(iast): prefer optional chaining over guard expressions#7621
CarlesDD merged 1 commit intomasterfrom
ccapell/appsec-prefer-optional-chaining

Conversation

@CarlesDD
Copy link
Copy Markdown
Contributor

What does this PR do?

Replace x && x.prop guard patterns with optional chaining (x?.prop) across IAST analyzers and evidence redaction code

Motivation

Improve consistency across the appsec codebase.

@CarlesDD CarlesDD self-assigned this Feb 25, 2026
@CarlesDD CarlesDD changed the title refactor(appsec): prefer optional chaining over guard expressions refactor(iast): prefer optional chaining over guard expressions Feb 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Overall package size

Self size: 4.76 MB
Deduped: 5.61 MB
No deduping: 5.61 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 816.75 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.32%. Comparing base (af50fef) to head (5bf6497).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7621   +/-   ##
=======================================
  Coverage   80.32%   80.32%           
=======================================
  Files         734      734           
  Lines       31602    31602           
=======================================
+ Hits        25383    25384    +1     
+ Misses       6219     6218    -1     
Flag Coverage Δ
aiguard-macos 38.80% <ø> (-0.11%) ⬇️
aiguard-ubuntu 38.93% <ø> (-0.11%) ⬇️
aiguard-windows 38.66% <ø> (-0.11%) ⬇️
apm-capabilities-tracing-macos 48.53% <0.00%> (-0.01%) ⬇️
apm-capabilities-tracing-ubuntu 48.57% <0.00%> (ø)
apm-capabilities-tracing-windows 48.27% <0.00%> (ø)
apm-integrations-child-process 38.38% <ø> (-0.10%) ⬇️
apm-integrations-couchbase-18 37.30% <ø> (-0.10%) ⬇️
apm-integrations-couchbase-eol 37.78% <ø> (+0.04%) ⬆️
apm-integrations-oracledb 37.62% <ø> (-0.10%) ⬇️
appsec-express 55.39% <100.00%> (-0.10%) ⬇️
appsec-fastify 51.72% <50.00%> (-0.07%) ⬇️
appsec-graphql 51.91% <75.00%> (-0.07%) ⬇️
appsec-kafka 44.34% <25.00%> (-0.14%) ⬇️
appsec-ldapjs 43.97% <25.00%> (-0.09%) ⬇️
appsec-lodash 43.66% <50.00%> (-0.08%) ⬇️
appsec-macos 58.47% <100.00%> (-0.07%) ⬇️
appsec-mongodb-core 48.71% <50.00%> (-0.19%) ⬇️
appsec-mongoose 49.51% <50.00%> (-0.08%) ⬇️
appsec-mysql 50.89% <25.00%> (-0.07%) ⬇️
appsec-node-serialize 43.17% <25.00%> (-0.09%) ⬇️
appsec-passport 47.64% <ø> (-0.09%) ⬇️
appsec-postgres 50.65% <25.00%> (-0.07%) ⬇️
appsec-sourcing 42.53% <25.00%> (-0.09%) ⬇️
appsec-template 43.34% <25.00%> (-0.09%) ⬇️
appsec-ubuntu 58.55% <100.00%> (-0.07%) ⬇️
appsec-windows 58.33% <100.00%> (-0.07%) ⬇️
instrumentations-instrumentation-bluebird 32.10% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-body-parser 40.39% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-child_process 37.70% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-cookie-parser 34.14% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express 34.48% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.28% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express-session 40.02% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-fs 31.71% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-generic-pool 29.54% <ø> (ø)
instrumentations-instrumentation-http 39.73% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-knex 32.11% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-mongoose 33.28% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-multer 40.13% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-mysql2 38.17% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-passport 43.97% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-http 43.63% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-local 44.18% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-pg 37.59% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-promise 32.03% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-promise-js 32.04% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-q 32.08% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-url 32.00% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-when 32.05% <ø> (-0.11%) ⬇️
llmobs-ai 41.21% <ø> (-0.10%) ⬇️
llmobs-anthropic 40.20% <ø> (-0.10%) ⬇️
llmobs-bedrock 39.15% <ø> (-0.09%) ⬇️
llmobs-google-genai 39.73% <ø> (-0.09%) ⬇️
llmobs-langchain 39.43% <ø> (-0.08%) ⬇️
llmobs-openai 44.01% <ø> (-0.09%) ⬇️
llmobs-vertex-ai 40.00% <ø> (-0.02%) ⬇️
platform-core 29.71% <ø> (ø)
platform-esbuild 32.89% <ø> (ø)
platform-instrumentations-misc 42.88% <ø> (ø)
platform-shimmer 36.14% <ø> (ø)
platform-unit-guardrails 31.27% <ø> (ø)
plugins-azure-event-hubs 24.02% <ø> (ø)
plugins-azure-service-bus 23.42% <ø> (ø)
plugins-bullmq 43.65% <ø> (-0.10%) ⬇️
plugins-cassandra 37.66% <ø> (-0.10%) ⬇️
plugins-cookie 25.08% <ø> (ø)
plugins-cookie-parser 24.87% <ø> (ø)
plugins-crypto 24.72% <ø> (ø)
plugins-dd-trace-api 38.24% <ø> (-0.11%) ⬇️
plugins-express-mongo-sanitize 25.04% <ø> (ø)
plugins-express-session 24.83% <ø> (ø)
plugins-fastify 42.15% <ø> (-0.10%) ⬇️
plugins-fetch 38.21% <ø> (-0.10%) ⬇️
plugins-fs 38.48% <ø> (-0.11%) ⬇️
plugins-generic-pool 24.06% <ø> (ø)
plugins-google-cloud-pubsub 45.33% <ø> (-0.09%) ⬇️
plugins-grpc 40.85% <ø> (-0.10%) ⬇️
plugins-handlebars 25.08% <ø> (ø)
plugins-hapi 40.02% <ø> (-0.10%) ⬇️
plugins-hono 40.29% <ø> (-0.10%) ⬇️
plugins-ioredis 38.29% <ø> (-0.10%) ⬇️
plugins-knex 24.80% <ø> (ø)
plugins-ldapjs 22.61% <ø> (ø)
plugins-light-my-request 24.48% <ø> (ø)
plugins-limitd-client 32.40% <ø> (-0.11%) ⬇️
plugins-lodash 24.13% <ø> (ø)
plugins-mariadb 39.37% <ø> (-0.10%) ⬇️
plugins-memcached 38.04% <ø> (-0.09%) ⬇️
plugins-microgateway-core 39.05% <ø> (-0.18%) ⬇️
plugins-moleculer 40.41% <ø> (-0.10%) ⬇️
plugins-mongodb 39.08% <ø> (-0.10%) ⬇️
plugins-mongodb-core 38.91% <ø> (-0.10%) ⬇️
plugins-mongoose 38.74% <ø> (-0.10%) ⬇️
plugins-multer 24.83% <ø> (ø)
plugins-mysql 39.04% <ø> (-0.10%) ⬇️
plugins-mysql2 39.15% <ø> (-0.10%) ⬇️
plugins-node-serialize 25.12% <ø> (ø)
plugins-opensearch 37.49% <ø> (-0.10%) ⬇️
plugins-passport-http 24.91% <ø> (ø)
plugins-postgres 35.60% <ø> (-0.09%) ⬇️
plugins-process 24.72% <ø> (ø)
plugins-pug 25.08% <ø> (ø)
plugins-redis 38.77% <ø> (-0.10%) ⬇️
plugins-router 42.89% <ø> (-0.10%) ⬇️
plugins-sequelize 23.66% <ø> (ø)
plugins-test-and-upstream-amqp10 38.36% <ø> (+0.04%) ⬆️
plugins-test-and-upstream-amqplib 43.76% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 38.92% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-avsc 38.58% <ø> (-0.11%) ⬇️
plugins-test-and-upstream-bunyan 33.69% <ø> (-0.11%) ⬇️
plugins-test-and-upstream-connect 40.69% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-graphql 40.03% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.27% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-protobufjs 38.81% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-rhea 43.99% <ø> (-0.07%) ⬇️
plugins-undici 39.00% <ø> (-0.09%) ⬇️
plugins-url 24.72% <ø> (ø)
plugins-valkey 37.95% <ø> (-0.10%) ⬇️
plugins-vm 24.72% <ø> (ø)
plugins-winston 33.90% <ø> (-0.10%) ⬇️
plugins-ws 41.79% <ø> (-0.10%) ⬇️
profiling-macos 39.72% <ø> (-0.10%) ⬇️
profiling-ubuntu 39.85% <ø> (-0.10%) ⬇️
profiling-windows 41.07% <ø> (-0.10%) ⬇️
serverless-azure-functions-client 23.75% <ø> (ø)
serverless-azure-functions-eventhubs 23.75% <ø> (ø)
serverless-azure-functions-servicebus 23.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CarlesDD CarlesDD marked this pull request as ready for review February 25, 2026 20:04
@CarlesDD CarlesDD requested a review from a team as a code owner February 25, 2026 20:04
@CarlesDD CarlesDD merged commit 7318451 into master Feb 26, 2026
794 checks passed
@CarlesDD CarlesDD deleted the ccapell/appsec-prefer-optional-chaining branch February 26, 2026 08:31
@dd-octo-sts dd-octo-sts bot mentioned this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants