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

[40] Disallow use of rmw (main) #67

Merged
merged 2 commits into from
Feb 12, 2024
Merged

Conversation

FifthPotato
Copy link
Contributor

It almost is that easy?

Pertinent questions:

  1. What error code return should I use for it? Not sure what's most relevant in this case...
  2. Should admins still be allowed to use rmw?

New tests for this still pending.

Copy link
Collaborator

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

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

You got it. It's really that easy sometimes :-)

  1. What error code return should I use for it? Not sure what's most relevant in this case...

Hmm, did you look through the error code list and find other codes that could work? The error code file is called rodsErrorTable.h.

Two error codes come to mind:

  • DEPRECATED_PARAMETER
  • SYS_NOT_ALLOWED (I think this is a strong candidate)
  1. Should admins still be allowed to use rmw?

No, for the following reasons:

  • It's a wildcard
    • Requires extra, perhaps costly steps to get right
    • Could be slow
  • We're planning to remove it
    • We want to slowly nudge users/admins away from that subcommand
  • Allowing admins to use rmw makes the plugin's job more difficult

We should probably add a few words to the README that state why imeta rmw is not allowed.

Thoughts?

@trel
Copy link
Member

trel commented Feb 6, 2024

irods/irods#6417 was the deprecation in 4.3.0

removal coming in irods/irods#6766, probably 5.0.0

agreed - no special cases for admins please

@trel
Copy link
Member

trel commented Feb 6, 2024

SYS_NOT_ALLOWED seems the most correct, agreed.

Alternatively, we ship DEPRECATED_PARAMETER until 5.0.0, then ship SYS_NOT_ALLOWED?

@FifthPotato
Copy link
Contributor Author

Found out that addw doesn't seem to bypass metadata_guard, so it doesn't need disabling.

@korydraughn
Copy link
Collaborator

SYS_NOT_ALLOWED seems the most correct, agreed.

Alternatively, we ship DEPRECATED_PARAMETER until 5.0.0, then ship SYS_NOT_ALLOWED?

I get what you're saying, but thinking about it more, disallowing an action and returning a deprecation error code feels wrong. Invoking a deprecated action normally results in the action being allowed at the expense of a warning or log message. For that reason, I think SYS_NOT_ALLOWED is the better choice.

I checked the iRODS server code and we only return DEPRECATED_PARAMETER in the rError stack. We never return that as the top-level API operation return code.

@trel
Copy link
Member

trel commented Feb 7, 2024

You are correct - SYS_NOT_ALLOWED is best.

@trel
Copy link
Member

trel commented Feb 7, 2024

Found out that addw doesn't seem to bypass metadata_guard, so it doesn't need disabling.

Let's make sure we have a test that shows we understand this behavior and have expected results and reasoning.

@korydraughn
Copy link
Collaborator

Please mark outdated comments as resolved if they have been handled.

@FifthPotato FifthPotato marked this pull request as ready for review February 9, 2024 08:56
@FifthPotato
Copy link
Contributor Author

Investigated why rmw can bypass the plugin but addw can't: it just has to do with what inputs cause what. In rmw, you can specify an attribute that doesn't technically start with irods:: (or whatever protected prefix) but will still affect things in protected prefixes (e.g. imeta rmw -d whatever 'irods:%' '%' technically doesn't start with irods::), but I don't think addw supports wildcards in the attribute name.

@trel
Copy link
Member

trel commented Feb 9, 2024

but I don't think addw supports wildcards in the attribute name.

correct - for addw, the wildcards match the target item name (data object, collection, user, resource).

we need to make sure a non-admin user who does have permission to add metadata on an item cannot add a particular AVU that would encroach on a metadata-guarded namespace...

i think right now the addw is failing because the user just doesn't even have permission to add any metadata to the target item... regardless of metadata_guard.

Copy link
Collaborator

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

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

Just a few more changes and I think we're good.

Please confirm the tests pass after resolving the review comments.

Let us know the results of the tests.

@FifthPotato
Copy link
Contributor Author

All tests pass.

@korydraughn
Copy link
Collaborator

Excellent.

Please squash to taste. No pounds just yet.

@FifthPotato
Copy link
Contributor Author

Squished and squashed.

@korydraughn
Copy link
Collaborator

Let's squash the changes for rmw into one commit and the test for addw into a separate commit.

@FifthPotato
Copy link
Contributor Author

Resquished and resquashed. Had to learn a small bit of git-fu for that one.

@trel
Copy link
Member

trel commented Feb 9, 2024

git-fu

!

Copy link
Collaborator

@korydraughn korydraughn left a comment

Choose a reason for hiding this comment

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

Looks like your git-fu worked. Nothing appears to have changed.

Good job.

Pound it!

@FifthPotato
Copy link
Contributor Author

Octothorpe'd!

@alanking alanking merged commit 4f7b7a2 into irods:main Feb 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants