Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Dropped query params when obfuscating #1719

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/instrumentation/core/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function wrapEmitWithTransaction(agent, emit, isHTTPS) {

// the error tracer needs a URL for tracing, even though naming overwrites
transaction.parsedUrl = url.parse(request.url, true)
transaction.url = urltils.obfuscatePath(agent.config, transaction.parsedUrl.path)
transaction.url = urltils.obfuscatePath(agent.config, transaction.parsedUrl.pathname)
transaction.verb = request.method

// URL is sent as an agent attribute with transaction events
Expand Down
22 changes: 22 additions & 0 deletions test/unit/instrumentation/http/http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,28 @@ test('built-in http module instrumentation', (t) => {
}
})

t.test('request.uri should not contain request params', (t) => {
transaction = null
makeRequest(
{
port: 8123,
host: 'localhost',
path: '/foo5/bar5?region=here&auth=secretString',
method: 'GET'
},
finish
)

function finish() {
const segment = transaction.baseSegment
const spanAttributes = segment.attributes.get(DESTINATIONS.SPAN_EVENT)

t.equal(spanAttributes['request.uri'], '/foo5/bar5')

t.end()
}
})

t.test('successful request', (t) => {
transaction = null
const refererUrl = 'https://www.google.com/search/cats?scrubbed=false'
Expand Down
Loading