Skip to content

tuf: resolve https repo source TLS paths against import base#466

Merged
detsch merged 1 commit into
masterfrom
fix-https-import-base-path
May 25, 2026
Merged

tuf: resolve https repo source TLS paths against import base#466
detsch merged 1 commit into
masterfrom
fix-https-import-base-path

Conversation

@EmbeddedAndroid

Copy link
Copy Markdown
Contributor

The local readFileIfExists helper in AkHttpsRepoSource called based_path.get("") which discards the import base path, so relative tls_cacert_path / tls_clientcert_path / tls_pkey_path values from the [import] block resolve to bare filenames in the process CWD. The files are not found, an empty string is written to libcurl's temp cert file, and TLS fails with curl error 58 "Problem with the local SSL certificate" and OpenSSL "PEM routines::no start line".

Pass config.import.base_path through to the helper so paths resolve the same way every other consumer of [import] handles them.

No change for users who already supply absolute paths.


Re-filed from #463 with the source branch moved into this repository so CI runs (per the reviewer comment on #463).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes TLS certificate/key file resolution for AkHttpsRepoSource so relative tls_*_path values from the [import] block are resolved against config.import.base_path (instead of the process CWD), matching how other [import] consumers behave and preventing libcurl/OpenSSL failures when the files can’t be found.

Changes:

  • Update the local TLS file-reading helper to resolve utils::BasedPath against an explicit base directory.
  • Pass config.import.base_path when reading tls_cacert_path, tls_clientcert_path, and tls_pkey_path (both PKCS#11-enabled and non-PKCS#11 builds).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@EmbeddedAndroid EmbeddedAndroid requested a review from mike-sul May 25, 2026 16:20
The local readFileIfExists helper in AkHttpsRepoSource called
based_path.get("") which discards the import base path, so
relative tls_cacert_path / tls_clientcert_path / tls_pkey_path
values from the [import] block resolve to bare filenames in the
process CWD. The files are not found, an empty string is written
to libcurl's temp cert file, and TLS fails with curl error 58
"Problem with the local SSL certificate" and OpenSSL
"PEM routines::no start line".

Pass config.import.base_path through to the helper so paths
resolve the same way every other consumer of [import] handles
them.

While in this block, also fix the tls_pkey selection in the
BUILD_P11 branch: it was gated on config.tls.cert_source but
should be on config.tls.pkey_source. Mixed configurations (cert
from file with key from PKCS#11, or vice versa) would otherwise
pick the wrong source and pass an empty key/id downstream.

No change for users who already supply absolute paths and run
with cert_source == pkey_source.

Signed-off-by: Tyler Baker <tyler.baker@oss.qualcomm.com>
@detsch detsch force-pushed the fix-https-import-base-path branch from 9531ccd to fd395b4 Compare May 25, 2026 17:22
@detsch

detsch commented May 25, 2026

Copy link
Copy Markdown
Member

Merge was blocked due to missing GPG signature. Added mine on Tyler's commit. Will merge once tests pass.

@detsch detsch merged commit c885c28 into master May 25, 2026
24 of 25 checks passed
@detsch detsch deleted the fix-https-import-base-path branch May 25, 2026 17:40
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.

3 participants