Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gcs): do not skip signing with allow_anonymous #4979

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

jdockerty
Copy link
Contributor

@jdockerty jdockerty commented Aug 7, 2024

Which issue does this PR close?

Fixes an oversight I made in #4965

Rationale for this change

allow_anonymous is for allowing access when explicitly allowed and credentials are not given (e.g. public buckets) and not for skipping signing entirely.

@@ -112,9 +112,6 @@ impl GcsCore {
}

pub async fn sign<T>(&self, req: &mut Request<T>) -> Result<()> {
if self.allow_anonymous {
Copy link
Member

Choose a reason for hiding this comment

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

Thanks so much for the quick fix. Could you also help with load_token? I think the logic should be to skip signing if token.is_none(). Additionally, load_token should correctly manage allow_anonymous.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

skip signing if token.is_none()

I believe this is for the other PR which introduces the token: Option<String> field?

Copy link
Member

Choose a reason for hiding this comment

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

I believe this is for the other PR which introduces the token: Option<String> field?

I mean:

  • load_token() should return Result<Option<GoogleToken>>
  • if self.token is Some(), we should return it first load_token. (this can be done in the other PR)
  • If load_token() returns None, sign should skip it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, I believe we're talking about the same things here.

I pushed 54c1ae8 just as you wrote this. I believe this covers what you mention here.

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks!

Copy link
Member

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Looks good to me now, thanks a lot!

@Xuanwo
Copy link
Member

Xuanwo commented Aug 7, 2024

This is the last PR I gonna to merge today. 00::39 AM now ❤️

I will review your other PR tomorrow.

@jdockerty
Copy link
Contributor Author

No problem! Get some sleep 🚀

@Xuanwo Xuanwo merged commit 1f4c119 into apache:main Aug 7, 2024
79 checks passed
@jdockerty jdockerty deleted the fix/gcs-allow-anonymous branch August 7, 2024 16:42
@jdockerty
Copy link
Contributor Author

jdockerty commented Aug 9, 2024

@Xuanwo If you don't mind, as a small follow-up on this one.

Do I understand rightly that I need slightly alter how the load_token function works here with allow_anonymous.

Reading the Java implementation from Iceberg's FileIO, the GCS_NO_AUTH here is explicitly set for testing purposes and allows no credentials.

I think the equivalent of that here is that the load_token function returns instantly when GCS_NO_AUTH is set, or am I misunderstanding this?

impl GcsCore {
    async fn load_token(&self) -> Result<Option<GoogleToken>> {
        if self.allow_anonymous {
          return Ok(None);
        }
        // proceed to load...

I ask because the tests I have for the iceberg-rust PR with GCS_NO_AUTH no longer work after using latest changes on main (which includes this PR), but I think it is because I've muddled up the meaning of GCS_NO_AUTH and anonymous access.

@Xuanwo
Copy link
Member

Xuanwo commented Aug 9, 2024

Hi @jdockerty, I believe GCS_NO_AUTH should be equivalent to allow_anonymous + disable_vm_metadata + disable_config_load.

@jdockerty
Copy link
Contributor Author

Ah! Thank you, that is the piece I was missing 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants