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

plugins/bundle: use unique temporary files #4786

Merged

Commits on Jun 16, 2022

  1. plugins/bundle: use unique temporary files

    In order to use the feature to persist activated bundles to disk in a
    cloud environment with shared storage, e.g. Kubernetes with the Amazon
    EFS storage driver, each instance of OPA needs to either synchronize
    their access to the temporary file using advisory file locks, or use
    unique temporary files. If not, then the following situation may occur:
    
    p1: open and trunc tmp file
    p1: write to tmp file
    p2: open and trunc tmp file
    p1: rename tmp file to dst
    p2: write to tmp file
    p2: rename tmp file to dst
    
    This may then lead to the persisted bundle being truncated or corrupted.
    
    Here the approach of using unique temporary files is chosen because it
    avoids the overhead of introducing file locks, and the additional
    dependency since Go lacks any such mechanisms in the standard library.
    
    This solution should avoid truncated or corrupt bundles as `rename()` is
    guaranteed to be atomic, even in file systems like NFS.
    
    Fixes: open-policy-agent#4782
    Signed-off-by: Fredrik Appelros <fredrik.appelros@sinch.com>
    FredrikAppelros committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    6831973 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2022

  1. Configuration menu
    Copy the full SHA
    bd906e4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9562f70 View commit details
    Browse the repository at this point in the history