Skip to content

Conversation

@Suyashd999
Copy link

@Suyashd999 Suyashd999 commented Mar 15, 2025

Summary

This pull request adds support for AWS Signature Version 4 (SigV4) authentication in RESTler, enabling fuzzing of AWS S3-compatible endpoints that require AWS request signing.

Details

  • Introduced a sample authentication module aws_sigv4_auth.py (originally located in restler/utils) to demonstrate how RESTler can sign requests using AWS S3 credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY), leveraging boto3 and botocore.
  • After review feedback, the sample file has been removed from restler/utils to avoid including service-specific logic in the RESTler core codebase.
  • The full sample, with usage and dependency details, is now tracked in a separate GitHub issue for discoverability and ongoing maintenance.

Usage

  • To enable request signing for AWS S3 or other SigV4-compatible endpoints, follow the aws_sigv4_auth.py example in Issue #987.
  • Install dependencies: pip install boto3 botocore
  • Put your AWS credentials in the appropriate environment variables or pass them to the script.
  • Integrate the sample into your test deployment or adapt as needed for your authentication flow.

Related

@Suyashd999 Suyashd999 marked this pull request as ready for review May 26, 2025 09:11
@yuvalif
Copy link

yuvalif commented May 29, 2025

@Suyashd999

  • can you please rename the PR so its name is not RGW/Ceph specific
  • please squash commits

@Suyashd999 Suyashd999 changed the title Current configuration for testing RGW with Restler AWS S3 Authentication and Fuzzing for Ceph RGW Aug 1, 2025
@yuvalif
Copy link

yuvalif commented Aug 25, 2025

@marina-p could please have another look at the PR?

auth_module = Settings().authentication['module']
signing_function = auth_module.get('function', 'sign_request')
signing_module = __import__(auth_module['name'], fromlist=[signing_function])
sign_request = getattr(signing_module, signing_function)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please use the helper import_attr in import_utilities.py?

import boto3
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest
from botocore.credentials import Credentials
Copy link
Contributor

Choose a reason for hiding this comment

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

This module needs to be part of your own team's deployment - RESTler does not maintain authentication for specific services in the code base.

Copy link

Choose a reason for hiding this comment

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

maybe this could be added under an "examples" directory, to give users an idea of how to configure a signer?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally such samples would be working samples with their own set of dependencies that could be installed, tested etc. Since we don't have such samples today, could you please open an issue and attach this there to track adding such examples, but keep it separate from this PR so as not to block the PR?

Copy link
Contributor

@marina-p marina-p left a comment

Choose a reason for hiding this comment

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

🕐


# Add request signing if enabled in authentication settings
if Settings().authentication and Settings().authentication.get('module', {}).get('signing'):
try:
Copy link
Contributor

@marina-p marina-p Oct 13, 2025

Choose a reason for hiding this comment

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

Sorry to be catching this at PR time - could you please make this consistent with the other authentication dictionary structure, so "authentication": { "signing": {"module": {"file"/"function"/...}}}. See SettingsFile.md for the structure. #Resolved

message = _append_to_header(message, f"x-restler-sequence-id: {sequence_id}")

# Add request signing if enabled in authentication settings
if Settings().authentication and Settings().authentication.get('module', {}).get('signing'):
Copy link
Contributor

@marina-p marina-p Oct 13, 2025

Choose a reason for hiding this comment

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

signing

Please update the docs - Authentication.md (quick 1-2 sentences description is sufficient), and SettingsFile.md (sample settings object that works when copied into the engine settings with updated paths). #Resolved

@marina-p
Copy link
Contributor

Ideally, some tests should be added for this using the unit test server. This can be done in a future PR if you've already validated these changes - could you please open an issue to track this?


In reply to: 3395031310

@yuvalif
Copy link

yuvalif commented Oct 15, 2025

Ideally, some tests should be added for this using the unit test server. This can be done in a future PR if you've already validated these changes - could you please open an issue to track this?

In reply to: 3395031310

this configuration and signing mechanism is tested against our server.

if we want to add a dedicated test to restler we probably dont want to test against a full S3 gateway.
several options:

  • just implement somnething simple: e.g. hash the header and add the hash as a filed on the client, the server will look for the hash field and verify it is correct
  • use the IETF standard for HTTP signing. there is a pyhon library that already implements that: https://pypi.org/project/http-message-signatures/ . note that it has the verifier code built into the lib
  • implement a dummy S3 python server that just verify the signature

@Suyashd999
Copy link
Author

hey @marina-p, can you review the PR once again. Thanks!

@Suyashd999 Suyashd999 requested a review from marina-p October 15, 2025 21:09
@marina-p
Copy link
Contributor

Done - just one remaining comment RE: restler/utls, everything else looks good!


In reply to: 3408292266

@Suyashd999
Copy link
Author

Done - just one remaining comment RE: restler/utls, everything else looks good!

In reply to: 3408292266

Hi @marina-p! I have made that change as well. Please do check once ! Thankyou !!

@Suyashd999
Copy link
Author

Hi @marina-p! I have made that change as well. Please do check once ! Thankyou !!

Hey @marina-p, a reminder here. Thankyou!

Copy link
Contributor

@marina-p marina-p left a comment

Choose a reason for hiding this comment

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

:shipit:

@yuvalif
Copy link

yuvalif commented Dec 9, 2025

:shipit:

@marina-p anything else that needs to be done so before this is merged?

@marina-p
Copy link
Contributor

Hi @yuvalif, the code looks good. The contributor license agreement check needs to pass for it to be merged. @Suyashd999, is it possible for you to sign per the required steps?

@marina-p
Copy link
Contributor

See the 'Contributing' section in the README for instructions.

@Suyashd999
Copy link
Author

@microsoft-github-policy-service agree

…iguration structure

- Import and use import_attr helper from utils.import_utilities for cleaner module loading
- Update AWS SigV4 authentication module comments to reflect new config structure
- Document request signing authentication in Authentication.md and SettingsFile.md
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