Skip to content

Commit d6a2da3

Browse files
feat: [SVLS-6272] fips features for bottlecap (#1028)
We need a `ddcommon/fips` and a `trace_utils/fips` feature. This functionality is written specifically for use in the datadog-lambda-extension. Other use cases should probably validate carefully that the right dependencies are being used in their builds.
1 parent d433dd2 commit d6a2da3

File tree

8 files changed

+64
-44
lines changed

8 files changed

+64
-44
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ jobs:
4444
- name: Run clippy on ${{ matrix.platform }} ${{ matrix.rust_version }}
4545
shell: bash
4646
run: |
47+
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
48+
export AWS_LC_FIPS_SYS_NO_ASM=1
49+
fi
4750
# shellcheck disable=SC2046
4851
cargo clippy --workspace --all-targets --all-features -- -D warnings $([ ${{ matrix.rust_version }} = 1.78.0 ] || [ ${{ matrix.rust_version }} = stable ] && echo -Aunknown-lints -Ainvalid_reference_casting -Aclippy::redundant-closure-call)
52+
4953
licensecheck:
5054
runs-on: ubuntu-latest
5155
name: "Presence of licence headers"

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ jobs:
5656
# Run doc tests with cargo test and run tests with nextest and generate junit.xml
5757
run: cargo test --workspace --exclude builder --doc --verbose && cargo nextest run --workspace --exclude builder --profile ci --verbose -E '!test(tracing_integration_tests::)'
5858
env:
59-
RUST_BACKTRACE: 1
59+
RUST_BACKTRACE: full
6060
- name: "[${{ steps.rust-version.outputs.version}}] Tracing integration tests: cargo nextest run --workspace --exclude builder --profile ci --test-threads=1 --verbose -E 'test(tracing_integration_tests::)'"
6161
if: runner.os == 'Linux'
6262
shell: bash
6363
run: cargo nextest run --workspace --exclude builder --profile ci --test-threads=1 --verbose -E 'test(tracing_integration_tests::)'
6464
env:
65-
RUST_BACKTRACE: 1
65+
RUST_BACKTRACE: full
6666
- name: "[${{ steps.rust-version.outputs.version}}] RUSTFLAGS=\"-C prefer-dynamic\" cargo nextest run --package test_spawn_from_lib --features prefer-dynamic -E '!test(tracing_integration_tests::)'"
6767
shell: bash
6868
run: cargo nextest run --package test_spawn_from_lib --features prefer-dynamic -E '!test(tracing_integration_tests::)'
6969
env:
7070
RUSTFLAGS: "-C prefer-dynamic"
71-
RUST_BACKTRACE: 1
71+
RUST_BACKTRACE: full
7272
- name: Report Test Results
7373
if: success() || failure()
7474
uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # 4.3.1

Cargo.lock

Lines changed: 25 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE-3rdparty.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,7 @@ third_party_libraries:
24922492
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24932493
DEALINGS IN THE SOFTWARE.
24942494
- package_name: aws-lc-rs
2495-
package_version: 1.10.0
2495+
package_version: 1.13.0
24962496
repository: https://github.com/aws/aws-lc-rs
24972497
license: ISC AND (Apache-2.0 OR ISC)
24982498
licenses:
@@ -2905,7 +2905,7 @@ third_party_libraries:
29052905
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29062906
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29072907
- package_name: aws-lc-sys
2908-
package_version: 0.22.0
2908+
package_version: 0.28.0
29092909
repository: https://github.com/aws/aws-lc-rs
29102910
license: ISC AND (Apache-2.0 OR ISC) AND OpenSSL
29112911
licenses:
@@ -15402,9 +15402,9 @@ third_party_libraries:
1540215402
limitations under the License.
1540315403

1540415404
- package_name: itertools
15405-
package_version: 0.12.1
15405+
package_version: 0.10.5
1540615406
repository: https://github.com/rust-itertools/itertools
15407-
license: MIT OR Apache-2.0
15407+
license: MIT/Apache-2.0
1540815408
licenses:
1540915409
- license: MIT
1541015410
text: |
@@ -17827,13 +17827,6 @@ third_party_libraries:
1782717827
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1782817828
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1782917829
THE SOFTWARE.
17830-
- package_name: mirai-annotations
17831-
package_version: 1.12.0
17832-
repository: https://github.com/facebookexperimental/MIRAI
17833-
license: MIT
17834-
licenses:
17835-
- license: MIT
17836-
text: NOT FOUND
1783717830
- package_name: msvc-demangler
1783817831
package_version: 0.10.1
1783917832
repository: https://github.com/mstange/msvc-demangler-rust
@@ -23406,7 +23399,7 @@ third_party_libraries:
2340623399
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2340723400
DEALINGS IN THE SOFTWARE.
2340823401
- package_name: rustls
23409-
package_version: 0.23.18
23402+
package_version: 0.23.23
2341023403
repository: https://github.com/rustls/rustls
2341123404
license: Apache-2.0 OR ISC OR MIT
2341223405
licenses:

ddcommon/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,16 @@ use_webpki_roots = ["hyper-rustls/webpki-roots"]
7676
# Enable this feature to enable stubbing of cgroup
7777
# php directly import this crate and uses functions gated by this feature for their test
7878
cgroup_testing = []
79+
# FIPS mode uses the FIPS-compliant cryptographic provider (Unix only)
80+
fips = ["https", "hyper-rustls/fips"]
81+
82+
[lints.rust]
83+
# We run coverage checks in our github actions. These checks are run with
84+
# --all-features which is incompatible with our fips feature. The crypto
85+
# provider default needs to be set by the caller in fips mode. For now, we want
86+
# to make sure that the coverage tests use the non-fips version of the crypto
87+
# provider initialization logic, so we added a coverage cfg check on the
88+
# function in src/connector/mod.rs. The coverage config is actually not used in
89+
# normal environments, so we need to let the rust linter know that it is in
90+
# fact a real thing, though one that shows up only in some situations.
91+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)'] }

