Skip to content

feat(appsec): contrib/labstack/echo.v4 transparent response body analysis#3578

Merged
RomainMuller merged 5 commits into
mainfrom
romain.marcadier/APPSEC-57836/http-response-body-echo
Jun 6, 2025
Merged

feat(appsec): contrib/labstack/echo.v4 transparent response body analysis#3578
RomainMuller merged 5 commits into
mainfrom
romain.marcadier/APPSEC-57836/http-response-body-echo

Conversation

@RomainMuller

Copy link
Copy Markdown
Contributor

What does this PR do?

Automatically collect HTTP response body information in the echo contrib.

Motivation

Provides improved coverage for AAP features such as the API catalog response schemas & data classification.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running golangci-lint run locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

@github-actions github-actions Bot added the apm:ecosystem contrib/* related feature requests or bugs label Jun 2, 2025
@pr-commenter

pr-commenter Bot commented Jun 2, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-06-06 12:39:16

Comparing candidate commit 0403c7d in PR branch romain.marcadier/APPSEC-57836/http-response-body-echo with baseline commit 2d06fcf in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 21 metrics, 0 unstable metrics.

@RomainMuller
RomainMuller force-pushed the romain.marcadier/APPSEC-57834/http-response-body-sdk branch from 9950270 to 9179334 Compare June 2, 2025 14:39
@RomainMuller
RomainMuller force-pushed the romain.marcadier/APPSEC-57836/http-response-body-echo branch from 998d77d to 39ae9eb Compare June 2, 2025 14:40

RomainMuller commented Jun 2, 2025

Copy link
Copy Markdown
Contributor Author

@RomainMuller
RomainMuller marked this pull request as ready for review June 2, 2025 14:42
@RomainMuller
RomainMuller requested review from a team as code owners June 2, 2025 14:42
Base automatically changed from romain.marcadier/APPSEC-57834/http-response-body-sdk to main June 3, 2025 14:04
@RomainMuller
RomainMuller requested a review from a team as a code owner June 3, 2025 14:04

@eliottness eliottness left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Bind issue make this problematic from a security standpoint. We can either remove it for now or find another access point to call our SDK.

Sidenote: Not sure calling the public SDK inside the contribs make sense especially since we want to put special telemetry for the SDK and the same MonitorHTTPResponseBody and MonitorParsedHTTPBody are available in instrumentation/appsec/httpsec

Comment on lines +99 to +104
func (c appsecContext) XML(code int, i any) error {
if err := appsec.MonitorHTTPResponseBody(c.Request().Context(), i); err != nil {
return err
}
return c.Context.XML(code, i)
}

func (c appsecContext) XMLPretty(code int, i any, indent string) error {
if err := appsec.MonitorHTTPResponseBody(c.Request().Context(), i); err != nil {
return err
}
return c.Context.XMLPretty(code, i, indent)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably come with a small rework of this function to support xml struct tags

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread contrib/labstack/echo.v4/appsec.go Outdated
@RomainMuller
RomainMuller force-pushed the romain.marcadier/APPSEC-57836/http-response-body-echo branch from a6e04f2 to c3b7c4c Compare June 3, 2025 15:31
@RomainMuller
RomainMuller force-pushed the romain.marcadier/APPSEC-57836/http-response-body-echo branch from c3b7c4c to 1d762c1 Compare June 3, 2025 15:54
@RomainMuller
RomainMuller requested a review from eliottness June 4, 2025 10:21
@RomainMuller RomainMuller changed the title feat(appsec): contrib/labstack/echo.v4 transparent body analysis feat(appsec): contrib/labstack/echo.v4 transparent response body analysis Jun 4, 2025
@RomainMuller
RomainMuller enabled auto-merge (squash) June 6, 2025 09:57
@RomainMuller
RomainMuller merged commit 2d915b3 into main Jun 6, 2025
213 checks passed
@RomainMuller
RomainMuller deleted the romain.marcadier/APPSEC-57836/http-response-body-echo branch June 6, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apm:ecosystem contrib/* related feature requests or bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants