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 4 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-20241008154243-b6c9139277d2
github.com/akitasoftware/akita-libs v0.0.0-20241008155148-e576f410f201
mudit-postman marked this conversation as resolved.
Show resolved Hide resolved
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-20241008154243-b6c9139277d2 h1:P1NY6/c+Qcq9cz2Uw/2msGNBHOPTuv2kb92lU4gt/jI=
github.com/akitasoftware/akita-ir v0.0.0-20241008154243-b6c9139277d2/go.mod h1:WEWPzhZtxlJnov3MxcqSDiZaHHf00vs3aJwCdt3OwzA=
github.com/akitasoftware/akita-libs v0.0.0-20241008155148-e576f410f201 h1:UXB5PwD49UGDsy3lUZXmu1kD4HyZaMryHilNKKYaggM=
github.com/akitasoftware/akita-libs v0.0.0-20241008155148-e576f410f201/go.mod h1:6Q2tAbfwf8sn4EnXs/SDE7bi0Mlc9fZsH94KQRjSYHI=
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 @@ -290,6 +290,9 @@ func (c *BackendCollector) queueUpload(w *witnessWithInfo) {
// Obfuscate the original value so type inference engine can use it on the
// backend without revealing the actual value.
obfuscate(w.witness.GetMethod())
} else {
// Mark the method as not obfuscated.
w.witness.GetMethod().GetMeta().GetHttp().Obfuscation = pb.HTTPMethodMeta_NONE
mudit-postman marked this conversation as resolved.
Show resolved Hide resolved
}

c.uploadReportBatch.Add(rawReport{
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