Merge commit 'refs/security-review/pr844' into HEAD

This commit is contained in:
Thomas Durieux committed 2026-10-08 16:25:00 +00:00
commit 243396515e
163 files changed
+16198 -22725

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import { IFile } from "./files/files.types";
import { model, Schema } from "mongoose";
const schema = new Schema({ repoId: { type: String, required: true }, key: { type: String, required: true }, originalId: Schema.Types.ObjectId,
name: { type: String, required: true }, path: { type: String, default: "", required: true }, sha: String, size: Number,
anonymousName: String, anonymousDirectory: String, anonymousPath: String,
searchName: String, searchDirectory: String,
createdAt: { type: Date, default: Date.now } });
schema.index({ repoId: 1, key: 1, anonymousPath: 1, path: 1, name: 1 });
schema.index({ repoId: 1, key: 1, originalId: 1 }, { unique: true });
schema.index({ createdAt: 1 }, { expireAfterSeconds: 30 * 24 * 3600 });
export default model<IFile & { key: string; originalId: Schema.Types.ObjectId; anonymousName: string; anonymousDirectory: string; anonymousPath: string; searchName: string; searchDirectory: string; createdAt: Date }>("AnonymizedPath", schema);
@@ -68,4 +68,6 @@ const AnonymizedGistSchema = new Schema({
},
});
AnonymizedGistSchema.index({ status: 1, "options.expirationDate": 1 });
export default AnonymizedGistSchema;
@@ -65,4 +65,6 @@ const AnonymizedPullRequestSchema = new Schema({
},
});
AnonymizedPullRequestSchema.index({ status: 1, "options.expirationDate": 1 });
export default AnonymizedPullRequestSchema;
@@ -48,6 +48,19 @@ const AnonymizedRepositorySchema = new Schema({
repositoryName: String,
accessToken: { type: String, select: false },
},
cleanupToken: { type: String, select: false },
cleanupUntil: { type: Date, select: false },
treeGeneration: String,
stagedFileTrees: { type: [{ generation: String, until: Date }], default: undefined },
retiredTreeGenerations: { type: [String], default: undefined },
retiredContentPrefixes: { type: [String], default: undefined },
legacyContentCleanupPending: Boolean,
contentCacheVersion: Number,
contentCacheRevision: String,
emptyTreeGeneration: String,
fileMetadataRevision: String,
pathIndexKey: String,
pathIndexBuiltAt: Date,
truncatedFolders: {
type: [String],
default: [],
@@ -71,6 +84,7 @@ const AnonymizedRepositorySchema = new Schema({
type: Date,
default: Date.now,
},
sizeComputedAt: Date,
size: {
storage: {
type: Number,
@@ -88,10 +102,17 @@ const AnonymizedRepositorySchema = new Schema({
});
AnonymizedRepositorySchema.index({ "source.repositoryName": 1 });
AnonymizedRepositorySchema.index({ "coauthors.githubId": 1 });
AnonymizedRepositorySchema.index({ retiredTreeGenerations: 1 }, { sparse: true });
AnonymizedRepositorySchema.index({ "stagedFileTrees.until": 1 }, { sparse: true });
AnonymizedRepositorySchema.index({ retiredContentPrefixes: 1 }, { sparse: true });
AnonymizedRepositorySchema.index({ legacyContentCleanupPending: 1, status: 1 },
{ partialFilterExpression: { legacyContentCleanupPending: true } });
AnonymizedRepositorySchema.index({ status: 1, statusDate: 1 });
AnonymizedRepositorySchema.index({ lastView: 1 });
AnonymizedRepositorySchema.index({ anonymizeDate: 1 });
AnonymizedRepositorySchema.index({ status: 1, isReseted: 1, lastView: 1 });
AnonymizedRepositorySchema.index({ status: 1, "options.expirationDate": 1 });
AnonymizedRepositorySchema.index({
status: 1,
isReseted: 1,
@@ -30,6 +30,17 @@ export interface IAnonymizedRepository {
photo?: string;
addedAt?: Date;
}[];
treeGeneration?: string;
stagedFileTrees?: { generation: string; until: Date }[];
retiredTreeGenerations?: string[];
retiredContentPrefixes?: string[];
legacyContentCleanupPending?: boolean;
contentCacheVersion?: number;
contentCacheRevision?: string;
emptyTreeGeneration?: string;
fileMetadataRevision?: string;
pathIndexKey?: string;
pathIndexBuiltAt?: Date;
truncatedFolders: string[];
conference: string;
options: {
@@ -49,6 +60,7 @@ export interface IAnonymizedRepository {
};
pageView: number;
lastView: Date;
sizeComputedAt?: Date;
size: {
storage: number;
file: number;
+5
View File
@@ -0,0 +1,5 @@
import { model, Schema } from "mongoose";
const schema = new Schema({ owner: { type: Schema.Types.ObjectId, required: true },
type: { type: String, required: true }, artifactId: { type: String, required: true }, name: String });
schema.index({ owner: 1, type: 1, artifactId: 1 }, { unique: true });
export default model("DashboardName", schema);
+8
View File
@@ -4,6 +4,9 @@ const FileSchema = new Schema({
name: { type: String, index: true },
path: { type: String, index: true },
repoId: { type: String, index: true },
treeGeneration: String,
treeStaged: Boolean,
metadataPending: Boolean,
sha: {
type: String,
},
@@ -13,6 +16,11 @@ const FileSchema = new Schema({
});
FileSchema.index({ path: 1, repoId: 1 });
FileSchema.index({ metadataPending: 1, repoId: 1, treeGeneration: 1 },
{ partialFilterExpression: { metadataPending: true } });
FileSchema.index({ treeStaged: 1, repoId: 1, treeGeneration: 1 },
{ partialFilterExpression: { treeStaged: true } });
FileSchema.index({ repoId: 1, treeGeneration: 1, path: 1, name: 1 });
FileSchema.index(
{ repoId: 1, size: 1, path: 1 },
{ name: "repoId_1_size_1_path_1" }
+3
View File
@@ -4,6 +4,9 @@ export interface IFile {
name: string;
path: string;
repoId: string;
treeGeneration?: string;
treeStaged?: boolean;
metadataPending?: boolean;
sha?: string;
size?: number;
}
+1
View File
@@ -31,6 +31,7 @@ const UserSchema = new Schema({
},
],
photo: String,
projectNames: { type: Map, of: String },
repositories: [
{
type: String,
+1
View File
@@ -25,6 +25,7 @@ export interface IUser {
default: boolean;
}[];
photo?: string;
projectNames?: Map<string, string>;
repositories?: number[];
default?: {