ddcommon/src/connector/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ mod https {
9696
/// sometimes this is done as a side-effect of other operations, but we need to ensure it
9797
/// happens here. On non-unix platforms, ddcommon uses `ring` instead, which handles this
9898
/// at rustls initialization. TODO: Move to the more ergonomic LazyLock when MSRV is 1.80
99+
/// In fips mode we expect someone to have done this already.
100+
#[cfg(any(not(feature = "fips"), coverage))]
99101
fn ensure_crypto_provider_initialized() {
100102
use std::sync::OnceLock;
101103
static INIT_CRYPTO_PROVIDER: OnceLock<()> = OnceLock::new();
@@ -108,6 +110,11 @@ mod https {
108110
});
109111
}
110112

113+
// This actually needs to be done by the user somewhere in their own main. This will only
114+
// be active on Unix platforms
115+
#[cfg(all(feature = "fips", not(coverage)))]
116+
fn ensure_crypto_provider_initialized() {}
117+
111118
#[cfg(feature = "use_webpki_roots")]
112119
pub(super) fn build_https_connector_with_webpki_roots() -> anyhow::Result<
113120
hyper_rustls::HttpsConnector<hyper_util::client::legacy::connect::HttpConnector>,

local-linux.Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ RUN apt-get update && \
1313
protobuf-compiler \
1414
docker.io \
1515
sudo \
16+
wget \
1617
&& rm -rf /var/lib/apt/lists/*
1718

19+
# We need go in order to build aws-lc-fips-sys
20+
RUN wget -O go1.24.2.linux-arm64.tar.gz https://go.dev/dl/go1.24.2.linux-arm64.tar.gz \
21+
&& tar -C /usr/local -xzf go1.24.2.linux-arm64.tar.gz
22+
1823
# Docker-in-Docker configuration (necessary for integration tests)
1924
RUN mkdir -p /var/lib/docker
2025
EXPOSE 2375

trace-utils/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,5 @@ test-utils = [
7676
]
7777
proxy = ["hyper-http-proxy"]
7878
compression = ["zstd", "flate2"]
79+
# FIPS mode uses the FIPS-compliant cryptographic provider (Unix only)
80+
fips = ["ddcommon/fips"]

0 commit comments

Comments
 (0)