Skip to content
Snippets Groups Projects
Select Git revision
  • 583270262c5d09a43ca5ee597d269fdf63a865bb
  • master default protected
  • android-7.1.2_r28_klist
  • pie-cts-release
  • pie-vts-release
  • pie-cts-dev
  • oreo-mr1-iot-release
  • sdk-release
  • oreo-m6-s4-release
  • oreo-m4-s12-release
  • pie-release
  • pie-r2-release
  • pie-r2-s1-release
  • oreo-vts-release
  • oreo-cts-release
  • oreo-dev
  • oreo-mr1-dev
  • pie-gsi
  • pie-platform-release
  • pie-dev
  • oreo-cts-dev
  • android-o-mr1-iot-release-1.0.4
  • android-9.0.0_r8
  • android-9.0.0_r7
  • android-9.0.0_r6
  • android-9.0.0_r5
  • android-8.1.0_r46
  • android-8.1.0_r45
  • android-n-iot-release-smart-display-r2
  • android-vts-8.1_r5
  • android-cts-8.1_r8
  • android-cts-8.0_r12
  • android-cts-7.1_r20
  • android-cts-7.0_r24
  • android-o-mr1-iot-release-1.0.3
  • android-cts-9.0_r1
  • android-8.1.0_r43
  • android-8.1.0_r42
  • android-n-iot-release-smart-display
  • android-p-preview-5
  • android-9.0.0_r3
41 results

file.te

Blame
    • Stephen Smalley's avatar
      e13fabd7
      Label /data/media with its own type and allow access. · e13fabd7
      Stephen Smalley authored
      
      /data/media presently is left in system_data_file, which requires
      anything that wants to write to it to be able to write to system_data_file.
      Introduce a new type for /data/media, media_rw_data_file (to match
      the media_rw UID assigned to it and distinguish it from /data/misc/media
      which has media UID and media_data_file type), and allow access to it.
      
      We allow this for all platform app domains as WRITE_MEDIA_STORAGE permission is granted
      to signature|system.  We should not have to allow it to untrusted_app.
      
      Set up type transitions in sdcardd to automatically label any directories
      or files it creates with the new type.
      
      Change-Id: I5c7e6245b854a9213099e40a41d9583755d37d42
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      e13fabd7
      History
      Label /data/media with its own type and allow access.
      Stephen Smalley authored
      
      /data/media presently is left in system_data_file, which requires
      anything that wants to write to it to be able to write to system_data_file.
      Introduce a new type for /data/media, media_rw_data_file (to match
      the media_rw UID assigned to it and distinguish it from /data/misc/media
      which has media UID and media_data_file type), and allow access to it.
      
      We allow this for all platform app domains as WRITE_MEDIA_STORAGE permission is granted
      to signature|system.  We should not have to allow it to untrusted_app.
      
      Set up type transitions in sdcardd to automatically label any directories
      or files it creates with the new type.
      
      Change-Id: I5c7e6245b854a9213099e40a41d9583755d37d42
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
    JSON.hs 2.44 KiB
    {-# LANGUAGE TemplateHaskell #-}
    {-# LANGUAGE FlexibleContexts #-}
    {-# LANGUAGE TypeFamilies #-}
    {-# LANGUAGE FlexibleInstances #-}
    {-# LANGUAGE OverloadedStrings #-}
    
    {-# OPTIONS_GHC -Wno-orphans #-}
    module Compare.JSON
      ( parseFile
      , FromJSONNode(..)
      , ToJSONNode(..)
      ) where
    
    import           Data.Aeson
    import           Data.Aeson.Types (typeMismatch, Parser)
    import qualified Data.ByteString.Lazy as BS
    import qualified Data.Graph.Inductive as G
    import           Data.Text (Text)
    import           Lens.Micro
    
    import           Compare.Types
    import           Compare.Types.Lenses
    
    parseFile :: FromJSON (Graph n e) => BS.ByteString -> Either String (Graph n e)
    parseFile input = eitherDecode' input
    
    class FromJSONNode a where
      parseJSONNode :: Value -> Parser a
    
    class ToJSONNode a where
      toJSONNode :: a -> Value
    
    newtype E n e = E { unE :: (n, n, e) }
    
    instance (FromJSONNode n, HasNodeId n, FromJSON (NodeId n), FromJSON e) => FromJSON (Graph n e) where
      parseJSON (Object v) =  mkGraph
        <$> ((v .: "nodes") >>= mapM parseJSONNode)
        <*> (map unE <$> (v .: "edges"))
        <*> v .: "entry"
      parseJSON invalid = typeMismatch "Graph" invalid
    
    instance (ToJSONNode n, HasNodeId n, ToJSON (NodeId n), ToJSON e) => ToJSON (Graph n e) where
      toJSON g = object
        [ "nodes" .= (g ^. _graph & G.labNodes & map snd & map toJSONNode)
        , "edges" .= (g ^. _graph & G.labEdges & map (toE g))
        , "entry" .= (g ^?! node (g ^. _point) . to nodeId)
        ]
    
    instance FromJSONNode Text where
      parseJSONNode (Object v) = v .: "id"
      parseJSONNode invalid = typeMismatch "NodeLabel" invalid
    
    instance FromJSONNode Int where
      parseJSONNode (Object v) = v .: "id"
      parseJSONNode invalid = typeMismatch "NodeLabel" invalid
    
    instance ToJSONNode Text where
      toJSONNode x = object [ "id" .= toJSON x]
    
    instance ToJSONNode Int where
      toJSONNode x = object [ "id" .= toJSON x]
    
    toE :: HasNodeId n => Graph n e -> G.LEdge e -> E (NodeId n) e
    toE g (from, to', lab) = E ( G.lab (g^._graph) from ^?! _Just . to nodeId
                               , G.lab (g^._graph) to' ^?! _Just . to nodeId
                               , lab)
    
    instance (FromJSON n, FromJSON e) => FromJSON (E n e) where
      parseJSON (Object v) =
        E <$> ((\a b c -> (a,b,c)) <$> v .: "from" <*> v .: "to" <*> v .: "label")
      parseJSON invalid = typeMismatch "Edge" invalid
    
    instance (ToJSON n, ToJSON e) => ToJSON (E n e) where
      toJSON (E (from, to, label)) = object
        [ "from" .= from
        , "to" .= to
        , "label" .= label
        ]