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

refactor(cli): Integrate standalone mode cert handling into Flags #17419

Merged

Conversation

andreubotella
Copy link
Contributor

The way the standalone mode handles the --cert flag is different to all other modes. This is because --cert takes a path to the certificate file, which is directly added to the root cert store; except for compile mode, where its byte contents are stored in the standalone metadata, and they are added to the root cert store after the ProcState is created.

This change instead changes Flags::ca_file (an Option<String>) into Flags::ca_data, which can represent a String file path or a Vec<u8> with the certificate contents. That way, standalone mode can create a ProcState whose root cert store alreay contains the certificate.

This change also adds a tests for certificates in standalone mode, since there weren't any before.

This refactor will help with implementing web workers in standalone mode in the future.

andreubotella and others added 3 commits January 14, 2023 13:49
The way the standalone mode handles the `--cert` flag is different to
all other modes. This is because `--cert` takes a path to the
certificate file, which is directly added to the root cert store;
except for compile mode, where its byte contents are stored in the
standalone metadata, and they are added to the root cert store after
the `ProcState` is created.

This change instead changes `Flags::ca_file` (an `Option<String>`)
into `Flags::ca_data`, which can represent a `String` file path or a
`Vec<u8>` with the certificate contents. That way, standalone mode can
create a `ProcState` whose root cert store alreay contains the
certificate.

This change also adds a tests for certificates in standalone mode,
since there weren't any before.

This refactor will help with implementing web workers in standalone
mode in the future.
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice cleanup!

@bartlomieju bartlomieju merged commit 69ec45e into denoland:main Jan 18, 2023
@andreubotella andreubotella deleted the integrate-standalone-certs-into-flags branch January 18, 2023 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants