Repository navigation
test: ATF coverage for the user/admin security split - #3
Merged
Merged
Conversation
The suite only tested a user with no roles trying to create, so a regression that let the user role update or delete would have passed. Add a test that seeds an item as admin, impersonates a user holding only x_snc_example.user, and checks that secured record update and delete are denied, that AppService returns 403 for them and 201 for create, and that can_write/can_delete are false. Extend the admin service test with update (200), delete (204) and update after delete (404). keys.ts regenerated by npm run build. Co-Authored-By: Claude <noreply@anthropic.com>
The admin CRUD checks ran as the ATF runner, a sysadmin who passes every ACL, so they did not show that x_snc_example.admin grants write and delete. Move them into a test that impersonates a user holding only that role: AppService reports can_write/can_delete true, update returns 200, delete 204, and update after delete 404. keys.ts regenerated by npm run build. Co-Authored-By: Claude <noreply@anthropic.com>
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.
This PR fixes the high finding from the 2026-10-17 repo review: the ATF suite didn't test the security split it advertises.
What changed
itemUserRoleTest: an admin seeds an item, then the test impersonates a user who has onlyx_snc_example.user.record_not_updatedand Record Delete returnsrecord_not_deleted, both with security enforced. The record is checked unchanged afterwards.AppService: list returnscan_write/can_deletefalse, update and delete return 403, and create returns 201.itemAdminRoleTest: impersonates a user who has onlyx_snc_example.admin.can_write/can_deletetrue.keys.tsis regenerated, and there is a CHANGELOG entry.Verification
npm run lint,npm run buildandnpm run build:ci(--frozenKeys) pass.{{step[…].record_id}}wiring are all correct.Test.ts. Its should-fix, that the admin path was running as sysadmin, is addressed byitemAdminRoleTest.generic-api-keylines insrc/fluent/generated/keys.ts. They are SDK-generated record sys_ids, the same false positive that already appears 17 times inmain's history.Not verified: needs an instance
The ATF tests have not run on an instance yet. To verify:
npm run deploy -- --auth <alias>, thennpm run test:instance -- --auth <alias>.Specifically unconfirmed:
runServerSideScriptsees the impersonated user after the intervening steps.GlideRecordSecure.not_*asserts rather than a step error.Conflict note
Open PR #2 also adds a section under
[Unreleased]in CHANGELOG.md. Keep both sections.