feat: add account script step coverage (Batch 1)#183
Merged
Conversation
Add enum variants for all 6 account script steps (Add Account, Change Password, Delete Account, Enable Account, Re-Login, Reset Account Password) and implement dedicated sanitizers in a single accounts.rs module. Also adds --obfuscate-passwords CLI flag and fixes three previously unparsed parameter types: - AccountType: reuses the existing List parser (<List name="...">) - PrivilegeSetReference: new parser, reads name attr with XML unescaping - Password, Old, New: extend the named-calc dispatch arm All six steps share a single accounts.rs file containing dedicated per-step sanitizer functions (sanitize_add_account, sanitize_change_ password, etc.) rather than one file per step. Each sanitizer produces output that matches the FileMaker Script Workspace label/format exactly, including: "Authenticate via:", "Account Name:", "Old Password:", "Privilege Set:", Activate/Deactivate mapping for Enable Account, On/Off for "With dialog", conditional "Expire password" flag, and empty [] brackets for Reset Account Password. Re-Login parameters are reordered from SaXML order (DataSourceReference, With dialog, Name, Password) to Script Workspace order (Account Name, Password, With dialog); DataSourceReference is omitted from output. The new --obfuscate-passwords flag replaces any password calculation value with •••••••• in sanitized output. The flag is implemented via a calc_or_obfuscated() helper in accounts.rs: returns None when no calculation is present (regardless of flag), •••••••• when obfuscate is true and a calculation exists, or the real value otherwise. Five of the six steps already produced correct output via the generic handler; this patch eliminates the remaining⚠️ NOT PARSED⚠️ markers from Add Account, Change Password, Re-Login, and Reset Account Password. Fixes bc-m#28
Contributor
Author
|
If you pull the PR and look at the code you'll probably need to make a decision about whether you want to obfuscate the raw XML as well. Also, the shared function for obfuscating is within accounts.rs. This might need to be moved to utils so that it could be used for steps like Send Email where you would also want to obfuscate the passwords there. It's also an architectural decision if you want each step to be it's own file. Using an agent, it just shoved all these into the one accounts.rs file. |
Contributor
Author
|
Looks like we could also add a few more of the default items to privilege_set_reference.rs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves the remaining⚠️ NOT PARSED ⚠️ warnings for account script steps and
adds a
--obfuscate-passwordsCLI flag for sanitized output.New enum variants (
constants.rs):ChangePassword = 83AddAccount = 134DeleteAccount = 135ResetAccountPassword = 136EnableAccount = 137ReLogin = 138New dedicated sanitizers (
accounts.rs):All six account steps are implemented in a single
accounts.rsmodule withper-step sanitizer functions rather than one file per step. Each function
produces output matching the FileMaker Script Workspace label/format exactly:
Authenticate via:,Account Name:,Password:,Privilege Set:, conditionalExpire passwordOld Password:,Password:,With dialog: On|OffAccount Name:Account Name:,ActivateorDeactivateAccount Name:,Password:,With dialog:(DataSourceReference omitted; params reordered from SaXML)[], orAccount Name:,Password:, conditionalExpire passwordNew parameter parser (
privilege_set_reference.rs):<PrivilegeSetReference name="...">with XML-entity unescaping[Data Entry Only]) and unknown (<unknown>)Extended parameter dispatch (
parameter_values.rs):AccountType→ reusesListparser (inner<List name="...">)Password,Old,New→ extended named-calc arm (same asName,Title, etc.)PrivilegeSetReference→ new parser aboveNew CLI flag (
--obfuscate-passwords):••••••••in sanitized outputcalc_or_obfuscated()helper inaccounts.rs: returnsNonewhen no calculation is present,
••••••••when the flag is set and acalculation exists, or the real value otherwise
config::Flags→script_sanitizer→sanitizer→ accountsanitizer functions
Before / after (Ooe — Accounts script):
All unit + snapshot tests pass.
cargo fmtandcargo clippy -Dwarningsclean.Fixes #28