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.

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

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).

@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

…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
@microsoft-github-policy-service

@Suyashd999 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

@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!

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