Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rails/rails
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.2.1
Choose a base ref
...
head repository: rails/rails
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.2.1.1
Choose a head ref
  • 3 commits
  • 43 files changed
  • 2 contributors

Commits on Nov 27, 2018

  1. Do not deserialize GlobalID objects that were not generated by Active…

    … Job
    
    Trusting any GlobaID object when deserializing jobs can allow
    attackers to access information that should not be accessible to them.
    
    Fix CVE-2018-16476.
    rafaelfranca committed Nov 27, 2018
    Configuration menu
    Copy the full SHA
    970b0d7 View commit details
    Browse the repository at this point in the history
  2. Prevent content type and disposition bypass in storage service URLs

    * Force content-type to binary on service urls for relevant content types
    
    We have a list of content types that must be forcibly served as binary,
    but in practice this only means to serve them as attachment always. We
    should also set the Content-Type to the configured binary type.
    
    As a bonus: add text/cache-manifest to the list of content types to be
    served as binary by default.
    
    * Store content-disposition and content-type in GCS
    
    Forcing these in the service_url when serving the file works fine for S3
    and Azure, since these services include params in the signature.
    However, GCS specifically excludes response-content-disposition and
    response-content-type from the signature, which means an attacker can
    modify these and have files that should be served as text/plain attachments
    served as inline HTML for example. This makes our attempt to force
    specific files to be served as binary and as attachment can be easily
    bypassed.
    
    The only way this can be forced in GCS is by storing
    content-disposition and content-type in the object metadata.
    
    * Update GCS object metadata after identifying blob
    
    In some cases we create the blob and upload the data before identifying
    the content-type, which means we can't store that in GCS right when
    uploading. In these, after creating the attachment, we enqueue a job to
    identify the blob, and set the content-type.
    
    In other cases, files are uploaded to the storage service via direct
    upload link. We create the blob before the direct upload, which happens
    independently from the blob creation itself. We then mark the blob as
    identified, but we have already the content-type we need without having
    put it in the service.
    
    In these two cases, then, we need to update the metadata in the GCS
    service.
    
    * Include content-type and disposition in the verified key for disk service
    
    This prevents an attacker from modifying these params in the service
    signed URL, which is particularly important when we want to force them
    to have specific values for security reasons.
    
    * Allow only a list of specific content types to be served inline
    
    This is different from the content types that must be served as binary
    in the sense that any content type not in this list will be always
    served as attachment but with its original content type. Only types in
    this list are allowed to be served either inline or as attachment.
    
    Apart from forcing this in the service URL, for GCS we need to store the
    disposition in the metadata.
    
    Fix CVE-2018-16477.
    rosa authored and rafaelfranca committed Nov 27, 2018
    Configuration menu
    Copy the full SHA
    54ed6ad View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    96dee0e View commit details
    Browse the repository at this point in the history
Loading