Skip to content

[CSPM] upgrade rego dependency#9535

Merged
paulcacheux merged 3 commits into
mainfrom
paulcacheux/upgrade-opa-rego
Oct 20, 2021
Merged

[CSPM] upgrade rego dependency#9535
paulcacheux merged 3 commits into
mainfrom
paulcacheux/upgrade-opa-rego

Conversation

@paulcacheux

@paulcacheux paulcacheux commented Oct 15, 2021

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR upgrades the dependency github.com/open-policy-agent/opa from v0.31.0 to v0.33.1.
This upgrade implies an upgrade of github.com/dgraph-io/ristretto from v0.0.3 to v0.1.0.

This upgrade is problematic as the dependency on github.com/golang/glog v1.0.0 is added, which is crashing on Windows nanoserver container images because of a missing DLL (netapi32.dll).

See the following PR/issues as other examples of the underlying problem :

The solution implemented in this PR is to fork github.com/golang/glog and recover on a potential panic of the user.Current() function call. We then use a replace in the go.mod to replace use of the original repo with the fork.

Using this fork should not pose major problems as the original repo is not actively developed (it's mainly a mirror of an internal project inside Google that is sync infrequently).

Here is the branch with the fix: https://github.com/paulcacheux/glog/tree/recover-panic-current-user

If this potential solution is agreed upon, we can move this fork under the Datadog Github Org.

Motivation

Keep dependencies up to date.

Describe how to test your changes

This update should be a no-op. The main thing to test is that a windows container based on a nanoserver image can actually start.

Checklist

  • A release note has been added or the changelog/no-changelog label has been applied.
  • The need-change/operator and need-change/helm labels has been applied if applicable.
  • The appropriate team/.. label has been applied, if known.
  • If known, an appropriate milestone has been selected; otherwise the Triage milestone is set.
  • The config template has been updated if applicable.

Note: Adding GitHub labels is only possible for contributors with write access.

@paulcacheux paulcacheux added this to the 7.33.0 milestone Oct 15, 2021
@paulcacheux
paulcacheux force-pushed the paulcacheux/upgrade-opa-rego branch 5 times, most recently from fd5e6af to 943e1eb Compare October 19, 2021 19:14
@paulcacheux
paulcacheux force-pushed the paulcacheux/upgrade-opa-rego branch from 943e1eb to b89e9d3 Compare October 20, 2021 07:20
@paulcacheux
paulcacheux marked this pull request as ready for review October 20, 2021 09:21
@paulcacheux
paulcacheux requested review from a team and mx-psi October 20, 2021 09:22

@mx-psi mx-psi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! I have a small question to understand this better: do you understand what are the implications of returning an empty user? To put it another way, where is the username value used in glog?

@paulcacheux

Copy link
Copy Markdown
Contributor Author

Returning the empty string as a username will just leave the username to its default value (currently unknownuser), this is the mechanism that was already used if the call to user.Current() was returning an error.

This username is only used in the file name where the logs are dumped.

@mx-psi mx-psi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, looks good to me then :)

@paulcacheux

Copy link
Copy Markdown
Contributor Author

Do you want me to move the fork under Datadog org then ? Or should I just let the fork where it is currently ?

@mx-psi

mx-psi commented Oct 20, 2021

Copy link
Copy Markdown
Member

Do you want me to move the fork under Datadog org then ? Or should I just let the fork where it is currently ?

No strong opinion on it, I will let the Agent security team decide that

@paulcacheux
paulcacheux merged commit 98480fb into main Oct 20, 2021
@paulcacheux
paulcacheux deleted the paulcacheux/upgrade-opa-rego branch October 20, 2021 13:36
zandrewitte pushed a commit to StackVista/stackstate-agent that referenced this pull request Nov 17, 2022
* [CSPM] upgrade rego dependency

* [CSPM] update license file

* [CSPM] replace glog 1.0.0 with non-panicing fork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants