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

Allow artifacts to have aliases #2190

Merged
merged 2 commits into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fixed tests
  • Loading branch information
scudette committed Oct 25, 2022
commit 3026ebcbbf75d882435397432f3ffd4072f737f8
130 changes: 70 additions & 60 deletions artifacts/proto/artifact.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions artifacts/proto/artifact.proto
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ message Artifact {

// The artifact is built into the Velociraptor binary.
bool built_in = 20;
bool is_alias = 22;
}

message ArtifactDescriptors {
Expand Down
2 changes: 1 addition & 1 deletion services/repository/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (self *PluginTestSuite) TestArtifactsSyntax() {
artifact, pres := repository.Get(ConfigObj, artifact_name)
assert.True(self.T(), pres)

if artifact != nil {
if artifact != nil && !artifact.IsAlias {
_, err = new_repository.LoadProto(artifact, true /* validate */)
assert.NoError(self.T(), err, "Error compiling "+artifact_name)
}
Expand Down
1 change: 1 addition & 0 deletions services/repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ func (self *Repository) LoadProto(artifact *artifacts_proto.Artifact, validate b
// Make a copy of the artifact definition
artifact_copy := proto.Clone(artifact).(*artifacts_proto.Artifact)
artifact_copy.Name = alias
artifact_copy.IsAlias = true
self.Data[alias] = artifact_copy
}
self.mu.Unlock()
Expand Down