Skip to content

Commit

Permalink
Remove security level from profile
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Dec 15, 2023
1 parent de2cf91 commit 79ec395
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
1 change: 0 additions & 1 deletion profile/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func MergeProfiles(name string, primary *Profile, secondaries ...*Profile) (newP
Description: primary.Description,
Homepage: primary.Homepage,
UsePresentationPath: false, // Disable presentation path.
SecurityLevel: primary.SecurityLevel,
Config: primary.Config,
Created: nowUnix,
}
Expand Down
16 changes: 0 additions & 16 deletions profile/profile-layered.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ func NewLayeredProfile(localProfile *Profile) *LayeredProfile {

// TODO: Load additional profiles.

lp.updateCaches()

lp.CreateMeta()
lp.SetKey(runtime.DefaultRegistry.DatabaseName() + ":" + revisionProviderPrefix + localProfile.ScopedID())

Expand Down Expand Up @@ -292,27 +290,13 @@ func (lp *LayeredProfile) Update(md MatchingData, createProfileCallback func() *
// get global config validity flag
lp.globalValidityFlag.Refresh()

// update cached data fields
lp.updateCaches()

// bump revision counter
lp.increaseRevisionCounter(false)
}

return lp.RevisionCounter
}

func (lp *LayeredProfile) updateCaches() {
// update security level
var newLevel uint8
for _, layer := range lp.layers {
if newLevel < layer.SecurityLevel {
newLevel = layer.SecurityLevel
}
}
atomic.StoreUint32(lp.securityLevel, uint32(newLevel))
}

// SecurityLevel returns the highest security level of all layered profiles. This function is atomic and does not require any locking.
func (lp *LayeredProfile) SecurityLevel() uint8 {
return uint8(atomic.LoadUint32(lp.securityLevel))
Expand Down
6 changes: 0 additions & 6 deletions profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ type Profile struct { //nolint:maligned // not worth the effort
UsePresentationPath bool
// Fingerprints holds process matching information.
Fingerprints []Fingerprint
// SecurityLevel is the mininum security level to apply to
// connections made with this profile.
// Note(ppacher): we may deprecate this one as it can easily
// be "simulated" by adjusting the settings
// directly.
SecurityLevel uint8
// Config holds profile specific setttings. It's a nested
// object with keys defining the settings database path. All keys
// until the actual settings value (which is everything that is not
Expand Down

0 comments on commit 79ec395

Please sign in to comment.