π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove ab endpoint
Manav Rathib62a86a94b67
diff --git a/server/cmd/museum/main.go b/server/cmd/museum/main.goindex 1d6baf3946..262d276bde 100644--- a/server/cmd/museum/main.go+++ b/server/cmd/museum/main.go@@ -608,7 +608,6 @@ func main() {publicCollectionAPI.GET("/multipart-upload-urls", publicCollectionHandler.GetMultipartUploadURLs)publicCollectionAPI.POST("/file", publicCollectionHandler.CreateFile)publicCollectionAPI.POST("/verify-password", publicCollectionHandler.VerifyPassword)- publicCollectionAPI.POST("/report-abuse", publicCollectionHandler.ReportAbuse)castAPI := server.Group("/cast")diff --git a/server/mail-templates/report_alert.html b/server/mail-templates/report_alert.htmldeleted file mode 100644index ec7eb33086..0000000000--- a/server/mail-templates/report_alert.html+++ /dev/null@@ -1,147 +0,0 @@-<!DOCTYPE html>-<html>- <meta content="text/html; charset=utf-8" />- <meta name="viewport" content="width=device-width, initial-scale=1,- minimum-scale=1" />- <style>- body {- background-color: #f0f1f3;- font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;- font-size: 16px;- line-height: 27px;- margin: 0;- color: #444;- }-- pre {- background: #f4f4f4f4;- padding: 2px;- }-- table {- width: 100%;- border: 1px solid #ddd;- }-- table td {- border-color: #ddd;- padding: 5px;- }-- .wrap {- background-color: #fff;- padding: 30px;- max-width: 525px;- margin: 0 auto;- border-radius: 5px;- }-- .button {- background: #0055d4;- border-radius: 3px;- text-decoration: none !important;- color: #fff !important;- font-weight: bold;- padding: 10px 30px;- display: inline-block;- }-- .button:hover {- background: #111;- }-- .footer {- text-align: center;- font-size: 12px;- color: #888;- }-- .footer a {- color: #888;- margin-right: 5px;- }-- .gutter {- padding: 30px;- }-- img {- max-width: 100%;- height: auto;- }-- a {- color: #0055d4;- }-- a:hover {- color: #111;- }-- @media screen and (max-width: 600px) {- .wrap {- max-width: auto;- }-- .gutter {- padding: 10px;- }- }-- .footer-icons {- padding: 4px !important;- width: 24px !important;- }- </style>-- <body>- <div class="gutter" style="padding: 4px"> </div>- <div class="wrap" style=" background-color: rgb(255, 255, 255); padding: 2px- 30px 30px 30px; max-width: 525px; margin: 0 auto; border-radius: 5px;- font-size: 16px; " >- <p>Hey,</p>-- <p>- This is to notify that someone you shared your album with has reported- its contents for abusing our- <a href="https://ente.io/terms" target="_blank">terms of service</a>.- </p>-- <p>Here are more details regarding this report:</p>- <ul>- <li>Album Link: {{.AlbumLink}}</li>- <li>Reason: {{.Reason}}</li>- </ul>- <p>If you need help, please respond to this email.</p>- </div>- <br />- <div class="footer" style="text-align: center; font-size: 12px; color:- rgb(136, 136, 136)" >- <div>- <a href="https://ente.io" target="_blank" ><img- src="https://email-assets.ente.io/ente-green.png" style="width: 100px;- padding: 24px" title="Ente" alt="Ente" /></a>- </div>- <div>- <a href="https://fosstodon.org/@ente" target="_blank" ><img- src="https://email-assets.ente.io/mastodon-icon.png"- class="footer-icons" style="width: 24px; padding: 4px" title="Mastodon"- alt="Mastodon" /></a>- <a href="https://twitter.com/enteio" target="_blank" ><img- src="https://email-assets.ente.io/twitter-icon.png" class="footer-icons"- style="width: 24px; padding: 4px" title="Twitter" alt="Twitter" /></a>- <a href="https://discord.ente.io" target="_blank" ><img- src="https://email-assets.ente.io/discord-icon.png" class="footer-icons"- style="width: 24px; padding: 4px" title="Discord" alt="Discord" /></a>- <a href="https://github.com/ente-io" target="_blank" ><img- src="https://email-assets.ente.io/github-icon.png" class="footer-icons"- style="width: 24px; padding: 4px" title="GitHub" alt="GitHub" /></a>- </div>- <p>- Ente Technologies, Inc.- <br /> 1111B S Governors Ave 6032 Dover, DE 19904- </p>- <br />- </div>- </body>-</html>diff --git a/server/mail-templates/report_limit_exceeded_alert.html b/server/mail-templates/report_limit_exceeded_alert.htmldeleted file mode 100644index a227fb9d4a..0000000000--- a/server/mail-templates/report_limit_exceeded_alert.html+++ /dev/null@@ -1,143 +0,0 @@-<!DOCTYPE html>-<html>- <meta content="text/html; charset=utf-8" />- <meta name="viewport" content="width=device-width, initial-scale=1,- minimum-scale=1" />- <style>- body {- background-color: #f0f1f3;- font-family: "Helvetica Neue", "Segoe UI", Helvetica, sans-serif;- font-size: 16px;- line-height: 27px;- margin: 0;- color: #444;- }-- pre {- background: #f4f4f4f4;- padding: 2px;- }-- table {- width: 100%;- border: 1px solid #ddd;- }-- table td {- border-color: #ddd;- padding: 5px;- }-- .wrap {- background-color: #fff;- padding: 30px;- max-width: 525px;- margin: 0 auto;- border-radius: 5px;- }-- .button {- background: #0055d4;- border-radius: 3px;- text-decoration: none !important;- color: #fff !important;- font-weight: bold;- padding: 10px 30px;- display: inline-block;- }-- .button:hover {- background: #111;- }-- .footer {- text-align: center;- font-size: 12px;- color: #888;- }-- .footer a {- color: #888;- margin-right: 5px;- }-- .gutter {- padding: 30px;- }-- img {- max-width: 100%;- height: auto;- }-- a {- color: #0055d4;- }-- a:hover {- color: #111;- }-- @media screen and (max-width: 600px) {- .wrap {- max-width: auto;- }-- .gutter {- padding: 10px;- }- }-- .footer-icons {- padding: 4px !important;- width: 24px !important;- }- </style>-- <body>- <div class="gutter" style="padding: 4px"> </div>- <div class="wrap" style=" background-color: rgb(255, 255, 255); padding: 2px- 30px 30px 30px; max-width: 525px; margin: 0 auto; border-radius: 5px;- font-size: 16px; " >- <p>Hey,</p>-- <p>We have received too many abuse reports against an album you've shared- over Ente.</p>-- <p>In an abundance of caution, we have temporarily disabled the publicly- accessible link that we were serving.</p>-- <p>In the meanwhile, if you need support, please respond to this- email.</p>- </div>- <br />- <div class="footer" style="text-align: center; font-size: 12px; color:- rgb(136, 136, 136)" >- <div>- <a href="https://ente.io" target="_blank" ><img- src="https://email-assets.ente.io/ente-green.png" style="width: 100px;- padding: 24px" title="Ente" alt="Ente" /></a>- </div>- <div>- <a href="https://fosstodon.org/@ente" target="_blank" ><img- src="https://email-assets.ente.io/mastodon-icon.png"- class="footer-icons" style="width: 24px; padding: 4px" title="Mastodon"- alt="Mastodon" /></a>- <a href="https://twitter.com/enteio" target="_blank" ><img- src="https://email-assets.ente.io/twitter-icon.png" class="footer-icons"- style="width: 24px; padding: 4px" title="Twitter" alt="Twitter" /></a>- <a href="https://discord.ente.io" target="_blank" ><img- src="https://email-assets.ente.io/discord-icon.png" class="footer-icons"- style="width: 24px; padding: 4px" title="Discord" alt="Discord" /></a>- <a href="https://github.com/ente-io" target="_blank" ><img- src="https://email-assets.ente.io/github-icon.png" class="footer-icons"- style="width: 24px; padding: 4px" title="GitHub" alt="GitHub" /></a>- </div>- <p>- Ente Technologies, Inc.- <br /> 1111B S Governors Ave 6032 Dover, DE 19904- </p>- <br />- </div>- </body>-</html>diff --git a/server/pkg/api/public_collection.go b/server/pkg/api/public_collection.goindex 81e1836f90..3cb56cb41a 100644--- a/server/pkg/api/public_collection.go+++ b/server/pkg/api/public_collection.go@@ -190,20 +190,7 @@ func (h *PublicCollectionHandler) VerifyPassword(c *gin.Context) {c.JSON(http.StatusOK, resp)}-// ReportAbuse captures abuse report for a public collection-func (h *PublicCollectionHandler) ReportAbuse(c *gin.Context) {- var req ente.AbuseReportRequest- if err := c.ShouldBindJSON(&req); err != nil {- handler.Error(c, stacktrace.Propagate(err, ""))- return- }- err := h.Controller.ReportAbuse(c, req)- if err != nil {- handler.Error(c, stacktrace.Propagate(err, ""))- return- }- c.Status(http.StatusOK)-}+// ReportAbuse endpoint removed// GetDiff returns the diff within a collection since a timestampfunc (h *PublicCollectionHandler) GetDiff(c *gin.Context) {diff --git a/server/pkg/controller/public/collection_link.go b/server/pkg/controller/public/collection_link.goindex 35f1c2ea1c..a24dee4616 100644--- a/server/pkg/controller/public/collection_link.go+++ b/server/pkg/controller/public/collection_link.go@@ -11,7 +11,6 @@ import (emailCtrl "github.com/ente-io/museum/pkg/controller/email""github.com/ente-io/museum/pkg/repo""github.com/ente-io/museum/pkg/utils/auth"- "github.com/ente-io/museum/pkg/utils/email""github.com/ente-io/museum/pkg/utils/time""github.com/ente-io/stacktrace""github.com/gin-gonic/gin"@@ -19,16 +18,8 @@ import ("github.com/sirupsen/logrus")-var AllowedReasons = map[string]string{- "COPYRIGHT": "Copyright Infringement",- "MALICIOUS_CONTENT": "Malicious Content",-}-const (AccessTokenLength = 10- // AutoDisableAbuseThreshold indicates minimum number of abuse reports post which the access token is- // automatically disabled- AutoDisableAbuseThreshold = 3// DeviceLimitThreshold represents number of unique devices which can access a shared collection. (ip + user agent)// is treated as unique device@@ -37,16 +28,6 @@ const (DeviceLimitThresholdMultiplier = 10DeviceLimitWarningThreshold = 2000-- AbuseAlertSubject = "[Alert] Abuse report received against your album on Ente"-- AbuseAlertTeamSubject = "Abuse report received"-- AbuseLimitExceededSubject = "[Alert] Too many abuse reports received against your album on Ente"-- AbuseAlertTemplate = "report_alert.html"-- AbuseLimitExceededTemplate = "report_limit_exceeded_alert.html")// CollectionLinkController controls share collection operations@@ -190,75 +171,7 @@ func (c *CollectionLinkController) VerifyPassword(ctx *gin.Context, req ente.Ver}func (c *CollectionLinkController) ValidateJWTToken(ctx *gin.Context, jwtToken string, passwordHash string) error {- return validateJWTToken(c.JwtSecret, jwtToken, passwordHash)-}--// ReportAbuse captures abuse report for a publicly shared collection.-// It will also disable the accessToken for the collection if total abuse reports for the said collection-// reaches AutoDisableAbuseThreshold-func (c *CollectionLinkController) ReportAbuse(ctx *gin.Context, req ente.AbuseReportRequest) error {- accessContext := auth.MustGetPublicAccessContext(ctx)- readableReason, found := AllowedReasons[req.Reason]- if !found {- return stacktrace.Propagate(ente.ErrBadRequest, fmt.Sprintf("unexpected reason %s", req.Reason))- }- logrus.WithField("collectionID", accessContext.CollectionID).Error("CRITICAL: received abuse report")-- err := c.CollectionLinkRepo.RecordAbuseReport(ctx, accessContext, req.URL, req.Reason, req.Details)- if err != nil {- return stacktrace.Propagate(err, "")- }- count, err := c.CollectionLinkRepo.GetAbuseReportCount(ctx, accessContext)- if err != nil {- return stacktrace.Propagate(err, "")- }- c.onAbuseReportReceived(accessContext.CollectionID, req, readableReason, count)- if count >= AutoDisableAbuseThreshold {- logrus.WithFields(logrus.Fields{- "collectionID": accessContext.CollectionID,- }).Warn("disabling accessTokens for shared collection due to multiple abuse reports")- return stacktrace.Propagate(c.Disable(ctx, accessContext.CollectionID), "")- }- return nil-}--func (c *CollectionLinkController) onAbuseReportReceived(collectionID int64, report ente.AbuseReportRequest, readableReason string, abuseCount int64) {- collection, err := c.CollectionRepo.Get(collectionID)- if err != nil {- logrus.Error("Could not get collection for abuse report")- return- }- user, err := c.UserRepo.Get(collection.Owner.ID)- if err != nil {- logrus.Error("Could not get owner for abuse report")- return- }- comment := report.Details.Comment- if comment == "" {- comment = "None"- }- err = email.SendTemplatedEmail([]string{user.Email}, "[email protected]", "[email protected]", AbuseAlertSubject, AbuseAlertTemplate, map[string]interface{}{- "AlbumLink": report.URL,- "Reason": readableReason,- "Comments": comment,- }, nil)- if err != nil {- logrus.Error("Error sending abuse notification ", err)- }- if abuseCount >= AutoDisableAbuseThreshold {- err = email.SendTemplatedEmail([]string{user.Email}, "[email protected]", "[email protected]", AbuseLimitExceededSubject, AbuseLimitExceededTemplate, nil, nil)- if err != nil {- logrus.Error("Error sending abuse limit exceeded notification ", err)- }- }- err = email.SendTemplatedEmail([]string{"[email protected]"}, "[email protected]", "[email protected]", AbuseAlertTeamSubject, AbuseAlertTemplate, map[string]interface{}{- "AlbumLink": report.URL,- "Reason": readableReason,- "Comments": comment,- }, nil)- if err != nil {- logrus.Error("Error notifying team about abuse ", err)- }+ return validateJWTToken(c.JwtSecret, jwtToken, passwordHash)}func (c *CollectionLinkController) HandleAccountDeletion(ctx context.Context, userID int64, logger *logrus.Entry) error {diff --git a/server/pkg/middleware/collection_link.go b/server/pkg/middleware/collection_link.goindex 797dacd382..280f04bf9c 100644--- a/server/pkg/middleware/collection_link.go+++ b/server/pkg/middleware/collection_link.go@@ -31,7 +31,7 @@ import ("github.com/sirupsen/logrus")-var passwordWhiteListedURLs = []string{"/public-collection/info", "/public-collection/report-abuse", "/public-collection/verify-password"}+var passwordWhiteListedURLs = []string{"/public-collection/info", "/public-collection/verify-password"}// CollectionLinkMiddleware intercepts and authenticates incoming requeststype CollectionLinkMiddleware struct {diff --git a/server/pkg/repo/public/collection_link.go b/server/pkg/repo/public/collection_link.goindex dfbc93679c..c697c35d77 100644--- a/server/pkg/repo/public/collection_link.go+++ b/server/pkg/repo/public/collection_link.go@@ -127,24 +127,7 @@ func (pcr *CollectionLinkRepo) UpdatePublicCollectionToken(ctx context.Context,return stacktrace.Propagate(err, "failed to update public collection token")}-func (pcr *CollectionLinkRepo) RecordAbuseReport(ctx context.Context, accessCtx ente.PublicAccessContext,- url string, reason string, details ente.AbuseReportDetails) error {- _, err := pcr.DB.ExecContext(ctx, `INSERT INTO public_abuse_report- (share_id, ip, user_agent, url, reason, details) VALUES ($1, $2, $3, $4, $5, $6)- ON CONFLICT ON CONSTRAINT unique_report_sid_ip_ua DO UPDATE SET (reason, details) = ($5, $6)`,- accessCtx.ID, accessCtx.IP, accessCtx.UserAgent, url, reason, details)- return stacktrace.Propagate(err, "failed to record abuse report")-}--func (pcr *CollectionLinkRepo) GetAbuseReportCount(ctx context.Context, accessCtx ente.PublicAccessContext) (int64, error) {- row := pcr.DB.QueryRowContext(ctx, `SELECT count(*) FROM public_abuse_report WHERE share_id = $1`, accessCtx.ID)- var count int64 = 0- err := row.Scan(&count)- if err != nil {- return -1, stacktrace.Propagate(err, "")- }- return count, nil-}+// Report-abuse functionality removed; DB left intact.func (pcr *CollectionLinkRepo) GetUniqueAccessCount(ctx context.Context, shareId int64) (int64, error) {row := pcr.DB.QueryRowContext(ctx, `SELECT count(*) FROM public_collection_access_history WHERE share_id = $1`, shareId)