Skip to content

[SC-???] Do not request sensitive information unless it's going to be displayed#410

Merged
UserNotFound merged 24 commits intomasterfrom
no-sens-unless-required
Mar 10, 2026
Merged

[SC-???] Do not request sensitive information unless it's going to be displayed#410
UserNotFound merged 24 commits intomasterfrom
no-sens-unless-required

Conversation

@UserNotFound
Copy link
Member

@UserNotFound UserNotFound commented Feb 25, 2026

In a number of cases, there is sensitive information we want to audit (track with Activity) when the user retrieves said information. So, we need to conditionally ask the API to not return that information, until it's actually needed. This is accomplished by first setting the header at the client level, and then reloading a resource when we need to, with resource = with_senstive(resource), before we access sensitive attributes.

Since this requires us to reference aptible api shared object attributes like href and headers, I added a StubAptibleResource and updated all our fabricators to inherit it. This should make further use of with_sensitive(resource)

These changes have been manually tested in integration against the existing API at main, and the planned API changes https://github.com/aptible/deploy-api/pull/2106 and https://github.com/aptible/aptible-integration/pull/600

I also removed the V1 stack code, since it's been years since it was relevant.

@UserNotFound UserNotFound force-pushed the no-sens-unless-required branch from 177f4d8 to 1e53b21 Compare February 28, 2026 19:42
@UserNotFound UserNotFound force-pushed the no-sens-unless-required branch from 7c8c0e4 to e58e023 Compare March 5, 2026 16:34
@UserNotFound UserNotFound force-pushed the no-sens-unless-required branch from 1d36adb to 2549c73 Compare March 5, 2026 23:41
@UserNotFound UserNotFound changed the title [SC-???] [WIP] Do not request sensitive information unless it's going to be displayed [SC-???] Do not request sensitive information unless it's going to be displayed Mar 6, 2026
@UserNotFound UserNotFound requested a review from madhuravius March 6, 2026 00:23
@UserNotFound UserNotFound marked this pull request as ready for review March 6, 2026 00:23
@UserNotFound UserNotFound marked this pull request as draft March 6, 2026 23:56
@UserNotFound UserNotFound removed the request for review from madhuravius March 6, 2026 23:56
@UserNotFound UserNotFound requested a review from madhuravius March 9, 2026 22:43
@UserNotFound UserNotFound marked this pull request as ready for review March 9, 2026 22:43
Copy link
Member

@madhuravius madhuravius left a comment

Choose a reason for hiding this comment

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

i left some comments and questions, this looks good from a code standpoint. i'm actively testing it now and will let you know if i find anything.

let me know if you need an approval (and wish to disregard my requests to leave a few possible clarifying comments, which are optional)

@@ -0,0 +1,25 @@
class StubAptibleResource < OpenStruct
Copy link
Member

Choose a reason for hiding this comment

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

more of a quesiton but why is the filename 00_stub_resource.rb? versus other possible names? do youwant it at the top of the file list? seems strange

Copy link
Member Author

Choose a reason for hiding this comment

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

I found that rspec or the fabricate gem (or whatever) imports them in alphabetical order! Without it being "first", everything is upset:

Screenshot 2026-03-10 at 09 39 24 Screenshot 2026-03-10 at 09 39 37

I think I can just move it to spec/support, though, since it's just a regular class and not fabricate specific, i'll try that.

Copy link
Member

Choose a reason for hiding this comment

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

thanks for the explanation and example, i had no idea. this makes sense to me now! might be worthwhile to leave a note but that's optional!

madhuravius
madhuravius previously approved these changes Mar 10, 2026
Copy link
Member

@madhuravius madhuravius left a comment

Choose a reason for hiding this comment

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

this looks good to me, i'm helping verify this manually and will share if there's any patches needing to be made. given it ran through other tests and the evidence you provided, i'm comfortable with these changes so far (will let you know if i run into anything during testing)

@UserNotFound UserNotFound merged commit 3b02463 into master Mar 10, 2026
10 checks passed
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.

2 participants