aws-crt 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/aws-crt-ffi/CMakeLists.txt +49 -41
- data/aws-crt-ffi/crt/aws-c-auth/CMakeLists.txt +0 -10
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/credentials.h +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/include/aws/auth/private/credentials_utils.h +4 -4
- data/aws-crt-ffi/crt/aws-c-auth/source/auth.c +1 -14
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_imds_client.c +206 -68
- data/aws-crt-ffi/crt/aws-c-auth/source/aws_signing.c +5 -0
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_cached.c +6 -6
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_default_chain.c +16 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_ecs.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_process.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_sts_web_identity.c +0 -1
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_provider_x509.c +10 -7
- data/aws-crt-ffi/crt/aws-c-auth/source/credentials_utils.c +35 -26
- data/aws-crt-ffi/crt/aws-c-auth/source/signable_chunk.c +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/tests/CMakeLists.txt +3 -2
- data/aws-crt-ffi/crt/aws-c-auth/tests/aws_imds_client_test.c +1 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_ecs_tests.c +3 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_provider_process_tests.c +65 -16
- data/aws-crt-ffi/crt/aws-c-auth/tests/credentials_tests.c +125 -0
- data/aws-crt-ffi/crt/aws-c-auth/tests/sigv4_signing_tests.c +68 -46
- data/aws-crt-ffi/crt/aws-c-cal/CMakeLists.txt +8 -3
- data/aws-crt-ffi/crt/aws-c-cal/bin/run_x_platform_fuzz_corpus/main.c +9 -0
- data/aws-crt-ffi/crt/aws-c-cal/builder.json +11 -3
- data/aws-crt-ffi/crt/aws-c-cal/cmake/aws-c-cal-config.cmake +14 -5
- data/aws-crt-ffi/crt/aws-c-cal/source/darwin/securityframework_ecc.c +6 -6
- data/aws-crt-ffi/crt/aws-c-cal/source/windows/bcrypt_ecc.c +12 -12
- data/aws-crt-ffi/crt/aws-c-cal/tests/test_case_helper.h +14 -14
- data/aws-crt-ffi/crt/aws-c-common/CMakeLists.txt +21 -1
- data/aws-crt-ffi/crt/aws-c-common/README.md +8 -0
- data/aws-crt-ffi/crt/aws-c-common/cmake/AwsCFlags.cmake +20 -5
- data/aws-crt-ffi/crt/aws-c-common/cmake/AwsFeatureTests.cmake +7 -1
- data/aws-crt-ffi/crt/aws-c-common/format-check.sh +1 -1
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/byte_buf.h +14 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/config.h.in +1 -0
- data/aws-crt-ffi/crt/{aws-c-auth/include/aws/auth → aws-c-common/include/aws/common}/external/cJSON.h +82 -74
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/json.h +335 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/logging.h +1 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/math.inl +2 -2
- data/aws-crt-ffi/crt/aws-c-common/include/aws/common/private/json_impl.h +22 -0
- data/aws-crt-ffi/crt/aws-c-common/include/aws/testing/aws_test_harness.h +2 -0
- data/aws-crt-ffi/crt/aws-c-common/source/byte_buf.c +36 -0
- data/aws-crt-ffi/crt/aws-c-common/source/common.c +5 -2
- data/aws-crt-ffi/crt/aws-c-common/source/external/cJSON.c +3113 -0
- data/aws-crt-ffi/crt/aws-c-common/source/file.c +9 -0
- data/aws-crt-ffi/crt/aws-c-common/source/json.c +348 -0
- data/aws-crt-ffi/crt/aws-c-common/source/logging.c +7 -2
- data/aws-crt-ffi/crt/aws-c-common/source/posix/system_info.c +8 -0
- data/aws-crt-ffi/crt/aws-c-common/source/ref_count.c +3 -1
- data/aws-crt-ffi/crt/aws-c-common/source/windows/file.c +47 -0
- data/aws-crt-ffi/crt/aws-c-common/source/windows/system_info.c +2 -1
- data/aws-crt-ffi/crt/aws-c-common/tests/CMakeLists.txt +5 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/byte_buf_test.c +69 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/json_test.c +134 -0
- data/aws-crt-ffi/crt/aws-c-common/tests/memtrace_test.c +6 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/README.md +18 -35
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream.h +21 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_client.h +14 -2
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/event_stream_rpc_server.h +13 -0
- data/aws-crt-ffi/crt/aws-c-event-stream/include/aws/event-stream/private/event_stream_rpc_priv.h +7 -7
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream.c +257 -141
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_channel_handler.c +1 -1
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_client.c +31 -8
- data/aws-crt-ffi/crt/aws-c-event-stream/source/event_stream_rpc_server.c +63 -10
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/CMakeLists.txt +2 -0
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_client_connection_test.c +157 -106
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/event_stream_rpc_server_connection_test.c +168 -1
- data/aws-crt-ffi/crt/aws-c-event-stream/tests/message_deserializer_test.c +4 -2
- data/aws-crt-ffi/crt/aws-c-http/CMakeLists.txt +1 -0
- data/aws-crt-ffi/crt/aws-c-http/README.md +8 -0
- data/aws-crt-ffi/crt/aws-c-http/bin/elasticurl/main.c +1 -1
- data/aws-crt-ffi/crt/aws-c-http/builder.json +4 -3
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection.h +8 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/connection_manager.h +45 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/http2_stream_manager.h +63 -12
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/connection_impl.h +2 -1
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_connection.h +20 -2
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_frames.h +1 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/h2_stream.h +42 -13
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http2_stream_manager_impl.h +17 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/http_impl.h +3 -0
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/random_access_set.h +10 -3
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/private/request_response_impl.h +3 -17
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/request_response.h +108 -4
- data/aws-crt-ffi/crt/aws-c-http/include/aws/http/statistics.h +22 -0
- data/aws-crt-ffi/crt/aws-c-http/source/connection.c +8 -3
- data/aws-crt-ffi/crt/aws-c-http/source/connection_manager.c +22 -3
- data/aws-crt-ffi/crt/aws-c-http/source/connection_monitor.c +32 -14
- data/aws-crt-ffi/crt/aws-c-http/source/h1_connection.c +14 -0
- data/aws-crt-ffi/crt/aws-c-http/source/h1_encoder.c +7 -4
- data/aws-crt-ffi/crt/aws-c-http/source/h2_connection.c +161 -45
- data/aws-crt-ffi/crt/aws-c-http/source/h2_decoder.c +37 -8
- data/aws-crt-ffi/crt/aws-c-http/source/h2_frames.c +13 -1
- data/aws-crt-ffi/crt/aws-c-http/source/h2_stream.c +345 -87
- data/aws-crt-ffi/crt/aws-c-http/source/hpack.c +3 -0
- data/aws-crt-ffi/crt/aws-c-http/source/http.c +3 -0
- data/aws-crt-ffi/crt/aws-c-http/source/http2_stream_manager.c +266 -39
- data/aws-crt-ffi/crt/aws-c-http/source/random_access_set.c +9 -3
- data/aws-crt-ffi/crt/aws-c-http/source/request_response.c +80 -20
- data/aws-crt-ffi/crt/aws-c-http/source/statistics.c +11 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/CMakeLists.txt +28 -1
- data/aws-crt-ffi/crt/aws-c-http/tests/fuzz/fuzz_h2_decoder_correct.c +5 -3
- data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.c +133 -29
- data/aws-crt-ffi/crt/aws-c-http/tests/h2_test_helper.h +6 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/README.md +40 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/non_tls_server.py +56 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/py_localhost/server.py +329 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_manager.c +1 -1
- data/aws-crt-ffi/crt/aws-c-http/tests/test_connection_monitor.c +2 -2
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_client.c +47 -34
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_encoder.c +4 -4
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h1_server.c +15 -12
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_client.c +582 -25
- data/aws-crt-ffi/crt/aws-c-http/tests/test_h2_encoder.c +3 -3
- data/aws-crt-ffi/crt/aws-c-http/tests/test_localhost_integ.c +530 -0
- data/aws-crt-ffi/crt/aws-c-http/tests/test_stream_manager.c +459 -67
- data/aws-crt-ffi/crt/aws-c-io/CMakeLists.txt +4 -0
- data/aws-crt-ffi/crt/aws-c-io/builder.json +3 -2
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/channel.h +21 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/io.h +3 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/socket.h +6 -0
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/stream.h +35 -5
- data/aws-crt-ffi/crt/aws-c-io/include/aws/io/tls_channel_handler.h +211 -15
- data/aws-crt-ffi/crt/aws-c-io/source/channel.c +56 -30
- data/aws-crt-ffi/crt/aws-c-io/source/darwin/secure_transport_tls_channel_handler.c +0 -24
- data/aws-crt-ffi/crt/aws-c-io/source/io.c +9 -0
- data/aws-crt-ffi/crt/aws-c-io/source/{pkcs11.c → pkcs11_lib.c} +162 -22
- data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_private.h +18 -20
- data/aws-crt-ffi/crt/aws-c-io/source/pkcs11_tls_op_handler.c +221 -0
- data/aws-crt-ffi/crt/aws-c-io/source/posix/socket.c +135 -81
- data/aws-crt-ffi/crt/aws-c-io/source/retry_strategy.c +12 -8
- data/aws-crt-ffi/crt/aws-c-io/source/s2n/s2n_tls_channel_handler.c +252 -215
- data/aws-crt-ffi/crt/aws-c-io/source/stream.c +65 -82
- data/aws-crt-ffi/crt/aws-c-io/source/tls_channel_handler.c +188 -57
- data/aws-crt-ffi/crt/aws-c-io/source/windows/iocp/socket.c +271 -256
- data/aws-crt-ffi/crt/aws-c-io/tests/CMakeLists.txt +21 -12
- data/aws-crt-ffi/crt/aws-c-io/tests/channel_test.c +32 -4
- data/aws-crt-ffi/crt/aws-c-io/tests/io_lib_test.c +37 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/pkcs11_test.c +412 -93
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.crt +15 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.key +5 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p12 +0 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/ec_unittests.p8 +5 -0
- data/aws-crt-ffi/crt/aws-c-io/tests/resources/generateCerts.sh +24 -15
- data/aws-crt-ffi/crt/aws-c-io/tests/socket_test.c +72 -1
- data/aws-crt-ffi/crt/s2n/CMakeLists.txt +6 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/Cargo.toml +1 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/generate/src/main.rs +105 -82
- data/aws-crt-ffi/crt/s2n/bindings/rust/generate.sh +1 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/Cargo.toml +2 -2
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls/src/raw/config.rs +1 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/Cargo.toml +1 -1
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/build.rs +84 -30
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-sys/src/lib.rs +4 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/Cargo.toml +21 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/cert.pem +14 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/certs/key.pem +8 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/client.rs +45 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/examples/server.rs +60 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/src/lib.rs +150 -0
- data/aws-crt-ffi/crt/s2n/bindings/rust/s2n-tls-tokio/tests/handshake.rs +51 -0
- data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.c +98 -77
- data/aws-crt-ffi/crt/s2n/crypto/s2n_drbg.h +10 -7
- data/aws-crt-ffi/crt/s2n/crypto/s2n_openssl.h +2 -0
- data/aws-crt-ffi/crt/s2n/error/s2n_errno.c +1 -1
- data/aws-crt-ffi/crt/s2n/error/s2n_errno.h +1 -0
- data/aws-crt-ffi/crt/s2n/s2n.mk +7 -0
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/repository.py +233 -0
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup-proof.py +8 -7
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/setup.py +17 -18
- data/aws-crt-ffi/crt/s2n/tests/cbmc/templates/scripts/util.py +41 -23
- data/aws-crt-ffi/crt/s2n/tests/fuzz/LD_PRELOAD/global_overrides.c +3 -3
- data/aws-crt-ffi/crt/s2n/tests/integration/s2n_client_endpoint_handshake_test.py +2 -2
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/Makefile +13 -42
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/README.md +6 -1
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/common.py +118 -53
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/configuration.py +108 -88
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/conftest.py +6 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/constants.py +6 -4
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/fixtures.py +21 -12
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/global_flags.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/processes.py +62 -19
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/providers.py +304 -48
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_client_authentication.py +20 -11
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_cross_compatibility.py +41 -17
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_dynamic_record_sizes.py +6 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_early_data.py +105 -48
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_external_psk.py +160 -76
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_fragmentation.py +59 -26
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_happy_path.py +42 -28
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_hello_retry_requests.py +33 -13
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_key_update.py +29 -11
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_ocsp.py +138 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_pq_handshake.py +103 -36
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_session_resumption.py +52 -25
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_signature_algorithms.py +47 -21
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sni_match.py +13 -9
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_sslyze.py +88 -17
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_version_negotiation.py +71 -22
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/test_well_known_endpoints.py +4 -3
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/tox.ini +1 -0
- data/aws-crt-ffi/crt/s2n/tests/integrationv2/utils.py +50 -15
- data/aws-crt-ffi/crt/s2n/tests/litani/CHANGELOG +131 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/CONTRIBUTING.md +16 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/README.md +36 -14
- data/aws-crt-ffi/crt/s2n/tests/litani/THIRD-PARTY +205 -41
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/bin/build-html-doc +7 -7
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/configure +27 -23
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-add-job.scdoc +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-dump-run.scdoc +7 -5
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani-transform-jobs.scdoc +248 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/src/man/litani.scdoc +2 -2
- data/aws-crt-ffi/crt/s2n/tests/litani/doc/templates/index.jinja.html +4 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/README +12 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/original-run.sh +52 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/add-root-node/run-all.py +71 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/README +13 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-1.sh +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-2.sh +35 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-3.sh +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/no-standalone-transform/run-all.py +60 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/README.md +10 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/assumptions.html +42 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/file.dat +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/histogram.dat +7 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-1.sh +41 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-2.sh +47 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-3.sh +41 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/run-all.py +34 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib-table.py +40 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.plt +5 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/fib.py +32 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin-output.py +40 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.plt +5 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/scripts/sin.py +30 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/fib-table.jinja.html +45 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/examples/rich-output/templates/sin-output.jinja.html +30 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/add_job.py +55 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/graph.py +2 -2
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani.py +6 -1
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/litani_report.py +18 -21
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/ninja.py +2 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/run_printer.py +26 -7
- data/aws-crt-ffi/crt/s2n/tests/litani/lib/transform_jobs.py +84 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/litani +28 -33
- data/aws-crt-ffi/crt/s2n/tests/litani/script/release +220 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/templates/dashboard.jinja.html +78 -15
- data/aws-crt-ffi/crt/s2n/tests/litani/templates/pipeline.jinja.html +21 -5
- data/aws-crt-ffi/crt/s2n/tests/litani/test/README +15 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/run +56 -33
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/custom_stages.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/cwd.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/dump_run.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/graph_line_break.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/html_node.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/job_id_env.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/multiproc_dump_run.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_pool_serialize_graph.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ignored.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/no_timed_out_timeout_ok.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pipeline_order.py +53 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/pool_serialize_graph.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/single_pool.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_multi_shell.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_subprocess_shell.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ignored.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/timed_out_timeout_ok.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_delete_job.py +54 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_modify_job.py +46 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/transform_no_change_job.py +44 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/e2e/tests/zero_pool.py +1 -0
- data/aws-crt-ffi/crt/s2n/tests/litani/test/run +82 -12
- data/aws-crt-ffi/crt/s2n/tests/s2n_test.h +58 -33
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_key_schedule_testlib.c +18 -6
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_pq_kat_test_utils.c +4 -4
- data/aws-crt-ffi/crt/s2n/tests/testlib/s2n_testlib.h +2 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_client_hello_retry_test.c +66 -2
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_connection_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_drbg_test.c +34 -14
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_fork_generation_number_test.c +28 -5
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_mem_usage_test.c +6 -0
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_override_openssl_random_test.c +1 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_random_test.c +60 -41
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_self_talk_broken_pipe_test.c +2 -2
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_handshake_early_data_test.c +3 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_hybrid_shared_secret_test.c +9 -1
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_rfc8448_test.c +31 -130
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_key_schedule_test.c +2 -4
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_pq_handshake_test.c +11 -6
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_rfc8448_test.c +19 -21
- data/aws-crt-ffi/crt/s2n/tests/unit/s2n_tls13_secrets_test.c +109 -60
- data/aws-crt-ffi/crt/s2n/tls/s2n_config.c +1 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_config.h +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_connection.c +29 -24
- data/aws-crt-ffi/crt/s2n/tls/s2n_connection.h +5 -5
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_hashes.h +1 -7
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_io.c +2 -0
- data/aws-crt-ffi/crt/s2n/tls/s2n_handshake_transcript.c +0 -44
- data/aws-crt-ffi/crt/s2n/tls/s2n_internal.h +0 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_quic_support.h +1 -1
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_key_schedule.c +1 -2
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.c +84 -44
- data/aws-crt-ffi/crt/s2n/tls/s2n_tls13_secrets.h +3 -9
- data/aws-crt-ffi/crt/s2n/utils/s2n_blob.h +15 -8
- data/aws-crt-ffi/crt/s2n/utils/s2n_fork_detection.c +2 -6
- data/aws-crt-ffi/crt/s2n/utils/s2n_random.c +9 -9
- data/aws-crt-ffi/src/input_stream.c +32 -15
- data/ext/compile.rb +13 -5
- data/lib/aws-crt/platforms.rb +14 -5
- data/lib/aws-crt/string_blob.rb +3 -3
- metadata +61 -7
- data/aws-crt-ffi/crt/aws-c-auth/source/external/cJSON.c +0 -2987
- data/aws-crt-ffi/crt/aws-c-auth/tests/external/cJSON.c +0 -2986
- data/aws-crt-ffi/crt/aws-c-io/tests/error_test.c +0 -20
@@ -3,12 +3,13 @@
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0.
|
4
4
|
*/
|
5
5
|
|
6
|
-
#include <aws/auth/external/cJSON.h>
|
7
6
|
#include <aws/auth/private/credentials_utils.h>
|
8
|
-
#include <aws/common/date_time.h>
|
9
7
|
#include <aws/common/string.h>
|
10
8
|
#include <aws/common/uuid.h>
|
11
9
|
|
10
|
+
#include <aws/common/date_time.h>
|
11
|
+
#include <aws/common/json.h>
|
12
|
+
|
12
13
|
void aws_credentials_query_init(
|
13
14
|
struct aws_credentials_query *query,
|
14
15
|
struct aws_credentials_provider *provider,
|
@@ -48,9 +49,9 @@ void aws_credentials_provider_invoke_shutdown_callback(struct aws_credentials_pr
|
|
48
49
|
}
|
49
50
|
}
|
50
51
|
|
51
|
-
struct aws_credentials *
|
52
|
+
struct aws_credentials *aws_parse_credentials_from_aws_json_object(
|
52
53
|
struct aws_allocator *allocator,
|
53
|
-
struct
|
54
|
+
struct aws_json_value *document_root,
|
54
55
|
const struct aws_parse_credentials_from_json_doc_options *options) {
|
55
56
|
|
56
57
|
AWS_FATAL_ASSERT(allocator);
|
@@ -68,31 +69,38 @@ struct aws_credentials *aws_parse_credentials_from_cjson_object(
|
|
68
69
|
}
|
69
70
|
|
70
71
|
struct aws_credentials *credentials = NULL;
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
struct aws_json_value *access_key_id = NULL;
|
73
|
+
struct aws_json_value *secrete_access_key = NULL;
|
74
|
+
struct aws_json_value *token = NULL;
|
75
|
+
struct aws_json_value *creds_expiration = NULL;
|
75
76
|
|
76
77
|
bool parse_error = true;
|
77
78
|
|
78
79
|
/*
|
79
80
|
* Pull out the credentials components
|
80
81
|
*/
|
81
|
-
|
82
|
-
|
82
|
+
struct aws_byte_cursor access_key_id_cursor;
|
83
|
+
access_key_id =
|
84
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str((char *)options->access_key_id_name));
|
85
|
+
if (!aws_json_value_is_string(access_key_id) ||
|
86
|
+
aws_json_value_get_string(access_key_id, &access_key_id_cursor) == AWS_OP_ERR) {
|
83
87
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse AccessKeyId from Json document.");
|
84
88
|
goto done;
|
85
89
|
}
|
86
90
|
|
87
|
-
|
88
|
-
|
91
|
+
struct aws_byte_cursor secrete_access_key_cursor;
|
92
|
+
secrete_access_key = aws_json_value_get_from_object(
|
93
|
+
document_root, aws_byte_cursor_from_c_str((char *)options->secrete_access_key_name));
|
94
|
+
if (!aws_json_value_is_string(secrete_access_key) ||
|
95
|
+
aws_json_value_get_string(secrete_access_key, &secrete_access_key_cursor) == AWS_OP_ERR) {
|
89
96
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse SecretAccessKey from Json document.");
|
90
97
|
goto done;
|
91
98
|
}
|
92
99
|
|
100
|
+
struct aws_byte_cursor token_cursor;
|
93
101
|
if (options->token_name) {
|
94
|
-
token =
|
95
|
-
if (!
|
102
|
+
token = aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str((char *)options->token_name));
|
103
|
+
if (!aws_json_value_is_string(token) || aws_json_value_get_string(token, &token_cursor) == AWS_OP_ERR) {
|
96
104
|
if (options->token_required) {
|
97
105
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse Token from Json document.");
|
98
106
|
goto done;
|
@@ -100,9 +108,13 @@ struct aws_credentials *aws_parse_credentials_from_cjson_object(
|
|
100
108
|
}
|
101
109
|
}
|
102
110
|
|
111
|
+
// needed to avoid uninitialized local variable error
|
112
|
+
struct aws_byte_cursor creds_expiration_cursor = aws_byte_cursor_from_c_str("");
|
103
113
|
if (options->expiration_name) {
|
104
|
-
creds_expiration =
|
105
|
-
|
114
|
+
creds_expiration =
|
115
|
+
aws_json_value_get_from_object(document_root, aws_byte_cursor_from_c_str((char *)options->expiration_name));
|
116
|
+
if (!aws_json_value_is_string(creds_expiration) ||
|
117
|
+
aws_json_value_get_string(creds_expiration, &creds_expiration_cursor) == AWS_OP_ERR) {
|
106
118
|
if (options->expiration_required) {
|
107
119
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse Expiration from Json document.");
|
108
120
|
goto done;
|
@@ -112,7 +124,6 @@ struct aws_credentials *aws_parse_credentials_from_cjson_object(
|
|
112
124
|
|
113
125
|
uint64_t expiration_timepoint_in_seconds = UINT64_MAX;
|
114
126
|
if (creds_expiration) {
|
115
|
-
struct aws_byte_cursor creds_expiration_cursor = aws_byte_cursor_from_c_str(creds_expiration->valuestring);
|
116
127
|
if (options->expiration_required && creds_expiration_cursor.len == 0) {
|
117
128
|
AWS_LOGF_ERROR(
|
118
129
|
AWS_LS_AUTH_CREDENTIALS_PROVIDER,
|
@@ -142,10 +153,7 @@ struct aws_credentials *aws_parse_credentials_from_cjson_object(
|
|
142
153
|
/*
|
143
154
|
* Build the credentials
|
144
155
|
*/
|
145
|
-
|
146
|
-
struct aws_byte_cursor secret_access_key_cursor = aws_byte_cursor_from_c_str(secrete_access_key->valuestring);
|
147
|
-
|
148
|
-
if (access_key_id_cursor.len == 0 || secret_access_key_cursor.len == 0) {
|
156
|
+
if (access_key_id_cursor.len == 0 || secrete_access_key_cursor.len == 0) {
|
149
157
|
AWS_LOGF_ERROR(
|
150
158
|
AWS_LS_AUTH_CREDENTIALS_PROVIDER,
|
151
159
|
"Parsed an unexpected credentials json document, either access key, secret key is empty.")
|
@@ -156,7 +164,7 @@ struct aws_credentials *aws_parse_credentials_from_cjson_object(
|
|
156
164
|
AWS_ZERO_STRUCT(session_token_cursor);
|
157
165
|
|
158
166
|
if (token) {
|
159
|
-
|
167
|
+
aws_json_value_get_string(token, &session_token_cursor);
|
160
168
|
if (options->token_required && session_token_cursor.len == 0) {
|
161
169
|
AWS_LOGF_ERROR(
|
162
170
|
AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Parsed an unexpected credentials json document with empty token.")
|
@@ -167,7 +175,7 @@ struct aws_credentials *aws_parse_credentials_from_cjson_object(
|
|
167
175
|
credentials = aws_credentials_new(
|
168
176
|
allocator,
|
169
177
|
access_key_id_cursor,
|
170
|
-
|
178
|
+
secrete_access_key_cursor,
|
171
179
|
session_token_cursor,
|
172
180
|
expiration_timepoint_in_seconds);
|
173
181
|
|
@@ -191,12 +199,13 @@ struct aws_credentials *aws_parse_credentials_from_json_document(
|
|
191
199
|
const char *document,
|
192
200
|
const struct aws_parse_credentials_from_json_doc_options *options) {
|
193
201
|
|
194
|
-
|
202
|
+
struct aws_json_value *document_root =
|
203
|
+
aws_json_value_new_from_string(allocator, aws_byte_cursor_from_c_str(document));
|
195
204
|
if (document_root == NULL) {
|
196
205
|
AWS_LOGF_ERROR(AWS_LS_AUTH_CREDENTIALS_PROVIDER, "Failed to parse document as Json document.");
|
197
206
|
return NULL;
|
198
207
|
}
|
199
|
-
struct aws_credentials *credentials =
|
200
|
-
|
208
|
+
struct aws_credentials *credentials = aws_parse_credentials_from_aws_json_object(allocator, document_root, options);
|
209
|
+
aws_json_value_destroy(document_root);
|
201
210
|
return credentials;
|
202
211
|
}
|
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
#include <aws/auth/signable.h>
|
7
7
|
#include <aws/common/string.h>
|
8
|
+
#include <aws/io/stream.h>
|
8
9
|
|
9
10
|
/*
|
10
11
|
* This is a simple aws_signable wrapper implementation for an s3 chunk
|
@@ -65,7 +66,7 @@ static void s_aws_signable_chunk_destroy(struct aws_signable *signable) {
|
|
65
66
|
if (impl == NULL) {
|
66
67
|
return;
|
67
68
|
}
|
68
|
-
|
69
|
+
aws_input_stream_release(impl->chunk_data);
|
69
70
|
aws_string_destroy(impl->previous_signature);
|
70
71
|
|
71
72
|
aws_mem_release(signable->allocator, signable);
|
@@ -99,7 +100,7 @@ struct aws_signable *aws_signable_new_chunk(
|
|
99
100
|
signable->vtable = &s_signable_chunk_vtable;
|
100
101
|
signable->impl = impl;
|
101
102
|
|
102
|
-
impl->chunk_data = chunk_data;
|
103
|
+
impl->chunk_data = aws_input_stream_acquire(chunk_data);
|
103
104
|
impl->previous_signature = aws_string_new_from_array(allocator, previous_signature.ptr, previous_signature.len);
|
104
105
|
if (impl->previous_signature == NULL) {
|
105
106
|
goto on_error;
|
@@ -4,14 +4,14 @@ enable_testing()
|
|
4
4
|
|
5
5
|
file(GLOB TEST_SRC "*.c")
|
6
6
|
file(GLOB TEST_HDRS "*.h")
|
7
|
-
file(GLOB
|
8
|
-
file(GLOB TESTS ${TEST_HDRS} ${TEST_SRC} ${EXTERNAL_TEST_SRC})
|
7
|
+
file(GLOB TESTS ${TEST_HDRS} ${TEST_SRC})
|
9
8
|
|
10
9
|
add_test_case(credentials_create_destroy_test)
|
11
10
|
add_test_case(static_credentials_provider_basic_test)
|
12
11
|
add_test_case(environment_credentials_provider_basic_test)
|
13
12
|
add_test_case(environment_credentials_provider_negative_test)
|
14
13
|
add_test_case(cached_credentials_provider_elapsed_test)
|
14
|
+
add_test_case(cached_credentials_provider_expired_test)
|
15
15
|
add_test_case(cached_credentials_provider_queued_async_test)
|
16
16
|
add_test_case(profile_credentials_provider_new_destroy_defaults_test)
|
17
17
|
add_test_case(profile_credentials_provider_default_test)
|
@@ -83,6 +83,7 @@ add_net_test_case(credentials_provider_sts_from_profile_config_environment_succe
|
|
83
83
|
add_net_test_case(credentials_provider_sts_cache_expiration_conflict)
|
84
84
|
|
85
85
|
add_test_case(credentials_provider_process_new_destroy_from_config)
|
86
|
+
add_test_case(credentials_provider_process_new_destroy_from_config_without_token)
|
86
87
|
add_test_case(credentials_provider_process_new_failed)
|
87
88
|
add_test_case(credentials_provider_process_bad_command)
|
88
89
|
add_test_case(credentials_provider_process_incorrect_command_output)
|
@@ -212,6 +212,8 @@ static int s_aws_ecs_tester_init(struct aws_allocator *allocator) {
|
|
212
212
|
return AWS_OP_ERR;
|
213
213
|
}
|
214
214
|
|
215
|
+
aws_auth_library_init(allocator);
|
216
|
+
|
215
217
|
/* default to everything successful */
|
216
218
|
s_tester.is_connection_acquire_successful = true;
|
217
219
|
s_tester.is_request_successful = true;
|
@@ -225,6 +227,7 @@ static void s_aws_ecs_tester_cleanup(void) {
|
|
225
227
|
aws_condition_variable_clean_up(&s_tester.signal);
|
226
228
|
aws_mutex_clean_up(&s_tester.lock);
|
227
229
|
aws_credentials_release(s_tester.credentials);
|
230
|
+
aws_auth_library_clean_up();
|
228
231
|
}
|
229
232
|
|
230
233
|
static bool s_has_tester_received_credentials_callback(void *user_data) {
|
@@ -68,7 +68,8 @@ static int s_aws_process_test_init_config_profile(
|
|
68
68
|
}
|
69
69
|
|
70
70
|
static int s_aws_process_tester_init(struct aws_allocator *allocator) {
|
71
|
-
(
|
71
|
+
aws_auth_library_init(allocator);
|
72
|
+
|
72
73
|
if (aws_mutex_init(&s_tester.lock)) {
|
73
74
|
return AWS_OP_ERR;
|
74
75
|
}
|
@@ -84,6 +85,7 @@ static void s_aws_process_tester_cleanup(void) {
|
|
84
85
|
aws_condition_variable_clean_up(&s_tester.signal);
|
85
86
|
aws_mutex_clean_up(&s_tester.lock);
|
86
87
|
aws_credentials_release(s_tester.credentials);
|
88
|
+
aws_auth_library_clean_up();
|
87
89
|
}
|
88
90
|
|
89
91
|
static bool s_has_tester_received_credentials_callback(void *user_data) {
|
@@ -127,6 +129,20 @@ AWS_STATIC_STRING_FROM_LITERAL(
|
|
127
129
|
"\"Expiration\":\"2020-02-25T06:03:31Z\"}'");
|
128
130
|
#endif
|
129
131
|
|
132
|
+
#ifdef _WIN32
|
133
|
+
AWS_STATIC_STRING_FROM_LITERAL(
|
134
|
+
s_test_command_without_token,
|
135
|
+
"echo {\"Version\": 1, \"AccessKeyId\": \"AccessKey123\", "
|
136
|
+
"\"SecretAccessKey\": \"SecretAccessKey321\", "
|
137
|
+
"\"Expiration\":\"2020-02-25T06:03:31Z\"}");
|
138
|
+
#else
|
139
|
+
AWS_STATIC_STRING_FROM_LITERAL(
|
140
|
+
s_test_command_without_token,
|
141
|
+
"echo '{\"Version\": 1, \"AccessKeyId\": \"AccessKey123\", "
|
142
|
+
"\"SecretAccessKey\": \"SecretAccessKey321\", "
|
143
|
+
"\"Expiration\":\"2020-02-25T06:03:31Z\"}'");
|
144
|
+
#endif
|
145
|
+
|
130
146
|
AWS_STATIC_STRING_FROM_LITERAL(s_bad_test_command, "/i/dont/know/what/is/this/command");
|
131
147
|
AWS_STATIC_STRING_FROM_LITERAL(s_bad_command_output, "echo \"Hello, World!\"");
|
132
148
|
|
@@ -143,25 +159,13 @@ AWS_STATIC_STRING_FROM_LITERAL(
|
|
143
159
|
"region=us-west-2\n"
|
144
160
|
"credential_process=");
|
145
161
|
|
146
|
-
static int
|
147
|
-
|
162
|
+
static int s_credentials_provider_process_helper(
|
163
|
+
struct aws_string *config_file_contents,
|
164
|
+
struct aws_allocator *allocator) {
|
148
165
|
|
149
166
|
s_aws_process_tester_init(allocator);
|
150
167
|
|
151
|
-
struct aws_byte_buf content_buf;
|
152
|
-
struct aws_byte_buf existing_content = aws_byte_buf_from_c_str(aws_string_c_str(s_process_config_file_contents));
|
153
|
-
aws_byte_buf_init_copy(&content_buf, allocator, &existing_content);
|
154
|
-
struct aws_byte_cursor cursor = aws_byte_cursor_from_string(s_test_command);
|
155
|
-
ASSERT_TRUE(aws_byte_buf_append_dynamic(&content_buf, &cursor) == AWS_OP_SUCCESS);
|
156
|
-
cursor = aws_byte_cursor_from_c_str("\n");
|
157
|
-
ASSERT_TRUE(aws_byte_buf_append_dynamic(&content_buf, &cursor) == AWS_OP_SUCCESS);
|
158
|
-
|
159
|
-
struct aws_string *config_file_contents = aws_string_new_from_array(allocator, content_buf.buffer, content_buf.len);
|
160
|
-
ASSERT_TRUE(config_file_contents != NULL);
|
161
|
-
aws_byte_buf_clean_up(&content_buf);
|
162
|
-
|
163
168
|
s_aws_process_test_init_config_profile(allocator, config_file_contents);
|
164
|
-
aws_string_destroy(config_file_contents);
|
165
169
|
|
166
170
|
struct aws_credentials_provider_process_options options = {
|
167
171
|
.shutdown_options =
|
@@ -178,10 +182,55 @@ static int s_credentials_provider_process_new_destroy_from_config(struct aws_all
|
|
178
182
|
s_aws_process_tester_cleanup();
|
179
183
|
return 0;
|
180
184
|
}
|
185
|
+
|
186
|
+
static int s_credentials_provider_process_new_destroy_from_config(struct aws_allocator *allocator, void *ctx) {
|
187
|
+
(void)ctx;
|
188
|
+
|
189
|
+
struct aws_byte_buf content_buf;
|
190
|
+
struct aws_byte_buf existing_content = aws_byte_buf_from_c_str(aws_string_c_str(s_process_config_file_contents));
|
191
|
+
aws_byte_buf_init_copy(&content_buf, allocator, &existing_content);
|
192
|
+
struct aws_byte_cursor cursor = aws_byte_cursor_from_string(s_test_command);
|
193
|
+
ASSERT_TRUE(aws_byte_buf_append_dynamic(&content_buf, &cursor) == AWS_OP_SUCCESS);
|
194
|
+
cursor = aws_byte_cursor_from_c_str("\n");
|
195
|
+
ASSERT_TRUE(aws_byte_buf_append_dynamic(&content_buf, &cursor) == AWS_OP_SUCCESS);
|
196
|
+
|
197
|
+
struct aws_string *config_file_contents = aws_string_new_from_array(allocator, content_buf.buffer, content_buf.len);
|
198
|
+
ASSERT_TRUE(config_file_contents != NULL);
|
199
|
+
aws_byte_buf_clean_up(&content_buf);
|
200
|
+
|
201
|
+
ASSERT_SUCCESS(s_credentials_provider_process_helper(config_file_contents, allocator));
|
202
|
+
aws_string_destroy(config_file_contents);
|
203
|
+
return 0;
|
204
|
+
}
|
181
205
|
AWS_TEST_CASE(
|
182
206
|
credentials_provider_process_new_destroy_from_config,
|
183
207
|
s_credentials_provider_process_new_destroy_from_config);
|
184
208
|
|
209
|
+
static int s_credentials_provider_process_new_destroy_from_config_without_token(
|
210
|
+
struct aws_allocator *allocator,
|
211
|
+
void *ctx) {
|
212
|
+
(void)ctx;
|
213
|
+
|
214
|
+
struct aws_byte_buf content_buf;
|
215
|
+
struct aws_byte_buf existing_content = aws_byte_buf_from_c_str(aws_string_c_str(s_process_config_file_contents));
|
216
|
+
aws_byte_buf_init_copy(&content_buf, allocator, &existing_content);
|
217
|
+
struct aws_byte_cursor cursor = aws_byte_cursor_from_string(s_test_command_without_token);
|
218
|
+
ASSERT_TRUE(aws_byte_buf_append_dynamic(&content_buf, &cursor) == AWS_OP_SUCCESS);
|
219
|
+
cursor = aws_byte_cursor_from_c_str("\n");
|
220
|
+
ASSERT_TRUE(aws_byte_buf_append_dynamic(&content_buf, &cursor) == AWS_OP_SUCCESS);
|
221
|
+
|
222
|
+
struct aws_string *config_file_contents = aws_string_new_from_array(allocator, content_buf.buffer, content_buf.len);
|
223
|
+
ASSERT_TRUE(config_file_contents != NULL);
|
224
|
+
aws_byte_buf_clean_up(&content_buf);
|
225
|
+
|
226
|
+
ASSERT_SUCCESS(s_credentials_provider_process_helper(config_file_contents, allocator));
|
227
|
+
aws_string_destroy(config_file_contents);
|
228
|
+
return 0;
|
229
|
+
}
|
230
|
+
AWS_TEST_CASE(
|
231
|
+
credentials_provider_process_new_destroy_from_config_without_token,
|
232
|
+
s_credentials_provider_process_new_destroy_from_config_without_token);
|
233
|
+
|
185
234
|
AWS_STATIC_STRING_FROM_LITERAL(
|
186
235
|
s_process_config_file_no_process_contents,
|
187
236
|
"[profile default]\n"
|
@@ -443,6 +443,131 @@ static int s_cached_credentials_provider_elapsed_test(struct aws_allocator *allo
|
|
443
443
|
|
444
444
|
AWS_TEST_CASE(cached_credentials_provider_elapsed_test, s_cached_credentials_provider_elapsed_test);
|
445
445
|
|
446
|
+
#define TEST_CACHED_CREDENTIALS_EXPIRATION_TIMEPOINT 3600
|
447
|
+
|
448
|
+
static int s_cached_credentials_provider_expired_test(struct aws_allocator *allocator, void *ctx) {
|
449
|
+
(void)ctx;
|
450
|
+
|
451
|
+
mock_aws_set_system_time(0);
|
452
|
+
mock_aws_set_high_res_time(1);
|
453
|
+
|
454
|
+
s_aws_credentials_shutdown_checker_init();
|
455
|
+
|
456
|
+
struct aws_credentials *first_creds = aws_credentials_new_from_string(
|
457
|
+
allocator,
|
458
|
+
s_access_key_id_1,
|
459
|
+
s_secret_access_key_1,
|
460
|
+
s_session_token_1,
|
461
|
+
TEST_CACHED_CREDENTIALS_EXPIRATION_TIMEPOINT);
|
462
|
+
struct aws_credentials *second_creds = aws_credentials_new_from_string(
|
463
|
+
allocator,
|
464
|
+
s_access_key_id_2,
|
465
|
+
s_secret_access_key_2,
|
466
|
+
s_session_token_2,
|
467
|
+
TEST_CACHED_CREDENTIALS_EXPIRATION_TIMEPOINT * 2);
|
468
|
+
|
469
|
+
struct get_credentials_mock_result mock_results[] = {
|
470
|
+
{.error_code = 0, .credentials = first_creds},
|
471
|
+
{.error_code = 0, .credentials = second_creds},
|
472
|
+
};
|
473
|
+
|
474
|
+
struct aws_credentials_provider_shutdown_options shutdown_options;
|
475
|
+
AWS_ZERO_STRUCT(shutdown_options);
|
476
|
+
|
477
|
+
struct aws_credentials_provider *mock_provider =
|
478
|
+
aws_credentials_provider_new_mock(allocator, mock_results, 2, &shutdown_options);
|
479
|
+
|
480
|
+
struct aws_credentials_provider_cached_options options;
|
481
|
+
AWS_ZERO_STRUCT(options);
|
482
|
+
options.source = mock_provider;
|
483
|
+
options.refresh_time_in_milliseconds = TEST_CACHE_REFRESH_TIME_MS;
|
484
|
+
options.high_res_clock_fn = mock_aws_get_high_res_time;
|
485
|
+
options.system_clock_fn = mock_aws_get_system_time;
|
486
|
+
options.shutdown_options.shutdown_callback = s_on_shutdown_complete;
|
487
|
+
options.shutdown_options.shutdown_user_data = NULL;
|
488
|
+
|
489
|
+
struct aws_credentials_provider *cached_provider = aws_credentials_provider_new_cached(allocator, &options);
|
490
|
+
aws_credentials_provider_release(mock_provider);
|
491
|
+
|
492
|
+
struct aws_get_credentials_test_callback_result callback_results;
|
493
|
+
ASSERT_TRUE(s_invoke_get_credentials(cached_provider, &callback_results, 1) == 0);
|
494
|
+
ASSERT_TRUE(s_wait_for_get_credentials(&callback_results) == 0);
|
495
|
+
ASSERT_TRUE(
|
496
|
+
s_verify_callback_status(&callback_results, 1, s_access_key_id_1, s_secret_access_key_1, s_session_token_1) ==
|
497
|
+
0);
|
498
|
+
|
499
|
+
/*
|
500
|
+
* Invoke a couple more times to verify the mock isn't getting called
|
501
|
+
*/
|
502
|
+
aws_get_credentials_test_callback_result_clean_up(&callback_results);
|
503
|
+
ASSERT_TRUE(s_invoke_get_credentials(cached_provider, &callback_results, 1) == 0);
|
504
|
+
ASSERT_TRUE(s_wait_for_get_credentials(&callback_results) == 0);
|
505
|
+
ASSERT_TRUE(
|
506
|
+
s_verify_callback_status(&callback_results, 1, s_access_key_id_1, s_secret_access_key_1, s_session_token_1) ==
|
507
|
+
0);
|
508
|
+
|
509
|
+
aws_get_credentials_test_callback_result_clean_up(&callback_results);
|
510
|
+
ASSERT_TRUE(s_invoke_get_credentials(cached_provider, &callback_results, 1) == 0);
|
511
|
+
ASSERT_TRUE(s_wait_for_get_credentials(&callback_results) == 0);
|
512
|
+
ASSERT_TRUE(
|
513
|
+
s_verify_callback_status(&callback_results, 1, s_access_key_id_1, s_secret_access_key_1, s_session_token_1) ==
|
514
|
+
0);
|
515
|
+
|
516
|
+
/*
|
517
|
+
* Advance time enough to cause a refresh from the caching provider's perspective, but not enough to expire the
|
518
|
+
* actual credentials. Nothing should change because the credential's expiration takes priority.
|
519
|
+
*/
|
520
|
+
uint64_t provider_refresh_in_ns =
|
521
|
+
aws_timestamp_convert(TEST_CACHE_REFRESH_TIME_MS, AWS_TIMESTAMP_MILLIS, AWS_TIMESTAMP_NANOS, NULL);
|
522
|
+
|
523
|
+
uint64_t now = 0;
|
524
|
+
mock_aws_get_high_res_time(&now);
|
525
|
+
mock_aws_set_high_res_time(now + provider_refresh_in_ns);
|
526
|
+
|
527
|
+
mock_aws_get_system_time(&now);
|
528
|
+
mock_aws_set_system_time(now + provider_refresh_in_ns);
|
529
|
+
|
530
|
+
aws_get_credentials_test_callback_result_clean_up(&callback_results);
|
531
|
+
ASSERT_TRUE(s_invoke_get_credentials(cached_provider, &callback_results, 1) == 0);
|
532
|
+
ASSERT_TRUE(s_wait_for_get_credentials(&callback_results) == 0);
|
533
|
+
ASSERT_TRUE(
|
534
|
+
s_verify_callback_status(&callback_results, 1, s_access_key_id_1, s_secret_access_key_1, s_session_token_1) ==
|
535
|
+
0);
|
536
|
+
|
537
|
+
/*
|
538
|
+
* Advance time enough to trigger credentials expiration, verify we get the second set of mocked credentials
|
539
|
+
*/
|
540
|
+
uint64_t credential_expiration_in_ns = aws_timestamp_convert(
|
541
|
+
TEST_CACHED_CREDENTIALS_EXPIRATION_TIMEPOINT, AWS_TIMESTAMP_SECS, AWS_TIMESTAMP_NANOS, NULL);
|
542
|
+
|
543
|
+
mock_aws_get_high_res_time(&now);
|
544
|
+
mock_aws_set_high_res_time(now + credential_expiration_in_ns);
|
545
|
+
|
546
|
+
mock_aws_get_system_time(&now);
|
547
|
+
mock_aws_set_system_time(now + credential_expiration_in_ns);
|
548
|
+
|
549
|
+
aws_get_credentials_test_callback_result_clean_up(&callback_results);
|
550
|
+
ASSERT_TRUE(s_invoke_get_credentials(cached_provider, &callback_results, 1) == 0);
|
551
|
+
ASSERT_TRUE(s_wait_for_get_credentials(&callback_results) == 0);
|
552
|
+
ASSERT_TRUE(
|
553
|
+
s_verify_callback_status(&callback_results, 1, s_access_key_id_2, s_secret_access_key_2, s_session_token_2) ==
|
554
|
+
0);
|
555
|
+
|
556
|
+
aws_get_credentials_test_callback_result_clean_up(&callback_results);
|
557
|
+
aws_credentials_provider_release(cached_provider);
|
558
|
+
|
559
|
+
s_aws_wait_for_provider_shutdown_callback();
|
560
|
+
|
561
|
+
s_aws_credentials_shutdown_checker_clean_up();
|
562
|
+
|
563
|
+
aws_credentials_release(second_creds);
|
564
|
+
aws_credentials_release(first_creds);
|
565
|
+
|
566
|
+
return 0;
|
567
|
+
}
|
568
|
+
|
569
|
+
AWS_TEST_CASE(cached_credentials_provider_expired_test, s_cached_credentials_provider_expired_test);
|
570
|
+
|
446
571
|
static int s_cached_credentials_provider_queued_async_test(struct aws_allocator *allocator, void *ctx) {
|
447
572
|
(void)ctx;
|
448
573
|
|