Skip to content

Commit

Permalink
feat: ✨ referrer / origin website of s3 buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecBlance committed Oct 20, 2024
1 parent 31fa3dc commit 3779fe3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/components/Bucket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ const Bucket = ({
</div>
</AccordionTrigger>
{isPermPresent && (
<AccordionContent className="bg-secondary p-2 text-xs">
<AccordionContent className="space-y-2 bg-secondary p-2 text-xs">
{info.origin && (
<p>
<b>Origin:</b> {info.origin}
</p>
)}
<div className="flex flex-col gap-y-2">
{Object.entries(info.permissions).map(([key, value]) => (
<div key={key} className="flex flex-col gap-y-1">
Expand Down
8 changes: 4 additions & 4 deletions src/lib/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const getPerms = ($: cheerio.CheerioAPI, hostname: string) => {
const hasListBucket = $("ListBucketResult");
let type = "";
const date = new Date().getTime();
console.log("Date", date);
console.log("Hostname", hostname);

try {
if (!hasUri.length && !hasCode.length && hasListBucket)
throw new Error("No permissions");
Expand Down Expand Up @@ -99,7 +96,10 @@ export const recordBuckets = async (
storage.set({
buckets: {
...buckets,
[bucketInfo.type]: [bucketInfo.info, ...buckets[bucketInfo.type]],
[bucketInfo.type]: [
{ ...bucketInfo.info, origin: response.initiator },
...buckets[bucketInfo.type],
],
},
});
if (bucketInfo.type === "good") addNumber(buckets);
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface IBucketInfo {
permissions: Record<string, string[]>;
date: number;
hostname: string;
origin: string;
}
export type ILastSeen = Record<string, number>;

Expand Down

0 comments on commit 3779fe3

Please sign in to comment.