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

[POA-2003] Set obfuscation enum in witness method meta #36

Merged
merged 5 commits into from
Oct 8, 2024
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/AlecAivazis/survey/v2 v2.3.6
github.com/OneOfOne/xxhash v1.2.8
github.com/Pallinder/go-randomdata v1.2.0
github.com/akitasoftware/akita-ir v0.0.0-20240815175436-58df31060c47
github.com/akitasoftware/akita-libs v0.0.0-20240820205141-dc8c30c29a5b
github.com/akitasoftware/akita-ir v0.0.0-20241008173748-ca8e2e3d5db4
github.com/akitasoftware/akita-libs v0.0.0-20241008174225-3b01e02d3430
github.com/akitasoftware/go-utils v0.0.0-20240213133309-b95d4ace8803
github.com/andybalholm/brotli v1.0.1
github.com/aws/aws-sdk-go-v2 v1.17.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ github.com/Pallinder/go-randomdata v1.2.0 h1:DZ41wBchNRb/0GfsePLiSwb0PHZmT67XY00
github.com/Pallinder/go-randomdata v1.2.0/go.mod h1:yHmJgulpD2Nfrm0cR9tI/+oAgRqCQQixsA8HyRZfV9Y=
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/akitasoftware/akita-ir v0.0.0-20240815175436-58df31060c47 h1:TDwN055fb5Jhki+Gefi5ltc8yuH8cnzCSfBn8EqSNcM=
github.com/akitasoftware/akita-ir v0.0.0-20240815175436-58df31060c47/go.mod h1:WEWPzhZtxlJnov3MxcqSDiZaHHf00vs3aJwCdt3OwzA=
github.com/akitasoftware/akita-libs v0.0.0-20240820205141-dc8c30c29a5b h1:uv2OpBVS7OQRj2oNxRjvypelKIibJhZnfXPXxdFzrm0=
github.com/akitasoftware/akita-libs v0.0.0-20240820205141-dc8c30c29a5b/go.mod h1:a/vNhO1KQ5Qmz70Tvva4KfQKySiIpNmfJLdpArov3uc=
github.com/akitasoftware/akita-ir v0.0.0-20241008173748-ca8e2e3d5db4 h1:jbsA7E68G4dkK+ldQKQNPFIaRojFCn+cEB3gEEUSEU4=
github.com/akitasoftware/akita-ir v0.0.0-20241008173748-ca8e2e3d5db4/go.mod h1:WEWPzhZtxlJnov3MxcqSDiZaHHf00vs3aJwCdt3OwzA=
github.com/akitasoftware/akita-libs v0.0.0-20241008174225-3b01e02d3430 h1:rmeFo57G8voBffbLNBGsqpBtmc7+awRHcWSSk7XdBd4=
github.com/akitasoftware/akita-libs v0.0.0-20241008174225-3b01e02d3430/go.mod h1:5rzkpaJI1sA9CtGELYZpf15oczAVopcyda2WsYG5xno=
github.com/akitasoftware/go-utils v0.0.0-20240213133309-b95d4ace8803 h1:ebIh/EFuaP8GczzMe8EwVID/blSv5Tej6S8NE4xyarQ=
github.com/akitasoftware/go-utils v0.0.0-20240213133309-b95d4ace8803/go.mod h1:+IOXf7l/QCAQECJzjJwhTp1sBkRoJ6WciZwJezUwBa4=
github.com/akitasoftware/gopacket v1.1.18-0.20240820200020-7289ae956f70 h1:VnU7QLDBwRujpQoHwShs5yu0Ahv1fSalNJa4UijwlmY=
Expand Down
3 changes: 3 additions & 0 deletions trace/backend_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ func (c *BackendCollector) processTLSHandshake(tls akinet.TLSHandshakeMetadata)
}

func (c *BackendCollector) queueUpload(w *witnessWithInfo) {
// Mark the method as not obfuscated.
w.witness.GetMethod().GetMeta().GetHttp().Obfuscation = pb.HTTPMethodMeta_NONE

for _, p := range c.plugins {
if err := p.Transform(w.witness.GetMethod()); err != nil {
// Only upload if plugins did not return error.
Expand Down
1 change: 1 addition & 0 deletions trace/backend_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func TestObfuscate(t *testing.T) {
Method: "POST",
PathTemplate: "/v1/doggos",
Host: "example.com",
Obfuscation: pb.HTTPMethodMeta_ZERO_VALUE,
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions trace/obfuscate.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
func obfuscate(m *pb.Method) {
var ov obfuscationVisitor
vis.Apply(&ov, m)

// Mark the method as obfuscated.
m.GetMeta().GetHttp().Obfuscation = pb.HTTPMethodMeta_ZERO_VALUE
liujed marked this conversation as resolved.
Show resolved Hide resolved
}

type obfuscationVisitor struct {
Expand Down