승인 정책

승인 정책 파일은 SDV 서비스 번들의 소프트웨어 정의 차량 (SDV) 통신 스택 승인 구성의 단일 정보 소스입니다.

승인 정책 파일에는 이 서비스 번들의 권한 목록이 포함되어 있으며, 이 목록은 번들이 할 수 있는 작업을 지정합니다.

Proto 스키마

승인 정책 파일은 관련 정보를 인코딩하는 데 textproto 형식을 사용합니다.

승인 정책의 프로토 스키마는 다음과 같습니다.

message AuthzPolicy {
  // Optional. List of permissions to publish Data Tunnel publications.
  repeated Publisher publisher = 4;

  // Optional. List of permissions to discover and subscribe to Data Tunnel
  // publications.
  repeated Subscriber subscriber = 5;

  // Optional. List of permissions to serve an RPC server.
  repeated Server server = 6;

  // Optional. List of permissions to discover and call methods of an RPC
  // server.
  repeated Client client = 7;

  // Optional. Allow blanket "read" permission.
  //
  // Gives permission to discover and call all methods of all RPC servers,
  // as well as discover and subscribe to all publications.
  //
  // WARNING: This flag grants elevated permissions and should be used with a
  // good reason and for privileged agents only (e.g. Telemetry).
  bool allow_read_all = 8;
}

// Defines a permission to publish Data Tunnel publications.
message Publisher {
  // Required. Publication's protobuf message name.
  string message = 1;

  // Topic(s) to which this permission allows to publish to.
  //
  // Setting this field or setting 'allow_all_topics == true' is required.
  repeated string topic = 2;

  // Flag indicates that Service Bundle is allowed to register publication
  // of the 'message' type with any 'topic'
  //
  // Should only be set to 'true' if the 'topic' field is not set.
  bool allow_all_topics = 3;
}

// Defines a permission to discover and subscribe to Data Tunnel publications.
message Subscriber {
  // Required. Publication's protobuf message name.
  string message = 1;

  // Topic(s) to which this permission allows to subscribe to.
  //
  // Setting this field or setting 'allow_all_topics == true' is required.
  repeated string topic = 2;

  // Flag indicates that Service Bundle is allowed to discover and subscribe to
  // all publications of the 'message' type.
  //
  // Should only be set to 'true' if the 'topic' field is not set.
  bool allow_all_topics = 3;
}

// Defines a permission to serve an RPC server.
message Server {
  // Required. Server's protobuf service name.
  string service = 1;

  // Channel(s) which this permission allows to register.
  //
  // Setting this field or setting 'allow_all_channels == true' is required.
  repeated string channel = 2;

  // Flag indicates that Service Bundle is allowed to register RPC servers
  // of the 'service' type with any 'channel'
  //
  // Should only be set to 'true' if the 'channel' field is not set.
  bool allow_all_channels = 3;
}

// Defines a permission to discover and call methods of an RPC server.
message Client {
  // Required. Server's protobuf service name.
  string service = 1;

  // Channel(s) which this permission allows to discover and call methods on.
  //
  // Setting this field or setting 'allow_all_channels == true' is required.
  repeated string channel = 2;

  // Flag indicates that Service Bundle is allowed to discover and call all RPC
  // servers of the 'service' type.
  //
  // Should only be set to 'true' if the 'channel' field is not set.
  bool allow_all_channels = 3;
}

# Allows this SB to register publication of TireStatus type with "left_tire" topic only.
publisher {
  message: "com.sdv.TireStatus"
  topic: "left_tire"
}

# Allows this SB to subscribe to publication of TireStatus type with "left_tire" topic only.
subscriber {
  message: "com.sdv.TireStatus"
  topic: "left_tire"
}

# Allows this SB to implement and serve UserPreferencesManager service on any channel.
server {
  service: "com.sdv.UserPreferencesManager"
  allow_all_channels: true
}

# Allows this SB to discover and call UserPreferencesManager service on any channel.
client {
  service: "com.sdv.UserPreferencesManager"
  allow_all_channels: true
}

권한이 있는 모든 읽기 예시

# Blanket read permission for privileged agents (e.g. Telemetry).
allow_read_all: true

승인 결정

시스템은 다음과 같은 승인 결정을 내릴 수 있습니다.

허용되는 콘텐츠
주체의 AuthzPolicy에 필요한 권한 규칙이 포함되어 있습니다.
명시적으로 거부됨
주체의 AuthzPolicy 또는 VM의 AuthzPolicy에 필요한 권한 규칙이 포함되어 있지 않습니다. 누락된 권한을 나타내는 명확한 오류 메시지가 반환됩니다.
암시적으로 거부됨
정책 파일 누락, 이름 파싱 실패, 단위 정의 누락과 같은 시스템 오류 또는 잘못된 데이터입니다.

결정 로직 예

서비스 번들이 채널 default에서 com.sdv.UserPreferencesManager를 호출하려고 하면 다음 단계가 발생합니다.

  1. 통신 스택은 서비스 번들의 AuthzPolicy에서 client 권한을 확인합니다. 권한이 누락된 경우 요청이 명시적으로 거부되어 주체에게 권한이 없음을 나타냅니다.
  2. 메시 네트워크를 통한 VM 간 통신의 경우 액세스 시도 중에만 확인하는 것이 아니라 서비스 검색 (SD) 메시 정보 교환 중에 호스트 VM의 권한이 확인됩니다. 통신 스택은 호스트 VM의 VmAuthzPolicy를 확인하여 VM이 서비스와 상호작용할 수 있는지 확인합니다.
  3. 주체 정책과 VM 수준 정책 모두 상호작용을 허용하는 경우 요청이 허용됩니다. 그렇지 않으면 명시적으로 거부됨으로 표시되어 VM에 권한이 없음을 나타냅니다.

VM 간에 적용되는 정책에 대한 자세한 내용은 VM 수준 권한을 참고하세요.