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

[Code] Support Conditional/Atomic HTTP operations to secure BIOS #20

Open
nicklela opened this issue May 30, 2023 · 3 comments
Open

[Code] Support Conditional/Atomic HTTP operations to secure BIOS #20

nicklela opened this issue May 30, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@nicklela
Copy link
Contributor

http://redfish.dmtf.org/schemas/DSP0266_1.6.1.html

6.1.5. ETags
In order to reduce the cases of unnecessary RESTful accesses to resources, the Redfish Service should support associating a separate ETag with each resource.

Implementations should support returning ETag properties for each resource.
Implementations should support returning ETag headers for each response that represents a single resource.
Implementations shall support returning ETag headers for GET requests of ManagerAccount resources.
The ETag is generated and provided as part of the resource payload because the service is in the best position to know if the new version of the object is different enough to be considered substantial. There are two types of ETags: weak and strong. If an ETag is supported for a given resource, it shall use the strong ETag format as specified in RFC7232.

This specification does not mandate a particular algorithm for creating the ETag, but ETags should be highly collision-free. An ETag could be a hash, a generation ID, a time stamp or some other value that changes when the underlying object changes.

If a client PUTs or PATCHes a resource, it should include an ETag in the HTTP If-Match/If-None-Match header from a previous GET. If a service supports returning the ETag header on a resource, the service may respond with status code 428 if the If-Match/If-None-Match header is missing from the PUT/PATCH request for the same resource, as specified in RFC6585.

In addition to returning the ETag property on each resource,

A Redfish Service should return the ETag header on client PUT/POST/PATCH
A Redfish Service should return the ETag header on a GET of an individual resource
The format of the ETag header is:

@nicklela
Copy link
Contributor Author

This is the design to make sure that BIOS always use latest context
image

@nicklela
Copy link
Contributor Author

Enhancement:

  • use if-non-match to check resource modification instead of comparing ETag.

Note: OpenBMC has no ETag implementation: https://lore.kernel.org/all/[email protected]/T/

We previously supported etag for static resources, hence the

references to them. They were removed when I moved phosphor-webui to
webpack builds, and it was always on my list to add them back, using
webpacks hashing mechanisms, but I never got a chance.

In practice, they didn't provide that much utility because most browsers:

  1. only cache if you have a valid SSL certificate.
  2. Have a very limited cache size.
  3. Don't support cross site etag caches.

So in practice, the cache didn't provide any benefit in a majority of cases.

In terms of supporting etags on non-static resources, that's quite
complex, given that cache invalidation is difficult, and likely
deserves its own design document.

@nicklela
Copy link
Contributor Author

Another solution is on BMC side:

  • If there is last minute change from end user, BMC won't just clear all context at /Bios/Settings.
  • BMC will check and only remove attribute that is consumed by BIOS. Last minute user change will sty in /Bios/Settings and user will know this change is not consumed yet.

@nicklela nicklela self-assigned this May 30, 2023
@nicklela nicklela added the enhancement New feature or request label May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant